wt.clients.replication.unit
Class UnitHelper

java.lang.Object
  extended bywt.clients.replication.unit.UnitHelper

public class UnitHelper
extends Object

UnitHelper is a facade class that contains static methods for manipulating Units. It encapsulates some of the persistence and navigation operations for Units.

Supported API: true

Extendable: false

See Also:
wt.replication.unit.WTUnit

Field Summary
private static ResourceBundle resource
           
private static String RESOURCE
           
 
Constructor Summary
UnitHelper()
           
 
Method Summary
static WTUnit deleteUnit(WTUnit unit)
          Deletes a Unit.
static UnitWTPartUsageLink deleteUsageLink(UnitWTPartUsageLink usagelink)
          Deletes a UsageLink.
static WTPartConfigSpec getConfigSpec()
          Gets the current ConfigSpec for the current user.
static String getLifeCycle(WTUnit unit)
          Get the name of the lifecycle the unit is assigned to
static String getLifeCycleState(WTUnit unit)
          Get the lifecycle state of the specified unit
static int getMaxLength(Class a_class, String attribute_constant)
          Get the maximum length for the specified attribute in the specified class.
protected  ResourceBundle getResource()
           
static State[] getStates()
          Gets the all the possible States.
static String getTeamTemplate(WTUnit unit)
          Get the name of the teamTemplate the unit is assigned to
static WTUnit getUnitForOID(String theUnitID)
          Get the unit with the specified object id
static Explorable[] getUses(WTUnit unit)
          Gets the uses WTPartUsageLinks for a Unit.
static Explorable[] getUses(WTUnit unit, WTPartConfigSpec configSpec)
          Gets the uses WTPartUsageLinks for a unit.
static UnitWTPartUsageLink[] getUsesInterface(WTUnit unit)
          Get the WTPartUsageLinks for the specified unit
protected  void initResources()
           
static void main(String[] args)
          A short main to allow for testing and demonstrate usage.
static Object refresh(Persistable obj)
          Refresh the specified object.
static WTUnit refresh(WTUnit unit)
          Refresh the specified unit.
static WTUnit saveUnit(WTUnit unit)
          Saves a Unit
static UnitWTPartUsageLink saveUsageLink(UnitWTPartUsageLink usagelink)
          Saves a WTPartUsageLink.
static WTPartConfigSpec setConfigSpec(WTPartConfigSpec spec)
          Sets the ConfigSpec for the current principal.
static WTUnit setUnitConfigSpec(WTUnit unit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resource

private static ResourceBundle resource

RESOURCE

private static String RESOURCE
Constructor Detail

UnitHelper

public UnitHelper()
Method Detail

initResources

protected void initResources()

getResource

protected ResourceBundle getResource()

getUnitForOID

public static WTUnit getUnitForOID(String theUnitID)
Get the unit with the specified object id

Parameters:
theUnitID - the id of the part requested
Returns:
the unit with the specified object id

refresh

public static Object refresh(Persistable obj)
                      throws WTException
Refresh the specified object.

Parameters:
obj - the object to refresh
Returns:
the refreshed object
Throws:
WTException

refresh

public static WTUnit refresh(WTUnit unit)
                      throws WTException
Refresh the specified unit.

Parameters:
unit - the unit to refresh
Returns:
the refreshed unit
Throws:
WTException

getConfigSpec

public static WTPartConfigSpec getConfigSpec()
                                      throws WTException
Gets the current ConfigSpec for the current user.

Returns:
the current wt.vc.config.ConfigSpec for the user
Throws:
WTException
See Also:
ConfigSpec

setConfigSpec

public static WTPartConfigSpec setConfigSpec(WTPartConfigSpec spec)
                                      throws WTException
Sets the ConfigSpec for the current principal.

Parameters:
spec - the wt.vc.config.ConfigSpec.
Throws:
WTException
See Also:
ConfigSpec

setUnitConfigSpec

public static WTUnit setUnitConfigSpec(WTUnit unit)
                                throws WTException
Throws:
WTException

getStates

public static State[] getStates()
                         throws WTException
Gets the all the possible States.

Returns:
an array of wt.lifecycle.State
Throws:
WTException
See Also:
State

getUses

public static Explorable[] getUses(WTUnit unit)
                            throws WTException
Gets the uses WTPartUsageLinks for a Unit.

Parameters:
unit - - the unit to use
Returns:
an array of wt.part.WTPartUsageLink
Throws:
WTException
See Also:
Part, WTPartUsageLink

getUses

public static Explorable[] getUses(WTUnit unit,
                                   WTPartConfigSpec configSpec)
                            throws WTException
Gets the uses WTPartUsageLinks for a unit.

Returns:
an array of wt.part.WTPartUsageLink
Throws:
WTException
See Also:
WTUnit, WTPartUsageLink

getUsesInterface

public static UnitWTPartUsageLink[] getUsesInterface(WTUnit unit)
                                              throws WTException
Get the WTPartUsageLinks for the specified unit

Returns:
an array of WTPartUsageLinks
Throws:
WTException

saveUnit

public static WTUnit saveUnit(WTUnit unit)
                       throws WTException
Saves a Unit

Returns:
the saved unit
Throws:
WTException
See Also:
WTUnit

deleteUnit

public static WTUnit deleteUnit(WTUnit unit)
                         throws WTException
Deletes a Unit.

Parameters:
unit - the unit to delete
Returns:
the deleted unit
Throws:
WTException
See Also:
WTUnit

saveUsageLink

public static UnitWTPartUsageLink saveUsageLink(UnitWTPartUsageLink usagelink)
                                         throws WTException
Saves a WTPartUsageLink.

Returns:
the saved WTPartUsageLink
Throws:
WTException
See Also:
WTPartUsageLink

deleteUsageLink

public static UnitWTPartUsageLink deleteUsageLink(UnitWTPartUsageLink usagelink)
                                           throws WTException
Deletes a UsageLink.

Returns:
the deleted UsageLink
Throws:
WTException
See Also:
wt.part.UsageLink

getLifeCycle

public static String getLifeCycle(WTUnit unit)
                           throws WTException
Get the name of the lifecycle the unit is assigned to

Parameters:
unit - the part to find the lifecycle name for
Returns:
the lifecycle name for the specified unit
Throws:
WTException

getTeamTemplate

public static String getTeamTemplate(WTUnit unit)
                              throws WTException
Get the name of the teamTemplate the unit is assigned to

Parameters:
unit - the unit to find the lifecycle name for
Returns:
the teamTemplate name for the specified unit
Throws:
WTException

getLifeCycleState

public static String getLifeCycleState(WTUnit unit)
                                throws WTException
Get the lifecycle state of the specified unit

Parameters:
unit - the unit whose name is requested
Returns:
the lifecycle state name for the unit
Throws:
WTException

main

public static void main(String[] args)
A short main to allow for testing and demonstrate usage.


getMaxLength

public static int getMaxLength(Class a_class,
                               String attribute_constant)
                        throws WTIntrospectionException
Get the maximum length for the specified attribute in the specified class.

Parameters:
a_class - the class
attribute_constant - the string constant for the attribute
Returns:
the maximum length of the attribute
Throws:
WTIntrospectionException