wt.clients.replication.unit
Class PartHelper

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

public class PartHelper
extends Object

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

Supported API: true

Extendable: false

See Also:
wt.part.WTPart

Field Summary
private static ResourceBundle resource
           
private static String RESOURCE
           
 
Constructor Summary
PartHelper()
           
 
Method Summary
static BuildRule deleteBuildRule(BuildRule rule)
          Deletes a BuildRule.
static WTPart deletePart(WTPart part)
          Deletes a Part.
static WTPartReferenceLink deletePartReferenceLink(WTPartReferenceLink link)
          Deletes a WTPartReferenceLink.
static WTPartUsageLink deletePartUsageLink(WTPartUsageLink usagelink)
          Deletes a UsageLink.
static WTPartUsageLink deleteUsageLink(WTPartUsageLink usagelink)
          Deletes a UsageLink.
static WTPart[] getAllVersions(WTPartMaster[] masters, WTPartConfigSpec configSpec)
          Return all the versions of the specified PartMaster using the specified ConfigSpecItem.
static WTPart[] getAllVersions(WTPartMaster master, WTPartConfigSpec configSpec)
          Return all the versions of the specified PartMaster using the specified ConfigSpecItem.
static BuildRule[] getBuildRule(WTPart part)
          Gets the BuildRules for a Part.
static WTPartConfigSpec getConfigSpec()
          Gets the current ConfigSpec for the current user.
static String getLifeCycle(WTPart part)
          Get the name of the lifecycle the part is assigned to
static String getLifeCycleState(WTPart part)
          Get the lifecycle state of the specified part
static int getMaxLength(Class a_class, String attribute_constant)
          Get the maximum length for the specified attribute in the specified class.
static Part getPartForOID(String thePartID)
          Get the part with the specified object id
static WTPartReferenceLink[] getReferences(WTPart part)
          Gets the WTPartReferenceLinks for a Part.
protected  ResourceBundle getResource()
           
static State[] getStates()
          Gets the all the possible States.
static String getTeamTemplate(WTPart part)
          Get the name of the teamTemplate the part is assigned to
static WTPartUsageLink[] getUsedBy(WTPart part)
          Gets the used by UsageLinks for a Part.
static Explorable[] getUses(WTPart part)
          Gets the uses WTPartUsageLinks for a Part.
static Explorable[] getUses(WTPart part, WTPartConfigSpec configSpec)
          Gets the uses WTPartUsageLinks for a Part.
static WTPartUsageLink[] getUsesInterface(WTPart part)
          Get the WTPartUsageLinks for the specified part
static View[] getViews()
          Gets the allowed Views.
protected  void initResources()
           
static void main(String[] args)
          A short main to allow for testing and demonstrate usage.
static WTPartConfigSpec newConfigSpec(boolean checkedOut, State newState, View newView)
          Create a ConfigSpec based on the specified state, new, and checkout qualification.
static Object refresh(Persistable obj)
          Refresh the specified object.
static WTPart refresh(WTPart part)
          Refresh the specified part.
static WTPart revisePart(WTPart part)
          Revises a Part.
static BuildRule saveBuildRule(BuildRule rule)
          Save a BuildRule.
static WTPart savePart(WTPart part)
          Saves a Part.
static WTPartReferenceLink savePartReferenceLink(WTPartReferenceLink link)
          Save a ReferenceLink.
static WTPartUsageLink savePartUsageLink(WTPartUsageLink usagelink)
          Saves a WTPartUsageLink.
static WTPartUsageLink saveUsageLink(WTPartUsageLink usagelink)
          Saves a WTPartUsageLink.
static WTPartConfigSpec setConfigSpec(WTPartConfigSpec spec)
          Sets the ConfigSpec for the current principal.
 
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

PartHelper

public PartHelper()
Method Detail

initResources

protected void initResources()

getResource

protected ResourceBundle getResource()

getPartForOID

public static Part getPartForOID(String thePartID)
Get the part with the specified object id

Parameters:
thePartID - the id of the part requested
Returns:
the part 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 WTPart refresh(WTPart part)
                      throws WTException
Refresh the specified part.

Parameters:
part - the part to refresh
Returns:
the refreshed part
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

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

getViews

public static View[] getViews()
                       throws WTException
Gets the allowed Views.

Returns:
an array of wt.vc.views.View.
Throws:
WTException
See Also:
View

getReferences

public static WTPartReferenceLink[] getReferences(WTPart part)
                                           throws WTException
