getTimeSheetPolicy
Purpose
Read an existing Time Sheet Policy object in PPM.
Note: This operation supports the Day in Days option and Period in Days option, which were introduced since PPM Center version 8.00 Service Pack 1. For more information, see the Time Sheet Update Service section in Project and Portfolio Management Center Version 8.00.01 (Service Pack 1) Release Notes.
Function
This operation reads an existing Time Sheet Policy object, identified by the unique time sheet policy name in PPM.
Input
A String value of the name of an existing time sheet policy
Return
An object of TimeSheetPolicyBean
Java Interface
GetTimeSheetPolicyResponseDocument getTimeSheetPolicy(GetTimeSheetPolicyDocument in)
Parameters |
Description |
---|---|
GetTimeSheetPolicyDocument |
Wrapper for a String value which holds the policy name. See the following example for the construction. |
GetTimeSheetPolicyResponseDocument |
Wrapper for a TimeSheetPolicyBean. See the following example for retrieving the bean and its fields. Each bean includes the following fields:
|
Java Examples
Example: read an existing time sheet policy.
public void testGetTimeSheetPolicy() { System.out.println("testGetTimeSheetPolicy started ..."); try { TimeServiceStub stub = new TimeServiceStub(ctx, WSURL);
GetTimeSheetPolicyDocument getTimeSheetPolicyDocument = GetTimeSheetPolicyDocument.Factory.newInstance();
getTimeSheetPolicyDocument.addNewGetTimeSheetPolicy().setPolicy Name("Semi-Monthly - Day - Hours");
GetTimeSheetPolicyResponseDocument response = stub.getTimeSheetPolicy(getTimeSheetPolicyDocument); final TimeSheetPolicyBean returntimesheetPolicy = response.getGetTimeSheetPolicyResponse().getReturn();
System.out.println("Time Sheet Policy was found " + returntimesheetPolicy.getTimeSheetPolicyId()); } catch(Exception e) { e.printStackTrace(); } System.out.println("testGetTimeSheetPolicy completed"); }
Errors and Exceptions
When an error occurs on this operation, you will receive a description of the root cause in the log or in the response message.
The server log file content is similar to the following:
Exception in thread "main" org.apache.axis2.AxisFault: [root cause description]
Response message:
<exception:exceptionDetails xmlns:exception="http:// www.mercury.com/ppm/ws/exception"> <exception:detail>[root cause description] </exception:detail> </exception:exceptionDetails>
Possible root cause descriptions:
Message Code |
Message |
Cause(s) |
Possible Corrective Action |
---|---|---|---|
ex.policyNotExist |
Policy does not exist with name {0} |
Policy does not exist, or corrupt database. |
Check the validity of the policy name (must be unique in PPM Center) |
* All the following operations are convenience helper methods to change the status of a time sheet or a time sheet line:
Since status change can occur only from a specific existing status, you must perform a validity check for this existing status first. If the existing status does not accord with the functionality you want to achieve (for example, you try to submit an approved time sheet), an exception is thrown.
Note: If you want to update a time sheet or a time sheet line within the existing TimeSheetBean, you must input the whole TimeSheetBean. For example, if time sheet contains 100 lines, you must input all 100 lines by using Web service, not only the one that you want to update. Otherwise, all the lines that you did not input will be missing from the time sheet.