how to get the timecodeId
Hello,
How can I get the corresponding relationship between timecodeId and timecodeName through the URL,just like I can get the corresponding relationship between the enumerationID of severity and enumerationName of severity through the URL"https://localhost:9443/ccm/oslc/enumerations/_NK97OTIPEeKNFJMqNw8Q4w/severity"("NK97OTIPEeKNFJMqNw8Q4w" is the ID of the ProjectArea) |
Accepted answer
Ralph Schoon (63.6k●3●36●46)
| answered May 30 '16, 2:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited May 30 '16, 2:40 a.m.
OSLC, all I have is: https://jazz.net/wiki/bin/view/Main/OSLCAccessForTimesheetEntry
In the Java API (in the downloadable code https://rsjazz.wordpress.com/2015/03/31/the-work-item-time-tracking-api/ ): /** * Get the time code identifier from the name * * @param timeCodeName * @return * @throws TeamRepositoryException */ private ITimeCode calculateTimeCode(String timeCodeName) throws TeamRepositoryException { // Find the time code ITimeCode timeCodeToSet = null; List<ITimeCode> timeCodes = getWorkItemCommon().getTimeCodes( getWorkItem().getProjectArea()); for (ITimeCode aTimeCode : timeCodes) { if (aTimeCode.getTimeCodeLabel().equals(timeCodeName)) { timeCodeToSet = aTimeCode; break; } } if (timeCodeToSet == null) { throw new TeamRepositoryException("Timecode not found: " + timeCodeName); } return timeCodeToSet; } Li Li selected this answer as the correct answer
|
One other answer
I try to use OSLC to add timesheet through the following code
public boolean addDairy(String startdate,float spentTime,String timeCode,String timeCodeId,String defectId,String userId){
String url=rtcBaseURL + "/oslc/workitems/"+defectId+"/rtc_cm:timeSheet";//rtcBaseURL is like"https://jazz.com:9443/ccm"
String workItem=rtcBaseURL + "/resource/itemName/com.ibm.team.workitem.WorkItem/" + defectId;
String creator =rtcBaseURL+"/jts/users/"+userId;
String spentTm=new DecimalFormat("#").format(spentTime*3600000);
String jsonComment = "{\"rtc_cm:workItem\":\"" + workItem + "\",\"dc:creator\":\""+creator+"\",\"rtc_cm:startDate\":\""+startdate+"\",\"rtc_cm:timeCode\":\""+timeCode+"\",\"rtc_cm:timeCodeId\":\""+timeCodeId+"\",\"rtc_cm:timeSpent\":\""+spentTm+"\"}";
JSONObject json = (JSONObject) post(url, jsonComment);
return true;
}
I use the code to add timesheet ,howerver it return "HTTP/1.1 405 Method Not Allowed [Server: Apache-Coyote/1.1, Cache-Control: private, max-age=0, must-revalidate, Expires: Wed, 20 Jul 2016 06:48:54 GMT, Content-Length: 0, Date: Wed, 20 Jul 2016 06:48:54 GMT] org.apache.http.conn.BasicManagedEntity@3f4c24"
I have used the same method to add comments,and I want to know if I have the wrong OSLC interface .
|
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.