updateCostRules

Purpose

Updates the cost rates of the collection of existing cost rules in the system.

Function

Updates a collection of cost rules. Each rule to update is identified by its primary key and must exist in the database. The cost factor values of a rule cannot be changed after the rule is created. Only the collection of cost rates may be altered. You must record the updated rates as CostRuleUpdates so that the updates are visible to the Cost Rate Rule Update service, which triggers the service to update the costs of any affected entities.

Limitations

Updates can be made only to the cost rate for an existing cost rule. The cost factors cannot be updated. This is a functional limitation.

Related Information

createCostRules creates a collection of cost rules.

Input

An object of an array of WSCostRuleBean, which holds the cost rule IDs and the rates to update.

Return

None

Java Interface

UpdateCostRulesResponseDocument updateCostRules (UpdateCostRulesDocument in)

Parameters

Description

UpdateCostRulesDocument

Wrapper for WSCostRuleBean array.

See the following example for the construction.

The following fields in the bean are required:

  • Long id

  • List costRates// List<CostRateBean>

Java Examples

Example: update a given set of cost rules.

public void testUpdateCostRule() throws Exception {
    CostRule costRule = CostRule.Factory.newInstance();
    costRule.setId (30010); //Set the cost rule id.
    costRule.setRateArray(new CostRate[] {
    costRate(null, "Oct 13, 1994", 1.0f),
    costRate("Oct 14, 1994", "Jan 1, 2000", 2.0f),
    costRate("Jan 1, 2001", "Jan 1, 2001", 3.0f),
    costRate("Jan 2, 2001", "June 28, 2006", 3.7f)
    }
    );
    updateCostRules(new CostRule[] { costRule });
    }
    void updateCostRules(CostRule[] costRules) throws Exception
{
    FinanceServiceStub FM = new FinanceServiceStub(ctx, WSURL);
    UpdateCostRulesDocument updateCostRulesDoc =
UpdateCostRulesDocument.Factory.newInstance();
updateCostRulesDoc.addNewUpdateCostRules().setCostRuleArray(cos
tRules);
    FM.updateCostRules(updateCostRulesDoc);
    }

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).

error.ws.rateOverlap

One of the cost rules being created has two rates with overlapping effective ranges. Check the rule and fix the rate overlap.

One of the rules has two or more rates with overlapping effective ranges.

Check the effective date ranges specified for the cost rate in the cost rule and make sure the dates are not overlapping.

error.ws.update.idRequired

A cost rule ID is required when updating cost rules. Please fill in the ID for each of the rules you wish to modify.

The rule ID is not specified for the updated cost rule.

Specify the rule ID.

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 costRuleBeans.

Check to read the cost rule with the same ID to see if the cost rule exists.