com.prozima.pengine
Class WBSComponent

java.lang.Object
  extended by com.prozima.pengine.WBSComponent
All Implemented Interfaces:
java.lang.Cloneable

public class WBSComponent
extends java.lang.Object
implements java.lang.Cloneable

Represents a component in the Work Breakdown Structure. A WBS component can contain multiple sub-components but may have only one parent component. Each component has a name and a code. NOTE: WBS methods in API will change before release of Version 1.0 of library.


Field Summary
static int MIN_CODE
           
static int MIN_TOP_LEVEL_CODE
           
 
Constructor Summary
WBSComponent()
           
 
Method Summary
 boolean addNodeID(int inNodeID)
          Add the ID of a schedule node to this component.
 WBSComponent clone()
           
 java.util.Set<java.lang.Integer> getAllNodeIDs()
          Get all the schedule nodes that are associated with this component.
 java.lang.String getCanonicalCode()
          Get the long-winded code for this component.
 java.util.List<java.lang.Integer> getChildComponentIDs()
          Retrieve a list of the IDs of the immediate child components of this WBS component.
 java.lang.Integer getCode()
          Get the code of this WBS Component.
 java.lang.Integer getID()
          Get the ID of this component.
 java.lang.String getName()
          Get the name of this component.
 java.lang.Integer getParentID()
          Get the ID of the parent component of this component.
 java.lang.Integer getProjectID()
          Get the ID of the Project this WBS component belongs to.
 boolean removeNodeID(int inNodeID)
          Removes the ID of a schedule node from being associated with this component.
 boolean setCode(int inCode)
          Set the Code of this component.
 boolean setID(int inID)
          Set the ID of this component.
 boolean setName(java.lang.String inName)
          Set the name of this component.
 boolean setParentID(java.lang.Integer inParentID)
          Set the ID of the parent component of this component.
 boolean setProjectID(int inProjectID)
          Set the project ID for this component.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_CODE

public static final int MIN_CODE
See Also:
Constant Field Values

MIN_TOP_LEVEL_CODE

public static final int MIN_TOP_LEVEL_CODE
See Also:
Constant Field Values
Constructor Detail

WBSComponent

public WBSComponent()
Method Detail

addNodeID

public final boolean addNodeID(int inNodeID)
Add the ID of a schedule node to this component.

Parameters:
inNodeID - ID of a schedule node.
Returns:
true if the schedule node ID was added, otherwise false.

clone

public WBSComponent clone()
                   throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getAllNodeIDs

public final java.util.Set<java.lang.Integer> getAllNodeIDs()
Get all the schedule nodes that are associated with this component.

Returns:
Set of IDs of schedule nodes associated with this component.

getCanonicalCode

public java.lang.String getCanonicalCode()
Get the long-winded code for this component. This long version is a "." separated list of the full branch of parent component code followed by the code of this component.

Returns:
String containing the full canonical code of this component.

getChildComponentIDs

public java.util.List<java.lang.Integer> getChildComponentIDs()
Retrieve a list of the IDs of the immediate child components of this WBS component.

Returns:
List of unique IDs of components. List is empty if the component has no child components.

getCode

public java.lang.Integer getCode()
Get the code of this WBS Component. The code is a positive integer.

Returns:
Integer Code of this component (a positive integer) or null if node code is assigned.

getID

public java.lang.Integer getID()
Get the ID of this component.

Returns:
ID of this component.

getName

public java.lang.String getName()
Get the name of this component.

Returns:
String or null if no name has been set.

getParentID

public java.lang.Integer getParentID()
Get the ID of the parent component of this component. Component does not have to have a parent component.

Returns:
Parent component or ProjectConstants.INVALID_ID if it has no parent.

getProjectID

public java.lang.Integer getProjectID()
Get the ID of the Project this WBS component belongs to.

Returns:
ID of the project.

removeNodeID

public final boolean removeNodeID(int inNodeID)
Removes the ID of a schedule node from being associated with this component.

Parameters:
inNodeID - ID of the schedule node to be removed.
Returns:
true if the schedule node ID is associated with this component, otherwise false.

setCode

public boolean setCode(int inCode)
Set the Code of this component.

Parameters:
inCode - New ID of the component. Must be a positive integer.
Returns:
true if the new Code value was greater than or equal to one.

setID

public boolean setID(int inID)
Set the ID of this component.

Parameters:
inID - New ID of the component.
Returns:
true if the new ID was changed, otherwise false.

setName

public boolean setName(java.lang.String inName)
Set the name of this component. No check is made to ensure the name is unique among siblings.

Parameters:
inName - Name of the WBS component. Cannot be null and its length must equal or exceed PEngineConstants.MINIMUM_NAME_LENTH.
Returns:
true if the name was valid and met the minimum length requirement.

setParentID

public boolean setParentID(java.lang.Integer inParentID)
Set the ID of the parent component of this component.

Parameters:
inParentID - Unique ID of the parent or null if it has no parent component.
Returns:
true if the component was set correctly, otherwise false.

setProjectID

public boolean setProjectID(int inProjectID)
Set the project ID for this component.

Parameters:
inProjectID - ID of the parent project.
Returns:
true if the ID has changed.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object