getCostRules

Purpose

Gets the details of the cost rules for the given set of IDs.

Function

For a given set of IDs, this operation reads the details of the cost rules that are persisted in the system.

Limitations

Performance might be an issue if more than a few thousand cost rules read at one time.

Input

An object with an array of existing cost rule IDs.

Return

An object with an array of WSCostRuleBean corresponding to the given set of IDs.

Java Interface

GetCostRulesResponseDocument getCostRules (GetCostRulesDocument in)

Parameters

Description

GetCostRulesDocument

Wrapper for cost rule ids array.

See the following example for the construction.

The following field is required:

  • Long[] ids

GetCostRulesResponseDocument

Wrapper for the array of cost rule beans (WSCostRuleBean) obtained performing this operation.

Java Examples

Example: Read cost rules for a given set of IDs.

CostRule[] getCostRules(long[] ids) throws Exception {
    FinanceServiceStub FM = new FinanceServiceStub(ctx, WSURL);
    GetCostRulesDocument getCostRulesDoc =
GetCostRulesDocument.Factory.newInstance();
getCostRulesDoc.addNewGetCostRules().setCostRuleIdArray(ids);
    GetCostRulesResponseDocument response =
FM.getCostRules(getCostRulesDoc);
    return
response.getGetCostRulesResponse().getCostRuleArray();
    }

Errors and Exceptions

When an error occurs on this operation, you will see 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: 
<exception:exceptionDetails xmlns:exception="http://www.mercury.com/ppm/ws/exception">
<exception:detail>[root cause description] </exception:detail>
</exception:exceptionDetails>

Root Cause Descriptions

Possible root cause descriptions:

Message Code

Message

Cause(s)

Possible Corrective Action

exception.authorization

You do not have the privilege to take this action. Consult your PPM Administrator.

User is not authorized to read the cost rule.

Check the user licenses and privileges (access grants).

ex.ObjectNotFound

Cannot load the {0} with the specified ID: {1}. {0} may be deleted by another user.

Cost rule is not found for any of the IDs in the array.

This means the cost rule with this ID does not exist in the PPM system.

Try to read with another existing ID.