Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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)

0 votes


Accepted answer

Permanent link
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

0 votes


One other answer

Permanent link
 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 .

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: May 29 '16, 10:19 p.m.

Question was seen: 1,815 times

Last updated: Jul 20 '16, 2:58 a.m.

Confirmation Cancel Confirm