org.purl.sword.base
Class SwordValidationInfo

java.lang.Object
  extended by org.purl.sword.base.SwordValidationInfo

public class SwordValidationInfo
extends Object

Represents an validation information item about the elements/attributes.

Author:
Neil Taylor (nst@aber.ac.uk)

Field Summary
static String DUPLICATE_ELEMENT
           
static String ERROR_WITH_CONTENT
           
static String MISSING_ATTRIBUTE_WARNING
           
static String MISSING_CONTENT
           
static String MISSING_ELEMENT_ERROR
           
static String MISSING_ELEMENT_WARNING
           
static String UNKNOWN_ATTRIBUTE
           
static String UNKNOWN_ELEMENT
           
 
Constructor Summary
SwordValidationInfo(XmlName element)
          Create a new information object for the specified element.
SwordValidationInfo(XmlName element, String theMessage, SwordValidationInfoType theType)
          Create a new instance of a validation information object that reports on an element.
SwordValidationInfo(XmlName element, XmlName attribute)
          Create a new information object for the specified element's attribute.
SwordValidationInfo(XmlName element, XmlName attribute, String theMessage, SwordValidationInfoType theType)
          Create a new instance of a validation information object that reports on an attribute in the specified element.
 
Method Summary
 void addAttributeValidationInfo(SwordValidationInfo attribute)
           
 void addUnmarshallAttributeInfo(SwordValidationInfo unmarshallAttribute)
           
 void addUnmarshallElementInfo(SwordValidationInfo unmarshallElement)
           
 void addUnmarshallValidationInfo(ArrayList<SwordValidationInfo> elementItems, ArrayList<SwordValidationInfo> attributeItems)
           
 void addUnmarshallValidationInfo(SwordValidationInfo other)
           
 void addValidationInfo(SwordValidationInfo item)
          Add a related information item to this resource.
 void clearUnmarshallItems()
          Clear the list of unmarshalled info items.
 void clearValidationItems()
          Clear the list of validation info items.
 void createString(SwordValidationInfo info, StringBuffer buffer, String indent)
          Utility method that will recursively print out the list of items for the specified validation info object.
 XmlName getAttribute()
          Return the attribute that this information describes.
 String getContentDescription()
           
 XmlName getElement()
          Return the element that this information describes.
 String getMessage()
          Return the information message.
 SwordValidationInfoType getType()
          Return the type of information.
 Iterator<SwordValidationInfo> getUnmarshallAttributeInfoIterator()
           
 Iterator<SwordValidationInfo> getUnmarshallElementInfoIterator()
           
 Iterator<SwordValidationInfo> getValidationAttributeInfoIterator()
           
 Iterator<SwordValidationInfo> getValidationElementInfoIterator()
          Return an iterator to view the nested validation info objects.
protected  void resetType()
           
protected  void resetType(Iterator<SwordValidationInfo> iterator)
           
 void setAttribute(XmlName attribute)
          Set the attribute that this information describes.
 void setContentDescription(String contentDescription)
           
 void setElement(XmlName element)
          Set the element that this information describes.
 void setMessage(String message)
          Set the information message.
 void setType(SwordValidationInfoType type)
          Set the type of information
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_ELEMENT

public static final String UNKNOWN_ELEMENT
See Also:
Constant Field Values

UNKNOWN_ATTRIBUTE

public static final String UNKNOWN_ATTRIBUTE
See Also:
Constant Field Values

MISSING_ELEMENT_WARNING

public static final String MISSING_ELEMENT_WARNING
See Also:
Constant Field Values

MISSING_ATTRIBUTE_WARNING

public static final String MISSING_ATTRIBUTE_WARNING
See Also:
Constant Field Values

DUPLICATE_ELEMENT

public static final String DUPLICATE_ELEMENT
See Also:
Constant Field Values

MISSING_CONTENT

public static final String MISSING_CONTENT
See Also:
Constant Field Values

MISSING_ELEMENT_ERROR

public static final String MISSING_ELEMENT_ERROR
See Also:
Constant Field Values

ERROR_WITH_CONTENT

public static final String ERROR_WITH_CONTENT
See Also:
Constant Field Values
Constructor Detail

SwordValidationInfo

