org.bibalex.daf.handlers.statusdatahandler
Class FileLevelInfo

java.lang.Object
  extended by org.bibalex.daf.handlers.statusdatahandler.FileLevelInfo
All Implemented Interfaces:
java.util.Comparator<FileLevelInfo>

public class FileLevelInfo
extends java.lang.Object
implements java.util.Comparator<FileLevelInfo>

Holds the information that corresponds to files. These information are:
1) Type: The type of the entry.
2) From: The start file number.
3) To: The end file number.
4) Phase: The recommended phase for the files to go.
5) Reason: The reason for the files to go to that phase.
6) User: The user who issued the request.
7) Done: Whether the entries are marked as done or not.
8) Comment: The comment associated with the entry.

Author:
Shehab.Kamal

Field Summary
 java.lang.String comment
          The comment associated with this info.
 boolean done
          Whether the files are corrected or not.
 int from
          The start file number.
static java.lang.String INFORMATION
          Indicates that the type of the FileLevelInfo is information to be done by the user having the job.
static java.lang.String INSTRUCTION
          Indicates that the type of the FileLevelInfo is instruction to be done by the user having the job.
static java.lang.String NEXT_INFORMATION
          Indicates that the type of the FileLevelInfo is information to be done by the next user.
static java.lang.String NEXT_INSTRUCTION
          Indicates that the type of the FileLevelInfo is instruction to be done by the next user.
 int phase
          The recommended phase for the files to go.
 int reason
          The reason for the files to go for the specified phase.
 int to
          The end file number.
 java.lang.String type
          The type of this info.
 int user
          The ID of the user who created this entry.
 
Constructor Summary
FileLevelInfo()
          Creates a new instance of FileLevelInfo.
The deafult type is instruction.
FileLevelInfo(org.w3c.dom.Node node)
          Creates a new instance of FileLevelInfo.
FileLevelInfo(java.lang.String nodeRep)
          Creates a new instance of FileLevelInfo.
FileLevelInfo(java.lang.String type, int from, int to, int phase, int reason, int user, boolean done, java.lang.String comment)
          Creates a new instance of FileLevelInfo.
 
Method Summary
 void changeType()
          Changes the type of this instance.
 int compare(FileLevelInfo o1, FileLevelInfo o2)
          Compares the types of the objects
private  void createElementFromNode(org.w3c.dom.Node node)
          Creates the FiLeLevelInfo by supplying its XmlNode represenation.
 boolean isInformation()
          Determines whether the type of the FileLevelInfo is 'Information' or 'Instruction'.
ToDo info are the entries whose type is FileLevelInfo.INFORMATION or FileLevelInfo.NEXT_INFORMATION.
 boolean isToDo()
          Determines whether the type of the FileLevelInfo is 'ToDo' or 'Next'.
ToDo info are the entries whose type is FileLevelInfo.INFORMATION or FileLevelInfo.INSTRUCTION.
 java.lang.String toString()
          Returns the String representation of this instance.
 java.lang.String toXmlString()
          Converts this instance to a valid XML string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

NEXT_INSTRUCTION

public static final java.lang.String NEXT_INSTRUCTION
Indicates that the type of the FileLevelInfo is instruction to be done by the next user.

See Also:
Constant Field Values

NEXT_INFORMATION

public static final java.lang.String NEXT_INFORMATION
Indicates that the type of the FileLevelInfo is information to be done by the next user.

See Also:
Constant Field Values

INSTRUCTION

public static final java.lang.String INSTRUCTION
Indicates that the type of the FileLevelInfo is instruction to be done by the user having the job.

See Also:
Constant Field Values

INFORMATION

public static final java.lang.String INFORMATION
Indicates that the type of the FileLevelInfo is information to be done by the user having the job.

See Also:
Constant Field Values

type

public java.lang.String type
The type of this info.


from

public int from
The start file number.


to

public int to
The end file number.


phase

public int phase
The recommended phase for the files to go.


reason

public int reason
The reason for the files to go for the specified phase.


user

public int user
The ID of the user who created this entry.


done

public boolean done
Whether the files are corrected or not.


comment

public java.lang.String comment
The comment associated with this info.

Constructor Detail

FileLevelInfo

public FileLevelInfo()
Creates a new instance of FileLevelInfo.
The deafult type is instruction.


FileLevelInfo

public FileLevelInfo(java.lang.String type,
                     int from,
                     int to,
                     int phase,
                     int reason,
                     int user,
                     boolean done,
                     java.lang.String comment)
Creates a new instance of FileLevelInfo.

Parameters:
type - The type of the FileLevelInfo.
from - The start file number.
to - The end file number.
phase - The phase thatthe files needs modification in.
reason - The reason for the files to go to the specified phase.
user - The ID of the user who creates the entry.
done - Determines whether the files has been corrected or not.
comment - The commnet associated with this entry.

FileLevelInfo

public FileLevelInfo(org.w3c.dom.Node node)
              throws FileLevelInfoException
Creates a new instance of FileLevelInfo.

Parameters:
node - The Xml Node representing this FileLevelInfo.
Throws:
FileLevelInfoException - If the given node couldn't be parsed.

FileLevelInfo

public FileLevelInfo(java.lang.String nodeRep)
              throws FileLevelInfoException
Creates a new instance of FileLevelInfo.

Parameters:
nodeRep - The Xml String representing this FileLevelInfo.
Throws:
FileLevelInfoException - If the given String couldn't be parsed.
Method Detail

createElementFromNode

private void createElementFromNode(org.w3c.dom.Node node)
                            throws FileLevelInfoException
Creates the FiLeLevelInfo by supplying its XmlNode represenation.

Parameters:
node - The Xml Node representing this element.
Throws:
FileLevelInfoException - If the node name is not 'Info' or attributes are missing.

changeType

public void changeType()
Changes the type of this instance. That is changes a 'ToDo' info into a 'Next' one and vice versa.


isToDo

public boolean isToDo()
Determines whether the type of the FileLevelInfo is 'ToDo' or 'Next'.
ToDo info are the entries whose type is FileLevelInfo.INFORMATION or FileLevelInfo.INSTRUCTION.

Returns:
True if the type is ToDo otherwise false.

isInformation

public boolean isInformation()
Determines whether the type of the FileLevelInfo is 'Information' or 'Instruction'.
ToDo info are the entries whose type is FileLevelInfo.INFORMATION or FileLevelInfo.NEXT_INFORMATION.

Returns:
True if the type is Information otherwise false.

toString

public java.lang.String toString()
Returns the String representation of this instance.

Overrides:
toString in class java.lang.Object
Returns:
The String representation of this instance.

toXmlString

public java.lang.String toXmlString()
Converts this instance to a valid XML string.

Returns:
A valid XML string representing this instance.

compare

public int compare(FileLevelInfo o1,
                   FileLevelInfo o2)
Compares the types of the objects

Specified by:
compare in interface java.util.Comparator<FileLevelInfo>
Parameters:
o1 - The first object
o2 - The second object
Returns:
0 if the 2 types are equal
-1 if the first object type is instruction or next_instruction
1 if the second object type is instruction or next_instruction