It's all about the answers!

Ask a question

How can I get component created datetime?


silencehill wu (5022732) | asked Sep 25 '13, 9:30 a.m.
I am writting project by java plain api. 

Now, I want to get created/updated datetime of a component. But I found that getCreatedDate/getUpdatedDatetime API is not existed in IComponent class.  So how can I get the created datetime/updatetime of a component?
I have ever ask this question, but no answer.
Please give an advice.

One answer



permanent link
Ralph Schoon (63.5k33646) | answered Sep 25 '13, 10:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
A Component implements IComponent and IAuditable.
IAuditable provides modified() for the modification date. There is no creation date I could find.
IAuditable can have States (history) you can try to see if there is a state history with differnet modification times and take the first date if so.

Comments
silencehill wu commented Sep 29 '13, 12:30 p.m.

In my case, I want to remember the component created datetime and modified time. 

I'm write RTC extension project
. This project need to remember changed or created component name and other information into a custom table. So I want to  compare the updated datetime and created datetime of a component to make sure that the component is new or update. I can insert or update the component change into my custom table.

I want to check the component is update or created. 


1
Ralph Schoon commented Sep 30 '13, 3:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

According to the JavaDoc of IAuditable you can use the IAuditable.getPredecessorState() and IAuditable.getMergePredecessorState() State recursively, to find such information.

"IAuditable.getPredecessorState() Returns the primary predecessor state of this auditable item state. The predecessor state is another state of the same audtiable item. When ITeamRepository.allStates(IItemHandle, IAccessProfile) is used to retrieve all the known states of the item, the predecessor (and merge predecessor) states of each state can be used to construct the version graph.

A newly-created auditable item may or may not carry predecessor state information. Moreover, predecessor states are only retrieved when history is requested. Clients that want to see these must use allStates(itemHandle,HISTORY) in order to get meaningful values that they can depend on. The initial state of an item has no predecessor state."

Each state will have a modification date and the first modification date in the state hitory is the creation date.


silencehill wu commented Oct 02 '13, 6:05 a.m.

It seems need to do some source test.

I will try it.

Thks a lot.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.