com.starteam
Class EnumeratedValue

java.lang.Object
  extended by com.starteam.EnumeratedValue
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Audit.EventID, Change.ChangeType, Change.CommitAction, ChangePackage.SessionType, ChangePackage.State, ChangeRequest.ChangeRequestType, ChangeRequest.Platform, ChangeRequest.Priority, ChangeRequest.Severity, ChangeRequest.Status, ChangeRequest.StreamState, File.CharacterSet, File.Compression, File.EOLFormat, File.KeywordFlag, File.Status, File.StorageType, Folder.ExcludeFlags, Folder.Status, Group.GroupType, Project.Methodology, Project.Status, Requirement.Priority, Requirement.RequirementType, Requirement.Status, Requirement.StreamState, Server.EncryptionAlgorithm, Story.Risk, Story.Status, Story.StoryType, Story.StoryValue, Story.StreamState, Task.Constraint, Task.LifeCycleType, Task.Origin, Task.Priority, Task.ProcessUsage, Task.Status, Task.TaskType, TaskDependency.PredecessorType, Topic.Priority, Topic.Status, Topic.TopicType, Trace.Status, Trace.TraceType, TreeItem.MoSCoW, TypedResource.BranchState, User.GeographicTerritory, User.License, User.Status, View.ViewType, ViewMember.MyLock, ViewMember.ShareState

public class EnumeratedValue
extends java.lang.Object
implements java.io.Serializable

A simple integer/String pair object to be used for adding new custom enumerated fields (Property) and modifying existing enumerated fields (Property).

See Also:
Serialized Form

Constructor Summary
EnumeratedValue(int code, java.lang.String displayName)
          Creates a new enumerated value with the specified code and display name The default sort order is assigned the value of the code The internal name is set to the value of the display name but can subsequently be overridden.
EnumeratedValue(int code, Translations translations)
          Creates a new enumerated value with the specified code and translations for its display name.
 
Method Summary
 void addChild(EnumeratedValue child)
          Assign a new child to the hierarchy of this Enumerated Value.
 void assignParent(EnumeratedValue parent)
          Assign this Enumerated Value to a different parent This enumerated value may either be a root or a child of a different hierarchy The hierarchy tree is changed in accordance with this assignment This method is equivalent to EnumeratedValue.addChild(EnumeratedValue) However, if NULL is passed in as the parent parameter, then this EnumeratedValue is promoted to become a root.
 EnumeratedValue copy()
          Returns a deep copy of this object.
 void disable()
          Disable this enumerated value
 void enable()
          Enable this enumerated value
 boolean equals(java.lang.Object obj)
          Compares this EnumeratedValue instance with another one.
 EnumeratedValue findChild(java.lang.String internalName)
          return a child with the given internal name
 EnumeratedValue[] getChildValues()
          return the children of this Enumerated Value or an empty set if there are none The returned children are sorted by the specified sort order
 int getCode()
          Return the enum code for this object.
 java.lang.String getDebugString()
          returns a string used mainly for debugging
 int getDepthInHierarchy()
          Returns the depth of this enumerated value in the presentation hierarchy.
 java.lang.String getDisplayName()
          Returns the locale appropriate display name for the enumerated value.
 Translations getDisplayNameTranslations()
          Returns the display name translations for this enumerated value.
 java.lang.String getInternalName()
          Return the internal name for this object.
 EnumeratedValue getParentValue()
          Returns the parent value of this enumerated value, or null if this is a root value.
 int getSortOrder()
          Get the sort order of this enumerated value.
 boolean hasChildValues()
          Returns true if this enumerated value has any child values (that is, if it is not a leaf value).
 int hashCode()
          returns a unique hash for this instance
 boolean isClosedState()
          Returns true if this Enumerated Value represents the Closed State for its Property Note that the closed state is only meaningful if the property is the status property Note also that only 1 enumerated value may represent the closed state of a status property This property was first introduced in the 12.0 server Changing the closed state on a pre 12.0 server has no effect Querying for the Closed State on a 11.0 server is meaningless since the Process Types are restricted to Task, Requirement & ChangeRequest, and their Closed States are fixed
 boolean isDisabled()
          Return true if this enumerated value is disabled.
 boolean isEnabled()
          Return true if this enumerated value is enabled.
 boolean isEqualTo(EnumeratedValue ev)
          Compares this EnumeratedValue instance with another one.
 boolean isLeafValue()
          Returns true if this enumerated value has no child values.
 boolean isRootValue()
          Returns true if this enumerated value has no parent value.
 boolean isSelectable()
          Gets the IsSelectable attribute of this enumerated value.
 void setAfter(EnumeratedValue predecessor)
          Place (position) this Enumerated Value immediately after the specified predecessor An illegal state exception will be thrown if this Enumerated Value and the specified predecessor belong to different hierarchies If the context of the owning EnumeratedProperty is known to this and its predecessor, then the sort order of the entire forest of values is realigned in accordance with this assignment.
 void setChildValues(EnumeratedValue[] children)
          Set the children for this EnumeratedValue.
 void setClosedState(boolean closed)
          Set this Enumerated Value to represent a closed state for its property Note that the closed state is only meaningful if the property is the status property This property was first introduced in the 12.0 server.
 void setDisplayName(java.lang.String displayName)
          Sets the locale appropriate display name for this enumerated value
 void setDisplayNameTranslations(Translations translations)
          Sets the display name translations for this enumerated value.
 void setEnabled(boolean enabled)
          Enable or disable this enumerated value.
 void setInternalName(java.lang.String internalName)
          Change the internal name for this enumerated value.
 void setSelectable(boolean bSelectable)
          Sets the IsSelectable attribute of this enumerated value.
 void setSortOrder(int i)
          Set the sort order for this enumerated value.
 java.lang.String toString()
          returns the display name
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumeratedValue

