It's all about the answers!

Ask a question

How to check the Work Allocation is set to default allocation?


ast java (45639) | asked Aug 16 '16, 9:03 a.m.
Hello Team,

I am trying to fetch the work allocation details of a user from RTC.

I found some solutions to get the details of work allocation as below,

 // Get the resource planning client
    final IResourcePlanningClient resourcePlanning =
        (IResourcePlanningClient) this.teamRepository.getClientLibrary(IResourcePlanningClient.class);

    // Get the contributor related planning information
    IContributorInfo info =
        resourcePlanning.getResourcePlanningManager().getContributorInfo(inspectUser, true, monitor);
    ItemCollection<IWorkResourceDetails> workDetails = info.getWorkDetails(inspectUser);
   
    for (IWorkResourceDetails iWorkResourceDetails : workDetails) {
.........
//For example to get timeline
IDevelopmentLineHandle developmentLine = iWorkResourceDetails.getDevelopmentLine();
.........
}

----------------------------------------------------------------
In the above code I can able to fetch all details except "Default Allocation" information.

This information is stored as a boolean. I had tried/used all the necessary methods to find it but no use.

Please let me know is there any way to find that information.

Thanks in advance.

Accepted answer


permanent link
Ralph Schoon (61.4k33643) | answered Aug 16 '16, 9:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This is how I think that works:

	/* (non-Javadoc)
	 * @see com.ibm.js.team.admin.automation.allocation.core.IWorkAssignment#isDefaultAllocation()
	 */
	@Override
	public boolean isDefaultAllocation() {
		Timestamp calStartTS = SimpleDateFormatUtil
				.createTimeStamp(
						SimpleDateFormatUtil.CalendarStart,
						SimpleDateFormatUtil.SIMPLE_DATE_FORMAT_PATTERN_YYYY_MM_DD_HH_MM_SS_Z);
		Timestamp startTS = new Timestamp(getStartDate().getTime());
		Timestamp calEndTS = SimpleDateFormatUtil
				.createTimeStamp(
						SimpleDateFormatUtil.CalendarEnd,
						SimpleDateFormatUtil.SIMPLE_DATE_FORMAT_PATTERN_YYYY_MM_DD_HH_MM_SS_Z);
		Timestamp endTS = new Timestamp(getEndDate().getTime());

		boolean sameStart = startTS.equals(calStartTS);
		boolean sameEnd = endTS.equals(calEndTS);
		return sameStart && sameEnd;
	}
ast java selected this answer as the correct answer

Comments
ast java commented Aug 17 '16, 1:25 a.m.

Thanks Ralph.


I had similar thought to check the start and end dates and get that value.

It meant that there is no direct way of getting the boolean value?


Ralph Schoon commented Aug 17 '16, 2:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Not that I am aware of, otherwise I would have let you know.

Your answer


Register or to post your answer.