org.openpermis.editor.policy.presenter
Class Problem

java.lang.Object
  extended by org.openpermis.editor.policy.presenter.Problem

public class Problem
extends Object

Describes a problem in a part.

Since:
0.3.0

Nested Class Summary
private static class Problem.ProblemRecorder
          Problem reporter that creates a list of problems.
 
Field Summary
private static int HASH_CODE_MULTIPLIER
          Multiplier used when combining hash codes.
private static int HASH_CODE_SEED
          Seed value used when combining hash codes.
private  org.openpermis.policy.PartProblemReporter.ProblemMessage message
          The type of problem.
private  Object[] parameters
          Additional parameters for the problem.
private  org.openpermis.policy.bean.PartBean part
          The part that has a problem.
 
Constructor Summary
Problem(org.openpermis.policy.bean.PartBean part, org.openpermis.policy.PartProblemReporter.ProblemMessage message, Object... parameters)
          Creates a new problem for the specified part, type and parameters.
 
Method Summary
static List<Problem> createProblemList(org.openpermis.policy.Policy policy)
          Creates a list of problem for the specified policy.
private  boolean equalParameter(Object o1, Object o2)
          Compare two parameters if they are equivalent.
private  boolean equalParameters(Problem other)
          Check if the paramters of this problem are the same as the ones of the other problem.
private  boolean equalPart(Problem other)
          Check if the other problem has the same part.
 boolean equals(Object obj)
           
 org.openpermis.policy.PartProblemReporter.ProblemMessage getMessage()
          Returns the type of the problem.
 Object[] getParameters()
          Returns the problem parameters.
 org.openpermis.policy.bean.PartBean getPart()
          Returns the part that has a problem.
 org.openpermis.policy.bean.SerialNumber getPartSerialNumber()
          Returns the serial number of the part that has a problem.
 int hashCode()
           
private  int parameterHash(Object parameter)
          Returns the hash code of a parameter.
private  int parametersHashCodes()
          Creates a single hash code for all parameters.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HASH_CODE_SEED

private static final int HASH_CODE_SEED
Seed value used when combining hash codes.

Constant Field Value:
17
Since:
0.3.0

HASH_CODE_MULTIPLIER

private static final int HASH_CODE_MULTIPLIER
Multiplier used when combining hash codes.

Constant Field Value:
37
Since:
0.3.0

part

private final org.openpermis.policy.bean.PartBean part
The part that has a problem.

Since:
0.3.0

message

private final org.openpermis.policy.PartProblemReporter.ProblemMessage message
The type of problem.

Since:
0.3.0

parameters

private final Object[] parameters
Additional parameters for the problem.

Since:
0.3.0
Constructor Detail

Problem

public Problem(org.openpermis.policy.bean.PartBean part,
               org.openpermis.policy.PartProblemReporter.ProblemMessage message,
               Object... parameters)
Creates a new problem for the specified part, type and parameters.

Parameters:
part - the part that has a problem.
message - the type of problem.
parameters - additional parameters for the problem.
Since:
0.3.0
Method Detail

createProblemList

public static final List<Problem> createProblemList(org.openpermis.policy.Policy policy)
Creates a list of problem for the specified policy.

Parameters:
policy - the policy for which to create the problem list.
Returns:
the problem list requested, never null.
Since:
0.3.0

getPartSerialNumber

public org.openpermis.policy.bean.SerialNumber getPartSerialNumber()
Returns the serial number of the part that has a problem.

Returns:
the serial number of the part that has a problem.
Since:
0.3.0

getPart

public org.openpermis.policy.bean.PartBean getPart()
Returns the part that has a problem.

Returns:
the part that has a problem.
Since:
0.3.0

getMessage

public org.openpermis.policy.PartProblemReporter.ProblemMessage getMessage()
Returns the type of the problem.

Returns:
the type of the problem.
Since:
0.3.0

getParameters

public Object[] getParameters()
Returns the problem parameters.

Returns:
the problem parameters.
Since:
0.3.0

equalPart

private boolean equalPart(Problem other)
Check if the other problem has the same part.

Parameters:
other - the other problem to compare to.
Returns:
true if it has the same part, false otherwise.
Since:
0.3.0

equalParameter

private boolean equalParameter(Object o1,
                               Object o2)
Compare two parameters if they are equivalent.

PartBean objects are compared by serial.

Parameters:
o1 - the first parameter, not null.
o2 - the second parameter, may be null.
Returns:
true if they are equivalent or have the same serial, false otherwise.
Since:
0.3.0

equalParameters

private boolean equalParameters(Problem other)
Check if the paramters of this problem are the same as the ones of the other problem.

Parameters:
other - the other problem to compare the paramters to.
Returns:
true if they have the same parameters, false otherwise.
Since:
0.3.0

parameterHash

private int parameterHash(Object parameter)
Returns the hash code of a parameter.

Parameters:
parameter - the parameter for which to retrieve the hash code.
Returns:
the hash code requested.
Since:
0.3.0

parametersHashCodes

private int parametersHashCodes()
Creates a single hash code for all parameters.

Returns:
the hash code requested.
Since:
0.3.0

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Since:
0.3.0

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
Since:
0.3.0

toString

public String toString()
Overrides:
toString in class Object
Since:
0.3.0


PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:15:22
Copyright (c) 2002-2007 Ergon Informatik AG