public EnumeratedValue(int code,
                       Translations translations)
Creates a new enumerated value with the specified code and translations for its display name. The default sort order is assigned the value of the code Using this constructor requires the caller to specify the enum code and additionally, the newly created EnumeratedValue has not Property context Property context is provided by assigning this enumerated value to an enumerated property using EnumeratedProperty.setValues(EnumeratedValue[])

Parameters:
code - the enum code value
translations - the display names for this enumerated value. May not be null.

EnumeratedValue

public EnumeratedValue(int code,
                       java.lang.String displayName)
Creates a new enumerated value with the specified code and display name The default sort order is assigned the value of the code The internal name is set to the value of the display name but can subsequently be overridden. The display name may have associated translations, but not the internal name. Using this constructor requires the caller to specify the enum code and additionally, the newly created EnumeratedValue has not Property context Property context is provided by assigning this enumerated value to an enumerated property using EnumeratedProperty.setValues(EnumeratedValue[])

Parameters:
code - int
displayName - String
See Also:
EnumeratedValue.setInternalName(String), EnumeratedValue.setDisplayNameTranslations(Translations)
Method Detail

getParentValue

public EnumeratedValue getParentValue()
Returns the parent value of this enumerated value, or null if this is a root value.

Returns:
EnumeratedValue the parent value of this enumerated value or null

isRootValue

public boolean isRootValue()
Returns true if this enumerated value has no parent value. For an enumeration that is not hierarchical, all values are root values.

Returns:
boolean true if this enumerated value has no parent value.

hasChildValues

public boolean hasChildValues()
Returns true if this enumerated value has any child values (that is, if it is not a leaf value).

Returns:
boolean true if this enumerated value has any child values

isLeafValue

public boolean isLeafValue()
Returns true if this enumerated value has no child values. For an enumeration that is not hierarchical, all values are leaf values.

Returns:
boolean true if this enumerated value has no child values.

getDepthInHierarchy

public int getDepthInHierarchy()
Returns the depth of this enumerated value in the presentation hierarchy. If this is a root value, then the depth is zero; if this is a child of a root value, then the depth is 1; and so on.

Returns:
int the depth of this enumerated value in the presentation hierarchy

getChildValues

public EnumeratedValue[] getChildValues()
return the children of this Enumerated Value or an empty set if there are none The returned children are sorted by the specified sort order

Returns:
EnumeratedValue[] of children

setChildValues

public void setChildValues(EnumeratedValue[] children)
Set the children for this EnumeratedValue.

Parameters:
children - the children of this EnumeratedValue

findChild

public EnumeratedValue findChild(java.lang.String internalName)
return a child with the given internal name

Parameters:
internalName - the name of the child to find
Returns:
the enumerated value or null

addChild

public void addChild(EnumeratedValue child)
Assign a new child to the hierarchy of this Enumerated Value. The provided child may either be a root or a child of a different hierarchy The hierarchy tree is changed in accordance with this assignment If the context of the owning property is known to this parent and its child then the owning property itself is updated to reflect this re-assignment to avoid subsequent calls to setValues()

Parameters:
child - a child of this enumerated value

assignParent

public void assignParent(EnumeratedValue parent)
Assign this Enumerated Value to a different parent This enumerated value may either be a root or a child of a different hierarchy The hierarchy tree is changed in accordance with this assignment This method is equivalent to EnumeratedValue.addChild(EnumeratedValue) However, if NULL is passed in as the parent parameter, then this EnumeratedValue is promoted to become a root.

Parameters:
parent - the new parent of this enumerated value

setAfter

public void setAfter(EnumeratedValue predecessor)
Place (position) this Enumerated Value immediately after the specified predecessor An illegal state exception will be thrown if this Enumerated Value and the specified predecessor belong to different hierarchies If the context of the owning EnumeratedProperty is known to this and its predecessor, then the sort order of the entire forest of values is realigned in accordance with this assignment. If not, then the sort order of this object alone is reassigned