Gets the WTPartReferenceLinks for a Part.

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

getBuildRule

public static BuildRule[] getBuildRule(WTPart part)
                                throws WTException
Gets the BuildRules for a Part.

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

getUsedBy

public static WTPartUsageLink[] getUsedBy(WTPart part)
                                   throws WTException
Gets the used by UsageLinks for a Part.

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

getUses

public static Explorable[] getUses(WTPart part)
                            throws WTException
Gets the uses WTPartUsageLinks for a Part.

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

newConfigSpec

public static WTPartConfigSpec newConfigSpec(boolean checkedOut,
                                             State newState,
                                             View newView)
                                      throws WTException
Create a ConfigSpec based on the specified state, new, and checkout qualification.

Parameters:
newState - the value for the LifeCycleQualification
newView - the value for the ViewQualification
Returns:
a new ConfigSpec with the specified qualifications
Throws:
WTException

getUses

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

Parameters:
part - the part whose UsageLinks are requested
Returns:
an array of wt.part.WTPartUsageLink
Throws:
WTException
See Also:
Part, WTPartUsageLink

getUsesInterface

public static WTPartUsageLink[] getUsesInterface(WTPart part)
                                          throws WTException
Get the WTPartUsageLinks for the specified part

Parameters:
part - the to use
Returns:
an array of WTPartUsageLinks
Throws:
WTException

savePart

public static WTPart savePart(WTPart part)
                       throws WTException
Saves a Part.

Parameters:
part - the part to save
Returns:
the saved part
Throws:
WTException
See Also:
Part

deletePart

public static WTPart deletePart(WTPart part)
                         throws WTException
Deletes a Part.

Parameters:
part - the part to delete
Returns:
the deleted part
Throws:
WTException
See Also:
Part

revisePart

public static WTPart revisePart(WTPart part)
                         throws WTException,
                                WTPropertyVetoException
Revises a Part.

Parameters:
part - the part to revise
Returns:
the revised part
Throws:
WTException
WTPropertyVetoException
See Also:
Part

deletePartReferenceLink

public static WTPartReferenceLink deletePartReferenceLink(WTPartReferenceLink link)
                                                   throws WTException
Deletes a WTPartReferenceLink.

Parameters:
link - the link to delete
Returns:
the deleted link
Throws:
WTException
See Also:
WTPartReferenceLink

deleteBuildRule

public static BuildRule deleteBuildRule(BuildRule rule)
                                 throws WTException
Deletes a BuildRule.

Parameters:
rule - the build rule to delete
Returns:
the deleted rule
Throws:
WTException
See Also:
BuildRule

savePartReferenceLink

public static WTPartReferenceLink savePartReferenceLink(WTPartReferenceLink link)
                                                 throws WTException
Save a ReferenceLink.

Parameters:
link - the link to save
Returns:
the saved link
Throws:
WTException
See Also:
wt.part.ReferenceLink

saveBuildRule

public static BuildRule saveBuildRule(BuildRule rule)
                               throws WTException
Save a BuildRule.

Parameters:
rule - the build rule to save
Returns:
the saved rule
Throws:
WTException
See Also:
BuildRule

saveUsageLink

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

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

deleteUsageLink

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

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

savePartUsageLink

public static WTPartUsageLink savePartUsageLink(WTPartUsageLink usagelink)
                                         throws WTException
Saves a WTPartUsageLink.

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

deletePartUsageLink

public static WTPartUsageLink deletePartUsageLink(WTPartUsageLink usagelink)
                                           throws WTException
Deletes a UsageLink.

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

getLifeCycle

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

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

getTeamTemplate

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

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

getLifeCycleState

public static String getLifeCycleState(WTPart part)
                                throws WTException
Get the lifecycle state of the specified part

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

getAllVersions

public static WTPart[] getAllVersions(WTPartMaster[] masters,
                                      WTPartConfigSpec configSpec)
                               throws WTException
Return all the versions of the specified PartMaster using the specified ConfigSpecItem.

Parameters:
masters - the PartMasters whose versions are requested
Returns:
an array of qualified versions
Throws:
WTException

getAllVersions

public static WTPart[] getAllVersions(WTPartMaster master,
                                      WTPartConfigSpec configSpec)
                               throws WTException
Return all the versions of the specified PartMaster using the specified ConfigSpecItem.

Parameters:
master - the PartMaster whose versions are requested
Returns:
an array of qualified versions
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