org.eclipse.actf.validation.reports
Class ValidationReportRecord

java.lang.Object
  extended by org.eclipse.actf.validation.reports.ReportElement
      extended by org.eclipse.actf.validation.reports.ValidationReportRecord
All Implemented Interfaces:
Serializable, Comparable

public class ValidationReportRecord
extends ReportElement
implements Comparable

used as the basic reporting unit for a validation report. Hard-coded fields include the level of the violation and its corresponding string representation, the unique id of the component causing the problem, the class name of the component, the message describing the problem, a component name (if available), a long description of the violation, and a timestamp. Other fields can be added.

Author:
Mike Squillace
See Also:
Serialized Form

Field Summary
protected  String compName
           
protected  HashMap fieldMap
           
protected static ArrayList fieldNames
           
protected  HashMap fieldStringMap
           
protected  String id
           
protected  int level
           
static String LEVEL_FIELDNAME
           
protected  String locationPath
           
static String LOCATIONPATH_FIELDNAME
           
protected  String longMessage
           
static String LONGMESSAGE_FIELDNAME
           
protected  String message
           
static String MESSAGE_FIELDNAME
           
static String NAME_FIELDNAME
           
static String NODEID_FIELDNAME
           
protected  String nodeName
           
static String NODENAME_FIELDNAME
           
protected  String ruleId
           
static String RULEID_FIELDNAME
           
protected static String sortKey
           
protected  Calendar timestamp
           
static String TIMESTAMP_FIELDNAME
           
 
Constructor Summary
ValidationReportRecord()
          create a new record for a validation report
 
Method Summary
protected static void addAttributeName(String name)
           
static void addAttributeNames(String[] fieldNames)
          set the field names for all records.
 int compareTo(Object o)
           
 boolean equals(Object o)
           
 Object getAttribute(String field)
          get the value for the specified field
 String getAttributeAsString(String field)
          get the value for the specified field as a String.
static String[] getAttributeNames()
          get the field names being used for generated records
 String getComponentName()
           
 int getLevel()
           
 String getLevelAsString()
          return the level as a string or label stripped of its prefix
 String getLocationPath()
          Gets the location path for a component.
 String getLongMessage()
           
 String getMessage()
           
 String getNodeId()
           
 String getNodeName()
           
 String getRuleId()
          returns the rule id responsible for generating this record
static String getSortKey()
          return the sort key, the key according to which records are sorted
 Calendar getTimestamp()
           
 int hashCode()
           
 void setAttribute(String field, Object val)
          set the specified field using the given value
 void setAttributeAsString(String field, String val)
          set the specified field using the given String value.
 void setComponentName(String name)
           
 void setLevel(int level)
          set the level of the violation or message.
 void setLocationPath(String path)
          Sets the location path for this component.
 void setLongMessage(String message)
           
 void setMessage(String message)
           
 void setNodeId(String id)
          id of the component corresponding to this record.
 void setNodeName(String name)
           
 void setRuleId(String id)
          id of the rule corresponding to this record
static void setSortKey(String field)
          set the sort key which must be one of the defined field names or a field added by user
 void setTimestamp(Calendar timestamp)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NODEID_FIELDNAME

public static final String NODEID_FIELDNAME
See Also:
Constant Field Values

RULEID_FIELDNAME

public static final String RULEID_FIELDNAME
See Also:
Constant Field Values

NAME_FIELDNAME

public static final String NAME_FIELDNAME
See Also:
Constant Field Values

LEVEL_FIELDNAME

public static final String LEVEL_FIELDNAME
See Also:
Constant Field Values

MESSAGE_FIELDNAME

public static final String MESSAGE_FIELDNAME
See Also:
Constant Field Values

LONGMESSAGE_FIELDNAME

public static final String LONGMESSAGE_FIELDNAME
See Also:
Constant Field Values

NODENAME_FIELDNAME

public static final String NODENAME_FIELDNAME
See Also:
Constant Field Values