Parameters:
predecessor - the predecessor Enumerated Value

getCode

public int getCode()
Return the enum code for this object.

Returns:
the enum code for this object.

getInternalName

public java.lang.String getInternalName()
Return the internal name for this object. The internal name is used in lookups on the EnumeratedProperty

Returns:
the internal name for this object.
See Also:
EnumeratedProperty.findValue(String)

setInternalName

public void setInternalName(java.lang.String internalName)
Change the internal name for this enumerated value. The internal name is used in lookups on the EnumeratedProperty

Parameters:
internalName - the internal name for this object
See Also:
EnumeratedProperty.findValue(String)

isEnabled

public boolean isEnabled()
Return true if this enumerated value is enabled.

Returns:
true if this enumerated value is enabled.

isDisabled

public boolean isDisabled()
Return true if this enumerated value is disabled.

Returns:
true if this enumerated value is disabled.

isClosedState

public boolean isClosedState()
Returns true if this Enumerated Value represents the Closed State for its Property Note that the closed state is only meaningful if the property is the status property Note also that only 1 enumerated value may represent the closed state of a status property This property was first introduced in the 12.0 server Changing the closed state on a pre 12.0 server has no effect Querying for the Closed State on a 11.0 server is meaningless since the Process Types are restricted to Task, Requirement & ChangeRequest, and their Closed States are fixed

Returns:
true if this Enumerated Value represents a Closed State for its Property

setClosedState

public void setClosedState(boolean closed)
Set this Enumerated Value to represent a closed state for its property Note that the closed state is only meaningful if the property is the status property This property was first introduced in the 12.0 server. Only 1 enumerated value on an enumerated property has a closed state Changing the closed state on a pre 12.0 server has no effect

Parameters:
closed - true to represent an open state for the owning property

setEnabled

public void setEnabled(boolean enabled)
Enable or disable this enumerated value.

Parameters:
enabled - true if this enumerated value should be enabled

disable

public void disable()
Disable this enumerated value


enable

public void enable()
Enable this enumerated value


isSelectable

public boolean isSelectable()
Gets the IsSelectable attribute of this enumerated value. An enumerated value that is not selectable may appear in a 'value picker' interface, but only as a means of selecting a child value.

Returns:
boolean true if this enumerated value is selectable in a display

setSelectable

public void setSelectable(boolean bSelectable)
Sets the IsSelectable attribute of this enumerated value. An enumerated value that is not selectable may appear in a 'value picker' interface, but only as a means of selecting a child value.

Parameters:
bSelectable - boolean true if this EnumeratedValue should be selectable

getDisplayNameTranslations

public Translations getDisplayNameTranslations()
Returns the display name translations for this enumerated value. May return null if this was created using a single description string.

Returns:
the display name translations for this enumerated value

setDisplayNameTranslations

public void setDisplayNameTranslations(Translations translations)
Sets the display name translations for this enumerated value.

Parameters:
translations - the new translations

getDisplayName

public java.lang.String getDisplayName()
Returns the locale appropriate display name for the enumerated value.

Returns:
a locale appropriate display name

setDisplayName

public void setDisplayName(java.lang.String displayName)
Sets the locale appropriate display name for this enumerated value

Parameters:
displayName - String a locale appropriate display name

getSortOrder

public int getSortOrder()
Get the sort order of this enumerated value.

Returns:
The sort order of this enumerated value.

setSortOrder

public void setSortOrder(int i)
Set the sort order for this enumerated value. Note that applications can use the setAfter() api to avoid having to compute sort order, and to ensure that the sort order is automatically reassigned to the entire list of enumerated values, based on this change

Parameters:
i - The sort order of this enumerated value.

toString

public java.lang.String toString()
returns the display name

Overrides:
toString in class java.lang.Object
Returns:
the display name

copy

public EnumeratedValue copy()
Returns a deep copy of this object.

Returns:
a deep copy of this object.

equals

public boolean equals(java.lang.Object obj)
Compares this EnumeratedValue instance with another one. Returns true if their properties match, false otherwise

Overrides:
equals in class java.lang.Object
Parameters:
obj - The other EnumeratedValue instance
Returns:
boolean true if the two EnumeratedValues are equals

hashCode

public int hashCode()
returns a unique hash for this instance

Overrides:
hashCode in class java.lang.Object
Returns:
a unique hash for this instance

isEqualTo

public boolean isEqualTo(EnumeratedValue ev)
Compares this EnumeratedValue instance with another one. Returns true if their properties match, false otherwise

Parameters:
ev - The other EnumeratedProperty instance
Returns:
boolean true if this EnumeratedValue is equal to the other

getDebugString

public java.lang.String getDebugString()
returns a string used mainly for debugging

Returns:
a string used mainly for debugging


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.