Package wt.vc
Class VersionControlHelper
java.lang.Object
wt.vc.VersionControlHelper
- All Implemented Interfaces:
Externalizable,Serializable
Provides access to the
VersionControlService Application Programming Interface (API) via the static reference
VersionControlHelper.service and several helper methods. Only one of the helper methods makes
server-side access: isReviseAllowed(wt.vc.Versioned, boolean).
This API includes static methods to make new iterations/versions, find the predecessor of an iteration/version, find
all the iteration(s) of a version, and get cookie information. These methods can be categorized as locally and
remotely invokeable. The local methods are getters of information, typically from cookies, that are held in the
client or server. The remote methods serve as wrappers to services that promote server-side functionality to clients.
Supported API: true
Extendable: false
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic IteratedassignIterationBranch(Iterated iteration, long branchId, boolean latest) Assigns a branch id and latest flag on the given iterated object to the given branch id and latest flag.static IteratedassignIterationCreator(Iterated iteration, WTPrincipalReference creator) Assigns a creator on the given iterated object to the given principal.static final IterationIdentifierfirstIterationId(Iterated iteration) For the given Iterated object, return the First IterationIdentifier for the series
Supported API: truestatic longgetBranchIdentifier(Iterated iteration) Gets the value of the iteration's branch id typed as it is returned from the POM's OID pool.static LocalizableMessagegetIterationDisplayIdentifier(String versionId, String oneOffVersionId, String iterationId) UsingIdentityFactorymethods gets the displayable identifier of a version or iteration of an object given the String values of the object's various identifiers.static LocalizableMessagegetIterationDisplayIdentifier(Versioned version) Get the displayable identifier of the object's iteration.static IterationIdentifiergetIterationIdentifier(Iterated iteration) Gets the series value of the iteration.static WTPrincipalReferencegetIterationModifier(Iterated iteration) Gets the creator/updater (reference) of the iteration.static IteratedgetLatestIteration(Iterated iteration, boolean includeMarkedForDelete) Gets the "latest" iteration in the same branch as the given one.static StringGets the note explaining why the iteration was created.static OneOffVersionIdentifierGets the series value of the version.static SearchConditiongetPrivateWorkingCopySearchCondition(Class target, boolean includePrivateWorkingCopies) Gets a SearchCondition to be appended to a query to find object(s) of the target class that are either private working copies or or not private working copies.static SearchConditiongetSearchCondition(Class target, boolean latest) Gets a SearchCondition to be appended to a query to find object(s) of the target class that are the "latest" iteration(s).static SearchConditiongetSearchCondition(Class target, long branchId) Gets a SearchCondition to be appended to a query to find object(s) of the target class that are in a branch.static SearchConditiongetSearchCondition(Class target, WTCollection objects, boolean notIntheBranch) Gets a SearchCondition to be appended to a query to find object(s) of the target class that are in a branch.static SearchConditiongetSearchCondition(Class target, Mastered master) Gets a SearchCondition to be appended to a query to find object(s) of the target class that belong to the same master.static WTPrincipalReferencegetVersionCreator(Iterated iteration) Gets the creator (reference) of the version.static LocalizableMessagegetVersionDisplayIdentifier(Versioned version) Get the displayable identifier of the object's version.static VersionIdentifiergetVersionIdentifier(Versioned version) Gets the series value of the version.static booleanhasPredecessor(Iterated iteration) Tests if the given iteration has a predecessor.static final voidincrementIterationId(Iterated iteration) For the given Iteration, Increment the IterationIdentifier of the Iteration.static final voidincrementVersionId(Versioned version) For the given Iteration, Increment the VersionIdentifier of the Iteration.static booleanisAOneOff(OneOffVersioned version) Returns true if the given version is a one-off version.static booleanisLatestIteration(Iterated iteration) Tests if the given iteration is the latest, or last one in the version branch.static booleanisReviseAllowed(Versioned version, boolean viewBranch) Deprecated.static final VersionIdentifiernewBranchVersionId(Versioned version) Returns a new Version Identifier on the next control branch.static MasterednewMasterFor(Iterated iteration) Constructs a new Mastered object for the given Iterated object using introspection to determine the appropriate master class for the iteration and reflection to invoke that master class's no-arg factory method.static final IterationIdentifiernextIterationId(Iterated iteration) For the given Iteration, answer the next IterationIdentifier in the series
Supported API: truestatic final VersionIdentifiernextVersionId(Versioned version) For the given Iteration, answer the next VersionIdentifier in the series
Supported API: truestatic voidsetIterationIdentifier(Iterated iteration, IterationIdentifier identifier) Sets the series value of the iteration.static voidsetIterationModifier(Iterated iteration, WTPrincipalReference modifier) Sets the modifier/updater on the given iterated object to the given principal.static voidSets the note explaining why the iteration was created.static voidsetVersionIdentifier(Versioned version, VersionIdentifier identifier) Sets the series value of the version.
-
Field Details
-
service
Supported API: true
-
-
Method Details
-
getLatestIteration
public static Iterated getLatestIteration(Iterated iteration, boolean includeMarkedForDelete) throws WTException, VersionControlException Gets the "latest" iteration in the same branch as the given one. A check to see if the given iteration is the latest one is not made since it could be stale. Passing true for includeMarkedForDelete will attempt getting the latest iteratation even if marked for delete.
Supported API: true- Parameters:
iteration-includeMarkedForDelete-- Returns:
- Iterated
- Throws:
WTExceptionVersionControlException
-
setVersionIdentifier
public static void setVersionIdentifier(Versioned version, VersionIdentifier identifier) throws WTException, VersionControlException, WTPropertyVetoException, SeriesIncrementInvalidException Sets the series value of the version.
Supported API: true- Parameters:
version-identifier-- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoExceptionSeriesIncrementInvalidException
-
getVersionIdentifier
public static VersionIdentifier getVersionIdentifier(Versioned version) throws VersionControlException Gets the series value of the version.
Supported API: true- Parameters:
version-- Returns:
- VersionIdentifier
- Throws:
VersionControlException
-
incrementVersionId
public static final void incrementVersionId(Versioned version) throws WTException, VersionControlException, WTPropertyVetoException, SeriesIncrementInvalidException For the given Iteration, Increment the VersionIdentifier of the Iteration. This will set the VersionIdentifier with the new value.
Supported API: true- Parameters:
version-- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoExceptionSeriesIncrementInvalidException- See Also:
-
nextVersion
-
nextVersionId
public static final VersionIdentifier nextVersionId(Versioned version) throws WTException, VersionControlException, WTPropertyVetoException, SeriesIncrementInvalidException For the given Iteration, answer the next VersionIdentifier in the series
Supported API: true- Parameters:
version-- Returns:
- VersionIdentifier
- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoExceptionSeriesIncrementInvalidException
-
newBranchVersionId
public static final VersionIdentifier newBranchVersionId(Versioned version) throws WTException, VersionControlException, WTPropertyVetoException Returns a new Version Identifier on the next control branch.
Supported API: true- Parameters:
version-- Returns:
- VersionIdentifier
- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoException
-
setIterationIdentifier
public static void setIterationIdentifier(Iterated iteration, IterationIdentifier identifier) throws WTException, VersionControlException, WTPropertyVetoException, SeriesIncrementInvalidException Sets the series value of the iteration.
Supported API: true- Parameters:
iteration-identifier-- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoExceptionSeriesIncrementInvalidException
-
firstIterationId
public static final IterationIdentifier firstIterationId(Iterated iteration) throws WTException, VersionControlException, WTPropertyVetoException For the given Iterated object, return the First IterationIdentifier for the series
Supported API: true- Parameters:
iteration-- Returns:
- IterationIdentifier
- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoException
-
getIterationIdentifier
public static IterationIdentifier getIterationIdentifier(Iterated iteration) throws VersionControlException Gets the series value of the iteration.
Supported API: true- Parameters:
iteration-- Returns:
- IterationIdentifier
- Throws:
VersionControlException
-
incrementIterationId
public static final void incrementIterationId(Iterated iteration) throws WTException, VersionControlException, WTPropertyVetoException, SeriesIncrementInvalidException For the given Iteration, Increment the IterationIdentifier of the Iteration. This will set the IterationIdentifier with the new value.
Supported API: true- Parameters:
iteration-- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoExceptionSeriesIncrementInvalidException- See Also:
-
nextIteration
-
nextIterationId
public static final IterationIdentifier nextIterationId(Iterated iteration) throws WTException, VersionControlException, WTPropertyVetoException, SeriesIncrementInvalidException For the given Iteration, answer the next IterationIdentifier in the series
Supported API: true- Parameters:
iteration-- Returns:
- IterationIdentifier
- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoExceptionSeriesIncrementInvalidException
-
getBranchIdentifier
Gets the value of the iteration's branch id typed as it is returned from the POM's OID pool.
Supported API: true- Parameters:
iteration-- Returns:
- long
- Throws:
VersionControlException
-
setIterationModifier
public static void setIterationModifier(Iterated iteration, WTPrincipalReference modifier) throws WTException, VersionControlException, WTPropertyVetoException Sets the modifier/updater on the given iterated object to the given principal. If the iteration is null an exception will occur.
Supported API: true- Parameters:
iteration-modifier-- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoException
-
getIterationModifier
public static WTPrincipalReference getIterationModifier(Iterated iteration) throws VersionControlException, WTException Gets the creator/updater (reference) of the iteration.
Supported API: true- Parameters:
iteration-- Returns:
- WTPrincipalReference
- Throws:
VersionControlExceptionWTException
-
getVersionCreator
public static WTPrincipalReference getVersionCreator(Iterated iteration) throws VersionControlException, WTException Gets the creator (reference) of the version. This is the creator/updater of the very first iteration in the branch. This will query the database if the given iteration is not the first one in a branch.
Supported API: true- Parameters:
iteration-- Returns:
- WTPrincipalReference
- Throws:
VersionControlExceptionWTException
-
setNote
public static void setNote(Iterated iteration, String note) throws WTException, VersionControlException, WTPropertyVetoException Sets the note explaining why the iteration was created.
Supported API: true- Parameters:
iteration-note-- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoException
-
getNote
Gets the note explaining why the iteration was created.
Supported API: true- Parameters:
iteration-- Returns:
- String
- Throws:
VersionControlException
-
getSearchCondition
public static SearchCondition getSearchCondition(Class target, Mastered master) throws VersionControlException, QueryException Gets a SearchCondition to be appended to a query to find object(s) of the target class that belong to the same master.
Supported API: true- Parameters:
target-master-- Returns:
- SearchCondition
- Throws:
VersionControlExceptionQueryException
-
getSearchCondition
public static SearchCondition getSearchCondition(Class target, long branchId) throws VersionControlException, QueryException Gets a SearchCondition to be appended to a query to find object(s) of the target class that are in a branch. Since the branch identifier is guaranteed to be unique within the system this criteria effectively will find all objects in the branch.
Supported API: true- Parameters:
target-branchId-- Returns:
- SearchCondition
- Throws:
VersionControlExceptionQueryException
-
getSearchCondition
public static SearchCondition getSearchCondition(Class target, boolean latest) throws VersionControlException, QueryException Gets a SearchCondition to be appended to a query to find object(s) of the target class that are the "latest" iteration(s).For example, if the given boolean is false then all objects, except the latest iteration(s) will be returned. Otherwise, only the latest iteration(s) are returned.
Supported API: true- Parameters:
target-latest-- Returns:
- SearchCondition
- Throws:
VersionControlExceptionQueryException
-
getPrivateWorkingCopySearchCondition
public static SearchCondition getPrivateWorkingCopySearchCondition(Class target, boolean includePrivateWorkingCopies) throws VersionControlException, QueryException Gets a SearchCondition to be appended to a query to find object(s) of the target class that are either private working copies or or not private working copies. For example, if the given boolean is true then the SearchCondition will find only private working copies. If the boolean os false then the SearchCondition will eliminate all private workign copies.
Supported API: true- Parameters:
target- The class to use for the SearchConditionincludePrivateWorkingCopies- Indicates weather SearchCondition includes only private working copies or filters them.- Returns:
- The SearchCondition
- Throws:
VersionControlExceptionQueryException
-
hasPredecessor
Tests if the given iteration has a predecessor.
Supported API: true- Parameters:
iteration-- Returns:
- boolean
-
isLatestIteration
Tests if the given iteration is the latest, or last one in the version branch.
Supported API: true- Parameters:
iteration-- Returns:
- boolean
-
isAOneOff
Returns true if the given version is a one-off version.
Supported API: true- Parameters:
version-- Returns:
- boolean
-
getOneOffVersionIdentifier
public static OneOffVersionIdentifier getOneOffVersionIdentifier(OneOffVersioned version) throws VersionControlException Gets the series value of the version.
Supported API: true- Parameters:
version-- Returns:
- OneOffVersionIdentifier
- Throws:
VersionControlException
-
newMasterFor
Constructs a new Mastered object for the given Iterated object using introspection to determine the appropriate master class for the iteration and reflection to invoke that master class's no-arg factory method.
Supported API: true- Parameters:
iteration-- Returns:
- Mastered
- Throws:
WTException
-
getSearchCondition
public static SearchCondition getSearchCondition(Class target, WTCollection objects, boolean notIntheBranch) throws VersionControlException, QueryException, WTException Gets a SearchCondition to be appended to a query to find object(s) of the target class that are in a branch. Since the branch identifier is guaranteed to be unique within the system this criteria effectively will find all objects in the branch.
Supported API: true- Parameters:
target- Target Classobjects- Collection of Iterated objects for which the branch identifiers are used in the search condition.notIntheBranch- Flag to represent NOT IN condition in the search condition.- Returns:
- SearchCondition
- Throws:
VersionControlExceptionQueryExceptionWTException
-
isReviseAllowed
Deprecated.This method is a preliminary check for if a wt.vc.Versioned object can be revised. returns false or throws exception if the version is a OneOff or ViewManageable
Supported API: true- Returns:
- boolean that indicates if the object is available to be revised
- Throws:
WTException
-
assignIterationCreator
public static Iterated assignIterationCreator(Iterated iteration, WTPrincipalReference creator) throws WTException, VersionControlException, WTPropertyVetoException Assigns a creator on the given iterated object to the given principal. If the principal is null the current session principal is used. This method is only intended to be used when loading information into the iterated object before it is persisted. Otherwise, if it is already persistent an exception will occur.
Supported API: true- Parameters:
iteration-creator-- Returns:
- Iterated
- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoException
-
assignIterationBranch
public static Iterated assignIterationBranch(Iterated iteration, long branchId, boolean latest) throws WTException, VersionControlException, WTPropertyVetoException Assigns a branch id and latest flag on the given iterated object to the given branch id and latest flag. This method is only intended to be used when loading information into the iterated object before it is persisted. Otherwise, if it is already persistent an exception will occur.
Supported API: true- Parameters:
iteration-branchId-latest-- Returns:
- Iterated
- Throws:
WTExceptionVersionControlExceptionWTPropertyVetoException
-
getVersionDisplayIdentifier
public static LocalizableMessage getVersionDisplayIdentifier(Versioned version) throws VersionControlException Get the displayable identifier of the object's version. The identifier for the version might be for example A or B for a Revision.
Supported API: true- Parameters:
version-- Returns:
- LocalizableMessage
- Throws:
VersionControlException
-
getIterationDisplayIdentifier
public static LocalizableMessage getIterationDisplayIdentifier(Versioned version) throws VersionControlException Get the displayable identifier of the object's iteration. The identifier for the iteration might be for example A.1 or A.2 after an Iteration.
Supported API: true- Parameters:
version-- Returns:
- LocalizableMessage
- Throws:
VersionControlException
-
getIterationDisplayIdentifier
public static LocalizableMessage getIterationDisplayIdentifier(String versionId, String oneOffVersionId, String iterationId) UsingIdentityFactorymethods gets the displayable identifier of a version or iteration of an object given the String values of the object's various identifiers.
Supported API: true- Parameters:
versionId- - String value of a Versioned object's VersionIdentifieroneOffVersionId- - String value of a OneOffVersioned object's OneOffVersionIdentifieriterationId- - String value of a Versioned object's IterationIdentifier- Returns:
- LocalizableMessage
-