LOCATIONPATH_FIELDNAME

public static final String LOCATIONPATH_FIELDNAME
See Also:
Constant Field Values

TIMESTAMP_FIELDNAME

public static final String TIMESTAMP_FIELDNAME
See Also:
Constant Field Values

sortKey

protected static String sortKey

fieldNames

protected static ArrayList fieldNames

level

protected int level

nodeName

protected String nodeName

compName

protected String compName

id

protected String id

message

protected String message

longMessage

protected String longMessage

timestamp

protected Calendar timestamp

locationPath

protected String locationPath

ruleId

protected String ruleId

fieldMap

protected HashMap fieldMap

fieldStringMap

protected HashMap fieldStringMap
Constructor Detail

ValidationReportRecord

public ValidationReportRecord()
create a new record for a validation report

Method Detail

addAttributeNames

public static void addAttributeNames(String[] fieldNames)
set the field names for all records. This method should be used before any individual field is set.

Parameters:
fieldNames - - names of fields

getAttributeNames

public static String[] getAttributeNames()
get the field names being used for generated records

Returns:
field names being used by generated records

addAttributeName

protected static void addAttributeName(String name)

setSortKey

public static void setSortKey(String field)
set the sort key which must be one of the defined field names or a field added by user

Parameters:
field - - field according to which records are sorted

getSortKey

public static String getSortKey()
return the sort key, the key according to which records are sorted

Returns:
sort key

getLocationPath

public String getLocationPath()
Gets the location path for a component.

Returns:
the location path

setLocationPath

public void setLocationPath(String path)
Sets the location path for this component.

Parameters:
path - - the path to set.

getNodeName

public String getNodeName()
Returns:
Returns the class name of the component.

setNodeName

public void setNodeName(String name)
Parameters:
name - - the node name of the component
See Also:
IModel.getNodeName(Object)

getNodeId

public String getNodeId()
Returns:
the node id

setNodeId

public void setNodeId(String id)
id of the component corresponding to this record. The id is used in conjunction with creation context ids.

Parameters:
id -

getRuleId

public String getRuleId()
returns the rule id responsible for generating this record

Returns:
the rule id or null if no id was given

setRuleId

public void setRuleId(String id)
id of the rule corresponding to this record

Parameters:
id - rule id

getComponentName

public String getComponentName()
Returns:
Returns the component name.

setComponentName

public void setComponentName(String name)
Parameters:
name - - the name to set.

getLevelAsString

public String getLevelAsString()
return the level as a string or label stripped of its prefix

Returns:
level as a string or label

getLevel

public int getLevel()
Returns:
Returns the level.

setLevel

public void setLevel(int level)
set the level of the violation or message. This should be one of the levels defined in Reporter.

Parameters:
level - The level to set.
See Also:
IReporter

getMessage

public String getMessage()
Returns:
Returns the message.

setMessage

public void setMessage(String message)
Parameters:
message - The message to set.

getLongMessage

public String getLongMessage()
Returns:
Returns the long message.

setLongMessage

public void setLongMessage(String message)
Parameters:
message - The long message to set.

getTimestamp

public Calendar getTimestamp()
Returns:
Returns the timestamp.

setTimestamp

public void setTimestamp(Calendar timestamp)
Parameters:
timestamp - The timestamp to set.

setAttribute

public void setAttribute(String field,
                         Object val)
set the specified field using the given value

Parameters:
field - - field to set
val - - value of field

getAttribute

public Object getAttribute(String field)
get the value for the specified field

Parameters:
field - - field of which value is desired
Returns:
value of field

setAttributeAsString

public void setAttributeAsString(String field,
                                 String val)
set the specified field using the given String value.

Parameters:
field - - field to set
val - - String representation of value of field

getAttributeAsString

public String getAttributeAsString(String field)
get the value for the specified field as a String.

Parameters:
field - - field of which value is desired
Returns:
value of field as a String

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object