public SwordValidationInfo(XmlName element)
Create a new information object for the specified element. Sets the default type to be VALID.

Parameters:
theElement - The element.

SwordValidationInfo

public SwordValidationInfo(XmlName element,
                           XmlName attribute)
Create a new information object for the specified element's attribute. Sets the default type to be VALID.

Parameters:
theElement - the element.
theAttribute - the attribute.

SwordValidationInfo

public SwordValidationInfo(XmlName element,
                           String theMessage,
                           SwordValidationInfoType theType)
Create a new instance of a validation information object that reports on an element.

Parameters:
theElement - The element.
theMessage - The information message.
theType - The type of message.

SwordValidationInfo

public SwordValidationInfo(XmlName element,
                           XmlName attribute,
                           String theMessage,
                           SwordValidationInfoType theType)
Create a new instance of a validation information object that reports on an attribute in the specified element.

Parameters:
elementPrefix - Prefix for the element.
elementName - The local name for the element.
attributePrefix - Prefix for the attribute.
attributeName - The attribute.
theMessage - The information message.
theType - The type of message.
Method Detail

getMessage

public String getMessage()
Return the information message.

Returns:
the message

setMessage

public void setMessage(String message)
Set the information message.

Parameters:
message - the message to set

getType

public SwordValidationInfoType getType()
Return the type of information.

Returns:
the type

setType

public void setType(SwordValidationInfoType type)
Set the type of information

Parameters:
type - the type to set

getElement

public XmlName getElement()
Return the element that this information describes.

Returns:
the element

setElement

public void setElement(XmlName element)
Set the element that this information describes.

Parameters:
element - the element to set

getAttribute

public XmlName getAttribute()
Return the attribute that this information describes.

Returns:
the attribute

setAttribute

public void setAttribute(XmlName attribute)
Set the attribute that this information describes.

Parameters:
attribute - the attribute to set

addValidationInfo

public void addValidationInfo(SwordValidationInfo item)
Add a related information item to this resource.

Parameters:
item - The information item to store.

addAttributeValidationInfo

public void addAttributeValidationInfo(SwordValidationInfo attribute)

addUnmarshallElementInfo

public void addUnmarshallElementInfo(SwordValidationInfo unmarshallElement)

addUnmarshallAttributeInfo

public void addUnmarshallAttributeInfo(SwordValidationInfo unmarshallAttribute)

clearValidationItems

public void clearValidationItems()
Clear the list of validation info items.


clearUnmarshallItems

public void clearUnmarshallItems()
Clear the list of unmarshalled info items.


resetType

protected void resetType()

resetType

protected void resetType(Iterator<SwordValidationInfo> iterator)

getValidationElementInfoIterator

public Iterator<SwordValidationInfo> getValidationElementInfoIterator()
Return an iterator to view the nested validation info objects.

Returns:
Iterator for the nested objects.

getValidationAttributeInfoIterator

public Iterator<SwordValidationInfo> getValidationAttributeInfoIterator()
Returns:

getUnmarshallElementInfoIterator

public Iterator<SwordValidationInfo> getUnmarshallElementInfoIterator()
Returns:

getUnmarshallAttributeInfoIterator

public Iterator<SwordValidationInfo> getUnmarshallAttributeInfoIterator()
Returns:

getContentDescription

public String getContentDescription()
Returns:
the contentDescription

setContentDescription

public void setContentDescription(String contentDescription)
Parameters:
contentDescription - the contentDescription to set

addUnmarshallValidationInfo

public void addUnmarshallValidationInfo(ArrayList<SwordValidationInfo> elementItems,
                                        ArrayList<SwordValidationInfo> attributeItems)
Parameters:
elementItems -
attributeItems -

addUnmarshallValidationInfo

public void addUnmarshallValidationInfo(SwordValidationInfo other)

toString

public String toString()
Overrides:
toString in class Object

createString

public void createString(SwordValidationInfo info,
                         StringBuffer buffer,
                         String indent)
Utility method that will recursively print out the list of items for the specified validation info object.

Parameters:
info - The validation info object to display.
indent - The level of indent, expressed as a number of space characters.


Copyright © 2009 The DSpace Foundation. All Rights Reserved.