com.ibm.ram.policy
Class Result

java.lang.Object
  extended by com.ibm.ram.policy.Result

public class Result
extends java.lang.Object

Indicates the success or failure of a policy test method. A policy test method should not throw an exception. This object contains a return code and a set of ResultEntries. The return code must be one of the following values: ERROR, WARNING, or SUCCESS. Those constant values are defined in the Result class. You can set the values while adding messages or by using the setReturnCode() method. The default value for the new ValidationStatus object is SUCCESS. The return code is set to the level of the highest valued messages. For example, if an entry with an error is set to the ERROR status, a subsequent entry that has a warning will also have an ERROR status. To restore the return code to a lower level, use the setReturnCode() method. You can add entries by invoking the addEntry() method. This method adds entries to an ordered list of diagnostic information that can be made available to the application or user that is invoking the operation. The added entry must have a return code value and a diagnostic message, which might contain links. It might be useful to return policy diagnostic information for the results of any policy test, whether it is a failure or a success.

Since:
7.0.0.1

Field Summary
static int ERROR
          Policy compliance error
static int PENDING
          Policy result pending
static int SUCCESS
          Policy compliance success
static int SUCCESS_FORCE_APPROVE
          Policy result success force approve.
static int WARNING
          Policy compliance warning
 
Constructor Summary
Result()
          Subclasses will need to include a default constructor (no arguments)
Result(Policy policy)
           
 
Method Summary
 void addDetail(ResultDetail detail)
          Add a ResultDetail to the overall ResultDetail list for this Result
 void deserialize(java.lang.String metadata)
          Subclasses should override this to hydrate any saved data
 Policy.CustomReturnCode getCustomReturnCode()
          Get the customReturnCode of this Result.
 ResultDetail[] getDetails()
          Get a list of the ResultDetail objects for this Result
 java.lang.String getMessage()
          The descriptive message
 PendingPolicyExecutionInterval getPendingExecutionInterval()
           
 Policy getPolicy()
          Get the Policy that this Result references
 int getReturnCode()
          Get the return code of this Result
 java.lang.String serialize()
          Subclasses should override this to store any metadata Return any metadata needed for subclasses of Result as a String RAM will call deserialize with this String when hydrating this Result object
 void setCustomReturnCode(Policy.CustomReturnCode customReturnCode)
          Set the customReturnCode of this Result.
 void setMessage(java.lang.String message)
          The descriptive message
 void setPendingExecutionInterval(PendingPolicyExecutionInterval pendingExecutionInterval)
          User can configure the pending execution interval as to when to run the policy.
 void setPolicy(Policy policy)
          Set the Policy that this Result references
 void setReturnCode(int returnCode)
          Set the return code for this Result
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS_FORCE_APPROVE

public static final int SUCCESS_FORCE_APPROVE
Policy result success force approve.

Will bypass review process if all other policies are at least WARNING or better.

See Also:
Constant Field Values

SUCCESS

public static final int SUCCESS
Policy compliance success

See Also:
Constant Field Values

WARNING

public static final int WARNING
Policy compliance warning

See Also:
Constant Field Values

ERROR

public static final int ERROR
Policy compliance error

See Also:
Constant Field Values

PENDING

public static final int PENDING
Policy result pending

See Also:
Constant Field Values
Constructor Detail

Result

public Result(Policy policy)
Parameters:
policy - The Policy this Result references
Since:
7.0.0.1

Result

public Result()
Subclasses will need to include a default constructor (no arguments)

Since:
7.0.0.1
Method Detail

getCustomReturnCode

public Policy.CustomReturnCode getCustomReturnCode()
Get the customReturnCode of this Result.

The custom return code can be used to configure actions to take based on the outcome of a policy.

Returns:
The customReturnCode of this Result
Since:
7.2

setCustomReturnCode

public void setCustomReturnCode(Policy.CustomReturnCode customReturnCode)
Set the customReturnCode of this Result.

The custom return code can be used to configure actions to take based on the outcome of a policy.

Parameters:
customReturnCode - The custom return code for this Result
Since:
7.2

getReturnCode

public int getReturnCode()
Get the return code of this Result

Returns:
The return code of this Result
Since:
7.0.0.1

setReturnCode

public void setReturnCode(int returnCode)
Set the return code for this Result

Parameters:
returnCode - The return code for this Result
Since:
7.0.0.1

getPolicy

public Policy getPolicy()
Get the Policy that this Result references

Returns:
The Policy this Result references
Since:
7.0.0.1

setPolicy

public void setPolicy(Policy policy)
Set the Policy that this Result references

Parameters:
policy - The Policy this Result references
Since:
7.0.0.1

addDetail

public void addDetail(ResultDetail detail)
Add a ResultDetail to the overall ResultDetail list for this Result

Parameters:
detail - ResultDetail to add to this Result
Since:
7.0.0.1

getDetails

public ResultDetail[] getDetails()
Get a list of the ResultDetail objects for this Result

Returns:
Array of ResultDetails in this list
Since:
7.0.0.1

getMessage

public java.lang.String getMessage()
The descriptive message

Returns:
The message from the Result
Since:
7.0.0.1

setMessage

public void setMessage(java.lang.String message)
The descriptive message

Parameters:
message - The message for the Result
Since:
7.0.0.1

serialize

public java.lang.String serialize()
Subclasses should override this to store any metadata Return any metadata needed for subclasses of Result as a String RAM will call deserialize with this String when hydrating this Result object

Returns:
A string representation of Result metadata.
Since:
7.0.0.1

deserialize

public void deserialize(java.lang.String metadata)
Subclasses should override this to hydrate any saved data

Parameters:
metadata - Previously serialized metadata to set for this Result
Since:
7.0.0.1

getPendingExecutionInterval

public PendingPolicyExecutionInterval getPendingExecutionInterval()
Returns:
Returns the pendingExecutionInterval.
Since:
7.5.1

setPendingExecutionInterval

public void setPendingExecutionInterval(PendingPolicyExecutionInterval pendingExecutionInterval)
User can configure the pending execution interval as to when to run the policy. By default pending policy runs every 30 seconds. User can configure the execution interval To run policy every 2 minutes: int minutes = 2; result.setPendingExecutionInterval(PendingPolicyExecutionInterval.createMinutelyExecutionInterval(minutes)); result.setReturnCode(Result.PENDING); To run policy every 2 hours: int hours = 2; result.setPendingExecutionInterval(PendingPolicyExecutionInterval.createMinutelyExecutionInterval(hours)); result.setReturnCode(Result.PENDING); To run policy daily at 22:30: int hours = 22: int minutes =30; result.setPendingExecutionInterval(PendingPolicyExecutionInterval.createDailyExecutionInterval(hours, minutes)); result.setReturnCode(Result.PENDING); To run the policy every Tuesday at 22:30 int hours = 22: int minutes =30; result.setPendingExecutionInterval(PendingPolicyExecutionInterval.createDayOfWeekExecutionInterval(java.util.Calendar.TUESDAY, hours, minutes)); result.setReturnCode(Result.PENDING);

Parameters:
pendingExecutionInterval - The pendingExecutionInterval to set.
Since:
7.5.1