RTC API handling ChangeSetHandles and other things
So I'm implementing an OperationAdvisor for the Deliver operation. All I need to do is get the names of the files that are associated with the ChangeSet and the User who's checking them in.
Places I've already looked at which are relevant(which may be useful to some implementing similar things): https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/ I noticed that in the aforementioned blog that the class being extended is AbstractScmService (in contrast to the regular AbstractService) but this seems to be an internal class and I'm trying to avoid using it. http://jorgediazblog.wordpress.com/2014/04/01/work-item-cross-stream-deliveries-and-promotion-a-sample-precondition/ https://jazz.net/wiki/bin/view/Main/CustomPreconditionsTable https://www.ibm.com/developerworks/community/blogs/extendingrtc/entry/checksummaryadvisor?lang=en I also looked at some API examples here: https://jazz.net/wiki/pub/Main/RTCPlainJavaAPIs/ but those seem to be client-side oriented. This is where I'm currently at: public class AbstractService extends com.ibm.team.repository.service.AbstractService implements IOperationAdvisor { @Override public void run(AdvisableOperation operation, IProcessConfigurationElement advisorConfiguration, IAdvisorInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException { System.out.println("operation advisor called"); // get the deliver data Object o = operation.getOperationData(); if (!(o instanceof DeliverOperationData)) { System.out.println("Something went wrong"); //return; } DeliverOperationData data = (DeliverOperationData) o; for(IChangeSetHandle ChangeSetHandle : data.getChangeSetHandles()){ } /* alot of generic object printfs in loops that weren't leading me anywhere here */ } } I noticed that IContributorHandle and IChangeSetHandle ultimately extend IItemHandle, but how are those Handled? How do I eventually get the filenames associated with each change set? I managed to extract the files' timestamps through some light run-time debugging, but all I was doing was simply inspecting object members during run-time without using the intended interface functions to get them (the API that I'm looking for). Thanks, Info: RTC version (Server and client): 4.0.7 JDK/SDK : RTC stock 4.0.7 JDK/SDK |
Accepted answer
handles are unchangeable (immutable) objects that are stored in the database. they contain the linkage to reconstructing the complete object. (a handle can be reconstructed from its UUID) with some item manager api request to 'load' the full (or some subset) object contents. Zaid Al-Khishman selected this answer as the correct answer
Comments
sam detweiler
commented Nov 14 '14, 3:24 p.m.
getting to the filenames is a fun exercise.. RTC is an object oriented system so you need to work thru the object relationships..
Zaid Al-Khishman
commented Nov 14 '14, 3:32 p.m.
I see, how does the second arguement to fetchItem (the properties passed as a string) affect the Item that is returned?
sam detweiler
commented Nov 14 '14, 3:39 p.m.
argument 1 is the handle, argument 2 is the list of property names of the values to populate from the repository. FOR THAT ObjectType
Zaid Al-Khishman
commented Nov 14 '14, 3:41 p.m.
Nevermind, I read the API documentation.
1
sam detweiler
commented Nov 14 '14, 3:46 p.m.
yes, IRepositoryItemService.COMPLETE is the null specifier
1
sam detweiler
commented Nov 14 '14, 3:59 p.m.
handles are small.. objects consume more memory. loading lots of fields takes longer than a few. loading it all once, is probably ok, loading all of all workitems could cause performance issues or crash your app.
Zaid Al-Khishman
commented Nov 14 '14, 4:18 p.m.
Handles themselves don't seem to be small at all (at least not the sizes that I'm used to, perhaps maybe they are relatively), or at least that's the impression that I got from debugging the plugin. I figured there would only be a hash of some sort(which was there) or a reference but there was a lot of other information (I may have been looking at what the references were referring to) which I wasn't able to make sense of, But I guess at the end of the day all of that is internal implementation details that the API hides.
1
sam detweiler
commented Nov 14 '14, 4:28 p.m.
small is indeed a relative term.
showing 5 of 8
show 3 more comments
|
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.