How to write work allocation details using Java RTC API?
Hi Team,
I would like to write the user work allocation details via java rtc api.
My code snippet for reading the data is,
IContributorInfo info =
resourcePlanning.getResourcePlanningManager().getContributorInfo(inspectUser, true, monitor);
ItemCollection<IWorkResourceDetails> workDetails = info.getWorkDetails(inspectUser);
System.out.println(workDetails.size());
for (IWorkResourceDetails iWorkResourceDetails : workDetails) {
int assignment = iWorkResourceDetails.getAssignment(); //To get percentage
IAuditableHandle owner = iWorkResourceDetails.getOwner(); //To get the Project/Team area
IDevelopmentLineHandle developmentLine = iWorkResourceDetails.getDevelopmentLine();//To get the timeline
//And I can able to get the start & end dates.
}
Please let me know if any code snippet for the same.
Thanks in advance.
|
One answer
Ralph Schoon (63.5k●3●36●46)
| answered Sep 23 '16, 2:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This is all internal API. Here an example:
ArrayList<IWorkResourceDetails> toSave = new ArrayList<IWorkResourceDetails>(); for (IWorkAssignment workAssignment : allocations) { printAssignment(workAssignment); toSave.add(workAssignment.getWorkResourceDetails()); } if (!toSave.isEmpty()) { this.dirty = true; // We want to reload after the safe, to be sure. final IResourcePlanningClient resourcePlanning = (IResourcePlanningClient) teamRepository .getClientLibrary(IResourcePlanningClient.class); IWorkResourceDetails[] save = toSave .toArray(new IWorkResourceDetails[toSave.size()]); resourcePlanning.saveWorkDetails(save, monitor); } There is much more around this e.g. how to work with timestamps etc. I explored this to some extent, but did not get around blogging about it. Good luck. See https://rsjazz.wordpress.com/2014/07/22/manage-scheduled-absences-using-the-plainjava-client-libraries/ for some hints about the timestamp stuff. Comments
ast java
commented Sep 23 '16, 5:01 a.m.
Hi Ralph,
Thanks for the response.
I have few questions as below,
* In your code "allocations" refers list of "IWorkAssignment" - May I know how this has been updated? and which jar contains this "IWorkAssignment" interface?
* From my code I can able to get the list of "IWorkResourceDetails", But If i want to edit the allocation percentage, default allocation , start & end date there are no methods are available.
AND If I want to create a new iworkresourcedetails (with %, start & end date) how can I proceed?
From your code I am assuming that "allocations" list has been filled with the customized values and then adding into the RTC server.
I am interested on how it has been done.
I have updated my code snippet in the question.
Ralph Schoon
commented Sep 23 '16, 5:31 a.m.
| edited Sep 23 '16, 12:10 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
IWorkAssignment is an interface the is defined in my code, so not in the plain java client libraries.
ast java
commented Sep 26 '16, 5:44 a.m.
Ok. Thanks Ralph.
Is it possible to get the mutable copy of "IWorkResourceDetails". If 'yes' then which service is responsible for this?
|
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.