wt.vc
Class StandardVersionControlService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.vc.StandardVersionControlService
All Implemented Interfaces:
Manager, NetFactor, Serializable, VersionControlService
Direct Known Subclasses:
StandardVersionControlSvrService

public class StandardVersionControlService
extends StandardManager
implements VersionControlService, Serializable

Provides the standard implementation of server-side functionality as defined by the VersionControlService interface. This class is the one intended to be extended to enhance functionality.

As defined by the standard versioning service's access control rules, there are no constraints placed on the access of iterated/versioned objects. Furthermore, there are no constraints placed on the access of either mastered objects. Warning: direct manipulation or deletion of masters is currently unsupported. All functions should be carried out on iterated/versioned objects.

Event-based processing is performed on business objects asserted as being Iterated/Versioned during database storing, deletions, and full restorations. After a successful store, the versioning service listens to a dispatched event indicating that the store has completed and signals all other interested services that a new iteration exists. When a business object is being deleted from the database, the versioning service listens to a dispatched event indicating that the deletion is about to commence and vetos the deletion if the version is not the latest one (i.e., has no successor). Otherwise, it passes on vetoing the deletion. After a successful deletion, the versioning service listens to a dispatched event indicating that the delete has completed and deletes all of the version's iterations. If it turns out that the deleted version is the only one remaining related to a master then it gets deleted as well. When a business object is being fully restored from the database, the versioning service listens to a dispatched event indicating that the full restoration is beginning and restores the version cookie's predecessor reference, and restores the iteration cookie's creator, prececessor, and master references.

If the standard implementation is not desired then a custom implementation can extend from VersionControlService alongside the standard implementation, and be specified as a property to be used as the default versioning service.

Use the newStandardVersionControlService static factory method(s), not the StandardVersionControlService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
StandardManager, VersionControlServiceEvent, wt.fc.PersistenceManagerEvent.POST_STORE, wt.fc.PersistenceManagerEvent.PRE_DELETE, wt.fc.PersistenceManagerEvent.POST_DELETE, wt.fc.PersistenceManagerEvent.FULL_RESTORE, Serialized Form

Nested Class Summary
private static class StandardVersionControlService.AllElementsQuery
          Helper class used by AllElementsOf to generate QuerySpecs to find all iterations or versions of a master.
private static class StandardVersionControlService.AllIterationsQuery
           
private static class StandardVersionControlService.AllVersionsQuery
           
private static class StandardVersionControlService.HistoricalIterationsTracker
          Utility class used by event listeners to help decide when updates to historical iterations are necessary
private  class StandardVersionControlService.PreDeleteListener
           
 
Field Summary
private static String BRANCH_ID
           
private static String CABINET_ID
           
private static String CLASSNAME
           
private static Object DELETE_ITERATIONS_KEY
           
private static String DOMAIN_ID
           
private static Object HISTORICAL_ITERATIONS_KEY
          Used to look up the a HistoricalIterationsTracker that helps decide when updates to historical iterations are necessary
private static String LATEST
           
private static RefreshSpec LOCK_NO_ACCESS
           
static String MULTI_DELETE_MODE
           
private static String OWNER_ID
           
private static String RESOURCE
           
private static String RULE_CONSTANT_FOR_VERSIONING
           
private static Object SB_CHECKIN_IGNORE_KEY
           
private static StatementParameterFactory statementFactory
           
static Object SVCS_CONTROLBRANCH_CREATE_IGNORE_KEY
           
static Object SVCS_DELETE_KEY
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardVersionControlService()
           
 
Method Summary
protected  void addDirective(WTCollection iters)
          Add directive to PRE_DELETE listener
private  QueryResult allElementsOf(Mastered master, Class type)
          Factors the implementation of allVersionsOf and allIterationsOf into a common method.
 QueryResult allIterationsFrom(Iterated iteration)
          Finds all of the iterations to the very first one created from the given one.
 QueryResult allIterationsOf(Mastered master)
          Finds all of the iterations to the very first one created associated with the given master.
 QueryResult allVersionsFrom(Versioned version)
          Finds all of the versions to the very first one created from the given version.
 QueryResult allVersionsOf(Mastered master)
          Finds all of the versions to the very first one created associated with the given master.
 QueryResult allVersionsOf(Versioned version)
          Finds all of the versions to the very first one created associated [via its master] with the given version.
 QueryResult allVersionsOf(WTCollection masters, Class versionClass)
          Finds all of the versions to the very first one created associated with the given collection of masters.
 Iterated appendIteration(Iterated target)
          This client accessable API expects that the IterationInfo and VersionInfo cookie data has been constructed correctly.
protected  void assignOneOffSeries(OneOffVersioned version)
           
private  void copyAdminAttrs(WTValuedMap sourceToDestinationsMap, WTValuedMap newIterationToDestinationsMap, String note)
          Copies various admin-ish attributes from targetVersion to newIter.
 Iterated copyBranchInfo(Iterated source, Iterated target)
          

Supported API: false
private  void createMerge(Versioned target, Ufid other, boolean inwards)
           
 void deleteIterations(Iterated beginIteration, Iterated endIteration)
          Deletes all iterations between beginIteration and endIteration of same version.
 void deleteIterations(WTCollection iterations, ConflictResolution[] resolvers)
          This is for deletion of selective iterations.
private  void dispatchMultiObjectMergeEvent(WTValuedMap sourceToDestinationsMap, WTValuedMap sourceToNewIterationsMap, WTValuedMap newIterationToDestinationsMap, WTValuedMap destinationToNewIterationMap, boolean isPreEvent)
           
private  void dispatchSingleObjectMergeEvent(Versioned newIter, Versioned srcVersion, Versioned destVersion, boolean isPreEvent)
           
protected  void dispatchVetoableEvent(String eventType, Iterated object)
          Dispatches a VersionControlServiceEvent that includes the event type and target (i.e., either an Iterated or Versioned object).
protected  void dispatchVetoableEvent(String eventType, Iterated supersededIteration, Iterated supersedingIteration)
          Dispatches a VersionControlServiceEvent that includes the event types (superseded and superseding iterations).
protected  void dispatchVetoableEvent(String eventType, Vector targets)
          Dispatches a VersionControlServiceEvent that includes the event types (vector of iterations).
protected  void dispatchVetoableEvent(String eventType, WTCollection targets)
          Dispatches a VersionControlServiceEvent that includes the event types (WTCollection of iterations).
protected  void dispatchVetoableMultiObjectEvent(String eventType, WTCollection targets)
          Dispatches a VersionControlServiceEvent that includes the event types (WTCollection of iterations).
protected  void dispatchVetoableMultiObjectEvent(String eventType, WTValuedMap target)
          Dispatches a VersionControlServiceEvent that includes the event types & WTValuedMap.
private static Object duplicate(Serializable object)
          Duplicate any serializable object via serialization/deserialization (much like WTObject.duplicate)
private  boolean existsInTXMapForDelete(ObjectReference objectRef)
           
private  void fillTargetDetails(Hashtable insNodeTable)
           
private  Versioned getAPossiblePredecessor(Hashtable insNodeTable)
           
private  Iterated getBestMatchPredecessor(Iterated target, Hashtable insNodeTable)
           
private  QueryResult getBranchedControlBranches(WTCollection iterations)
           
private  long[] getBranchIds(WTCollection objs)
           
private  Iterated getBranchPointOf(Iterated target)
           
 String getConceptualClassname()
          Deprecated.  
private  QueryResult getControlBranchesOf(Versioned target)
           
private  Iterated getFirstIterationOf(long branchId)
           
private static Folder getFolder(FolderEntry folderEntry, boolean bypassAccessControl)
           
 Ufid[] getInwardsMergesOf(Iterated target)
          Gets the Ufids of all nodes which form the "from node" of merges terminating on the target node.
 Iterated getLatestIteration(Iterated iteration, boolean includeMarkedForDelete)
          Get the "latest" iteration in the same branch as the given one.
 WTValuedMap getLatestIterations(WTCollection iterations, boolean includeMarkedForDelete)
          Get the "latest" iteration in the same branch as the ones passed in the collection.
private  long[] getMasterIds(WTCollection objs, boolean isMaster)
           
private  Ufid[] getMergeUfidsOf(Iterated target, boolean inwards)
           
private  Versioned getObjectBySeriesAndView(QueryResult vtSet, Series tSer, View tView, Series r1Ser)
           
private  long[] getObjectIds(WTCollection objs)
           
 Ufid[] getOutwardMergesOf(Iterated target)
          Gets the Ufids of all nodes which form the "to node" of merges originating on the target node.
private  View[] getParentViews(Hashtable insNodeTable)
           
 Ufid getPredBranchPointUfid(Iterated target)
          Gets the Ufid of the node from which target node's version branched.
private  Versioned getPredInLowerVersions(QueryResult vtSet, Series tSer, View aView, Series t1OffSer)
           
 Ufid getUfidOf(Iterated target)
          Gets the Ufid of the node.
private  QueryResult hasMasterWithNoIterations(WTCollection iterations, Class targetClass, Class masterClass)
          Delete control branch for all those iterations in the collection that no longer have any other iterations left..
 Iterated insertIteration(Iterated target)
          This client accessable API expects that the IterationInfo and VersionInfo cookie data has been constructed correctly.
private  Iterated insertIteration(Iterated predecessor, Iterated target, Iterated successor)
           
private  Iterated insertNode(Iterated target, Hashtable insNodeTable)
          Performs the insertion -- if master not persisted, persist the object and its CB -- else if the version of target exists, do an insertIteration -- else do an insertVersion
 Iterated insertNode(Iterated target, Ufid targetUfid, Ufid predBranchPointUfid)
          Inserts the target node into the version tree of the object.
 Iterated insertNode(Iterated target, Ufid targetUfid, Ufid predBranchPointUfid, Ufid[] inwardMergeUfids, Ufid[] outwardMergeUfids)
          Inserts the target node into the version tree of the object.
private  void insertNodeCreateMerges(Iterated target, Hashtable insNodeTable)
           
private  void insertNodeGetSuccessors(Hashtable insNodeTable)
           
private  Iterated insertNodeIteration(Iterated target)
           
private  void insertNodeUpdateSuccessors(Iterated target, Hashtable insNodeTable)
           
private  void insertNodeVerifyTarget(Iterated target, Ufid targetUfid)
           
private  Iterated insertNodeVersion(Iterated target, Hashtable insNodeTable)
           
private  boolean isAChildView(View aView, View[] parentViews)
           
 boolean isFirstIteration(Iterated iteration)
          Tests if the given iteration is the first one in the version branch.
private  boolean isPredecessor(Versioned low, Versioned high)
           
protected  Vector iterationsBetween(Iterated first, boolean include_first, Iterated last, boolean include_last)
          Find all succeeding iterations between two iterations.
 QueryResult iterationsOf(Iterated iteration)
          Finds only the iterations directly associated with the given one.
 QueryResult iterationsOf(long branch)
          Deprecated. Please use the iterationsOf(branch:long, iteratedClass:Class) api for better performing searches
 QueryResult iterationsOf(long branch, Class iteratedClass)
          Finds only the iterations directly associated with the given branch id.
 QueryResult iterationsOf(WTCollection iterations, Class iteratedClass, boolean includeLatest)
          Finds only the iterations directly associated with the given colletion of iterated objects.
private  boolean lowerOrEqualView(View lView, View hView)
           
private  boolean lowerVersion(MultilevelSeries testSer, MultilevelSeries refSer)
           
private  void makeChainAndAdjust(WTArrayList iterations, WTHashSet deleteList, HashMap postRollupMap, HashMap postRollbackMap)
           
 Versioned merge(Versioned srcVersion, Versioned destVersion, String note)
          Creates a new iteration of srcVersion and re-parents it as the latest iteration of destVersion.
 WTValuedMap merge(WTValuedMap sourceToDestinationsMap, String note)
          Multi-object form of merge operation.
 AdHocStringVersioned newAdHocStringVersion(AdHocStringVersioned version, String adHocVersionId)
          Creates a new in-line version with the given adHocVersionId assigned.
 Versioned newBranch(Versioned version)
          Makes a new branched version from the given one using it as a branch point, which may or may not be the "latest" iteration.
 Iterated newIteration(Iterated iteration)
          Deprecated.  
 Iterated newIteration(Iterated iteration, boolean copyAttributes)
          Makes a new iteration/version as a copy from the given one, and does not increment its identifiier.
 WTValuedMap newIterations(WTCollection iterations)
          Deprecated.  
 WTValuedMap newIterations(WTCollection iterations, boolean copyAttributes)
          Deprecated.  
 OneOffVersioned newOneOffVersion(OneOffVersioned version)
          Creates a new in-line version from the given version.
static StandardVersionControlService newStandardVersionControlService()
          Default factory for the class.
 Versioned newUncontrolledVersion(Versioned version)
          Makes a new version from the given version.
 Versioned newVersion(Versioned version)
          Makes a new in-lined version from the given version.
 Versioned newVersion(Versioned version, VersionIdentifier version_id, IterationIdentifier iteration_id)
          Makes a new in-lined version from the given version.
 Versionable newVersionable(Versionable version)
          API intended to be called internally by any API that intends to create a new version.
 WTList newVersionables(WTList versions)
          API intended to be called internally by any API that intends to create a new version.
 WTValuedMap newVersions(WTCollection versions)
          Makes a new in-lined version from the given version.
 WTValuedMap newVersions(WTKeyedMap versionMap)
          Makes a new in-lined version from the given version.
private  QueryResult numOfIterations(Set branchIDs)
           
protected  QueryResult orderedIterationsOf(QueryResult iterations)
           
protected  void performStartupProcess()
          Overrides the startup process specific to the versioning service to provide custom startup for event subscription.
private  void postChangeDomain(WTCollection iterateds)
          Update the domain of historical iterations
private  void postChangeFolder(WTKeyedMap destinations_to_targets, WTValuedMap targets_to_sources)
          Update the domain and cabinet of historical iterations
private  void preChangeDomain(WTList domain_administereds, WTList target_domains)
          Veto the domain change of any non-latest iteration
private  void preChangeFolder(WTValuedMap targets_to_destinations, WTValuedMap targets_to_sources)
          Cache the objects that are in change folder, so that we know not to deal with them in the POST_CHANGE_DOMAIN listener
private  void preCheckin(WTValuedMap checkedout_to_working)
          Cache the iterations that we're checking in.
 Iterated predecessorOf(Iterated iteration)
          Finds the predecessor of the iteration.
private  WTHashSet prepareIterationChainForDelete(WTArrayList iterations, WTHashSet analyzed, HashMap postRollupMap, HashMap postRollbackMap)
           
private  void processPostMultiDelete(Object[] objectsToDelete)
           
private  void putInTXMapForDelete(WTCollection coll)
           
 Iterated refresh(VersionForeignKey key)
          Retrieves a Iterated object given its VersionForeignKey.
(package private)  boolean refsEqual(ObjectReference ref1, ObjectReference ref2)
           
 void registerEvents(ManagerService manager)
          Overrides the registration of all applicable versioning service events with the service manager.
protected  void remove(Iterated iteration)
          Removes (i.e., deletes) the given iteration.
protected  void remove(Mastered master)
          Removes (i.e., deletes) all of the given master's iterations.
private  int removeControlBranches(WTCollection iterations, Class targetClass)
          Delete control branch for all those iterations in the collection that no longer have any other iterations left..
protected  void removeIterations(WTCollection iterations)
          Removes (i.e., deletes) the given colection of iterations.
protected  void removeMasters(WTCollection masters)
          Removes (i.e., deletes) all of the given collection of master's iterations.
protected  void restore(WTCollection iterations)
          Restores the collection of iteration's creator, predecessor, and master reference.
 Iterated rollback(Iterated iteration, Iterated reversion)
          Deletes all iterations starting at the latest iteration in a version back to, but not including, a specified iteration in the same version.
 Iterated rollup(Iterated iteration, Iterated culmination)
          Deletes all iterations starting at the first iteration in a version up to, but not including, a specified iteration in the same version.
 void setSuccessorVersionable(Iterated target, QueryResult successors)
          The predecessor links are managed during new object creation and via the successor method.
 void setSuccessorVersionable(Iterated target, Versionable successor)
          The predecessor links are managed during new object creation and via the successor method.
protected  void signalPersistenceOf(Iterated iteration)
          Signals to any interested service by dispatching an event that a new version has just been stored.
protected  void signalPersistenceOf(WTCollection iterations)
          

Supported API: false
protected  void storeControlBranchOf(WTCollection iterations)
          Stores the given iteration's ControlBranch if it is not already persistent.
protected  void storeMasterOf(WTCollection iterations)
          Stores the given iteration's master if it is not already persistent.
protected  QueryResult successorsOf(Iterated iteration)
          Find all successors of a given iteration
protected  QueryResult successorsOf(WTCollection iterations, Class targetClass)
          Find all the successors of a set of iterations, where a successor can't be one of the given iterations
private  QueryResult successorsOf(WTCollection iterations, WTHashSet excludeList)
          Find all the successors of a set of iterations, where a successor can't be one of the given iterations and also it can't be from the excludeList.
 Iterated supersede(Iterated iteration, Iterated replacement)
          Supersedes the first iteration with the other iteration.
 WTValuedMap supersede(WTValuedMap iterationReplacementMap)
          Supersedes each iteration passed as the key in the WTValuedMap with the corresponding iteration value in the WTValuedMap.
private  void throwPostRollupRollbackEvents(HashMap preRollupMap, HashMap preRollbackMap, HashMap postRollupMap, HashMap postRollbackMap)
           
private  void throwPreRollupRollbackEvents(WTArrayList[][] version_list, HashMap preRollupMap, HashMap preRollbackMap)
           
(package private)  int updateHistoricalIterations(WTCollection iterations, ObjectReference destination_domain_ref, ObjectReference destination_cabinet_ref, ObjectReference destination_owner_ref)
          Assign the previous iterations of the given collection of latest iterations to the given domain and cabinet
private  void validateBranchConstraint(WTCollection outputIterations, boolean sameBranch)
           
protected  void validateDeletionOf(WTCollection iterations)
          Validates whether or not the deletion of the given collection of iterations is appropriate.
protected  void validateReferencesOf(ObjectToVersionLink link)
          Validates [if necessary] the object and version references to correctly refer to the role A and B objects, respectively.
protected  void validateReferencesOf(VersionToVersionLink link)
          Validates [if necessary] the version references to correctly refer to the role A and B objects.
private  void validateVersionSchemeDuringMove(WTCollection versions, WTValuedMap containedToDestinations, WTValuedMap containedToSources)
           
private  Vector wtArrayListToVector(WTArrayList iterations, int from_index, int end_index)
           
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

statementFactory

private static StatementParameterFactory statementFactory

MULTI_DELETE_MODE

public static final String MULTI_DELETE_MODE
See Also:
Constant Field Values

RULE_CONSTANT_FOR_VERSIONING

private static final String RULE_CONSTANT_FOR_VERSIONING
See Also:
Constant Field Values

HISTORICAL_ITERATIONS_KEY

private static final Object HISTORICAL_ITERATIONS_KEY
Used to look up the a HistoricalIterationsTracker that helps decide when updates to historical iterations are necessary


DELETE_ITERATIONS_KEY

private static final Object DELETE_ITERATIONS_KEY

SB_CHECKIN_IGNORE_KEY

private static final Object SB_CHECKIN_IGNORE_KEY

SVCS_DELETE_KEY

public static final Object SVCS_DELETE_KEY

SVCS_CONTROLBRANCH_CREATE_IGNORE_KEY

public static final Object SVCS_CONTROLBRANCH_CREATE_IGNORE_KEY

CABINET_ID

private static final String CABINET_ID
See Also:
Constant Field Values

DOMAIN_ID

private static final String DOMAIN_ID
See Also:
Constant Field Values

BRANCH_ID

private static final String BRANCH_ID
See Also:
Constant Field Values

LATEST

private static final String LATEST
See Also:
Constant Field Values

OWNER_ID

private static final String OWNER_ID
See Also:
Constant Field Values

LOCK_NO_ACCESS

private static final RefreshSpec LOCK_NO_ACCESS
Constructor Detail

StandardVersionControlService

public StandardVersionControlService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

registerEvents

public void registerEvents(ManagerService manager)
Overrides the registration of all applicable versioning service events with the service manager.

Supported API: false

Specified by:
registerEvents in interface Manager
Overrides:
registerEvents in class StandardManager
Parameters:
manager -

dispatchVetoableEvent

protected void dispatchVetoableEvent(String eventType,
                                     Iterated object)
                              throws WTException,
                                     WTPropertyVetoException
Dispatches a VersionControlServiceEvent that includes the event type and target (i.e., either an Iterated or Versioned object).

Supported API: false

Parameters:
eventType - The name of the PersistentManagerEvent type.
object - The target of the persistable operation.
Throws:
WTException
WTPropertyVetoException

dispatchVetoableEvent

protected void dispatchVetoableEvent(String eventType,
                                     Iterated supersededIteration,
                                     Iterated supersedingIteration)
                              throws WTException,
                                     WTPropertyVetoException
Dispatches a VersionControlServiceEvent that includes the event types (superseded and superseding iterations).

Supported API: false

Parameters:
eventType - The name of the PersistentManagerEvent type.
supersededIteration - The target of the persistable operation.
supersedingIteration - The target of the persistable operation.
Throws:
WTException
WTPropertyVetoException

dispatchVetoableEvent

protected void dispatchVetoableEvent(String eventType,
                                     Vector targets)
                              throws WTException,
                                     WTPropertyVetoException
Dispatches a VersionControlServiceEvent that includes the event types (vector of iterations).

Supported API: false

Parameters:
eventType - The name of the PersistentManagerEvent type.
targets - The target of the persistable operation.
Throws:
WTException
WTPropertyVetoException

performStartupProcess

protected void performStartupProcess()
                              throws ManagerException
Overrides the startup process specific to the versioning service to provide custom startup for event subscription. During subscription an anonymous inner class adapter is created per subscription to handle each specific event of interest.

Supported API: false

Overrides:
performStartupProcess in class StandardManager
Throws:
ManagerException

remove

protected void remove(Mastered master)
               throws VersionControlException
Removes (i.e., deletes) all of the given master's iterations.

Supported API: false

Parameters:
master -
Throws:
VersionControlException

removeMasters

protected void removeMasters(WTCollection masters)
                      throws VersionControlException
Removes (i.e., deletes) all of the given collection of master's iterations.

Supported API: false

Parameters:
masters -
Throws:
VersionControlException

remove

protected void remove(Iterated iteration)
               throws VersionControlException
Removes (i.e., deletes) the given iteration. If it is the "latest" one in a branch then all of the branch's iterations are deleted.

Supported API: false

Parameters:
iteration -
Throws:
VersionControlException

removeIterations

protected void removeIterations(WTCollection iterations)
                         throws VersionControlException
Removes (i.e., deletes) the given colection of iterations. If it is the "latest" one in a branch then all of the branch's iterations are deleted.

Supported API: false

Parameters:
iterations -
Throws:
VersionControlException

restore

protected void restore(WTCollection iterations)
                throws VersionControlException
Restores the collection of iteration's creator, predecessor, and master reference.

Supported API: false

Parameters:
iterations -
Throws:
VersionControlException

signalPersistenceOf

protected void signalPersistenceOf(Iterated iteration)
                            throws VersionControlException
Signals to any interested service by dispatching an event that a new version has just been stored. That is to say that either the very first iteration created for a master being that it is the first branch, or a new branch from an existing iteration.

Supported API: false

Parameters:
iteration -
Throws:
VersionControlException

signalPersistenceOf

protected void signalPersistenceOf(WTCollection iterations)
                            throws VersionControlException


Supported API: false

Parameters:
iterations -
Throws:
VersionControlException

storeMasterOf

protected void storeMasterOf(WTCollection iterations)
                      throws VersionControlException
Stores the given iteration's master if it is not already persistent.

Supported API: false

Parameters:
iterations -
Throws:
VersionControlException

storeControlBranchOf

protected void storeControlBranchOf(WTCollection iterations)
                             throws VersionControlException
Stores the given iteration's ControlBranch if it is not already persistent.

Supported API: false

Parameters:
iterations -
Throws:
VersionControlException

validateDeletionOf

protected void validateDeletionOf(WTCollection iterations)
                           throws VersionControlException
Validates whether or not the deletion of the given collection of iterations is appropriate. If the iteration is not in a state indicating it is to be deleted (IterationState.UNCONTROLLED) then the deletion is vetoed. If one iteration in the collection fails the whole collection is vetoed.

Supported API: false

Parameters:
iterations -
Throws:
VersionControlException

validateReferencesOf

protected void validateReferencesOf(ObjectToVersionLink link)
                             throws VersionControlException
Validates [if necessary] the object and version references to correctly refer to the role A and B objects, respectively. Since either an object or version reference can be constructed with non-persistent objects their state may be invalid if the object does not have any applicable persistable or iterated state. Thus, to maintain server integrity this service must guarantee that references in its types of links are correct before allowing them to be stored. If the referenced object(s) are still not persistent then an exception is thrown.

Supported API: false

Parameters:
link -
Throws:
VersionControlException

validateReferencesOf

protected void validateReferencesOf(VersionToVersionLink link)
                             throws VersionControlException
Validates [if necessary] the version references to correctly refer to the role A and B objects. Since a version reference can be constructed with non-persistent objects their state may be invalid if the object does not have any applicable iterated state. Thus, to maintain server integrity this service must guarantee that references in its types of links are correct before allowing them to be stored. If the referenced object(s) are still not persistent then an exception is thrown.

Supported API: false

Parameters:
link -
Throws:
VersionControlException

dispatchVetoableEvent

protected void dispatchVetoableEvent(String eventType,
                                     WTCollection targets)
                              throws WTException,
                                     WTPropertyVetoException
Dispatches a VersionControlServiceEvent that includes the event types (WTCollection of iterations).

Supported API: false

Parameters:
eventType - The name of the PersistentManagerEvent type.
targets - The target of the persistable operation.
Throws:
WTException
WTPropertyVetoException

dispatchVetoableMultiObjectEvent

protected void dispatchVetoableMultiObjectEvent(String eventType,
                                                WTCollection targets)
                                         throws WTException,
                                                WTPropertyVetoException
Dispatches a VersionControlServiceEvent that includes the event types (WTCollection of iterations).

Supported API: false

Parameters:
eventType - The name of the PersistentManagerEvent type.
targets - The target of the persistable operation.
Throws:
WTException
WTPropertyVetoException

dispatchVetoableMultiObjectEvent

protected void dispatchVetoableMultiObjectEvent(String eventType,
                                                WTValuedMap target)
                                         throws WTException,
                                                WTPropertyVetoException
Dispatches a VersionControlServiceEvent that includes the event types & WTValuedMap.

Supported API: false

Parameters:
eventType - The name of the PersistentManagerEvent type.
target - The target of the persistable operation.
Throws:
WTException
WTPropertyVetoException

newStandardVersionControlService

public static StandardVersionControlService newStandardVersionControlService()
                                                                      throws WTException
Default factory for the class.

Supported API: false

Returns:
StandardVersionControlService
Throws:
WTException

newBranch

public Versioned newBranch(Versioned version)
                    throws WTException,
                           VersionControlException,
                           WTPropertyVetoException
Makes a new branched version from the given one using it as a branch point, which may or may not be the "latest" iteration. The newly branched version's identifier is moved to the next level to the right and reset.

Supported API: true

Specified by:
newBranch in interface VersionControlService
Parameters:
version -
Returns:
Versioned
Throws:
WTException
VersionControlException
WTPropertyVetoException

newVersion

public Versioned newVersion(Versioned version)
                     throws WTException,
                            VersionControlException,
                            WTPropertyVetoException
Makes a new in-lined version from the given version. The newly in-lined version's identifier is incremented.

Supported API: true

Specified by:
newVersion in interface VersionControlService
Parameters:
version -
Returns:
Versioned
Throws:
WTException
VersionControlException
WTPropertyVetoException

newVersion

public Versioned newVersion(Versioned version,
                            VersionIdentifier version_id,
                            IterationIdentifier iteration_id)
                     throws WTException,
                            VersionControlException,
                            WTPropertyVetoException
Makes a new in-lined version from the given version. The newly in-lined version's version and iteration identifiers are set to the values passed in to this method..

Supported API: true

Specified by:
newVersion in interface VersionControlService
Parameters:
version -
version_id -
iteration_id -
Returns:
Versioned
Throws:
WTException
VersionControlException
WTPropertyVetoException

newUncontrolledVersion

public Versioned newUncontrolledVersion(Versioned version)
                                 throws WTException,
                                        VersionControlException,
                                        WTPropertyVetoException
Makes a new version from the given version. The new version will not be placed into the version tree (i.e. the predecessor will not be set) nor will it's version and iteration identifiers be set. The expected use for this api is to build a version tree out of order via data loading, replication or other direct data creation means.

Supported API: true

Specified by:
newUncontrolledVersion in interface VersionControlService
Parameters:
version -
Returns:
Versioned
Throws:
WTException
VersionControlException
WTPropertyVetoException

newIteration

public Iterated newIteration(Iterated iteration)
                      throws WTException,
                             VersionControlException,
                             WTPropertyVetoException
Deprecated.  

Makes a new iteration/version as a copy from the given one, and does not increment its identifiier.

Supported API: false

Specified by:
newIteration in interface VersionControlService
Parameters:
iteration -
Returns:
Iterated
Throws:
WTException
VersionControlException
WTPropertyVetoException

newAdHocStringVersion

public AdHocStringVersioned newAdHocStringVersion(AdHocStringVersioned version,
                                                  String adHocVersionId)
                                           throws WTException,
                                                  VersionControlException,
                                                  WTPropertyVetoException
Creates a new in-line version with the given adHocVersionId assigned.

Supported API: true

Specified by:
newAdHocStringVersion in interface VersionControlService
Parameters:
version -
adHocVersionId -
Returns:
AdHocStringVersioned
Throws:
WTException
VersionControlException
WTPropertyVetoException

newOneOffVersion

public OneOffVersioned newOneOffVersion(OneOffVersioned version)
                                 throws WTException,
                                        VersionControlException,
                                        WTPropertyVetoException
Creates a new in-line version from the given version. When persisted, a one-off version identifier will be assigned to the object.

Supported API: true

Specified by:
newOneOffVersion in interface VersionControlService
Parameters:
version -
Returns:
OneOffVersioned
Throws:
WTException
VersionControlException
WTPropertyVetoException

newVersionable

public Versionable newVersionable(Versionable version)
                           throws WTException,
                                  VersionControlException,
                                  WTPropertyVetoException
API intended to be called internally by any API that intends to create a new version. It creates a new in-line version (with a new branch identifier), resets the iteration identifier, and assigns the version creator.

Supported API: true

Specified by:
newVersionable in interface VersionControlService
Parameters:
version -
Returns:
Versionable
Throws:
WTException
VersionControlException
WTPropertyVetoException

supersede

public Iterated supersede(Iterated iteration,
                          Iterated replacement)
                   throws WTException,
                          VersionControlException,
                          WTPropertyVetoException
Supersedes the first iteration with the other iteration. Also, the superseding iteration's identifier is incremented.

Supported API: true

Specified by:
supersede in interface VersionControlService
Parameters:
iteration -
replacement -
Returns:
Iterated
Throws:
WTException
VersionControlException
WTPropertyVetoException

rollback

public Iterated rollback(Iterated iteration,
                         Iterated reversion)
                  throws WTException,
                         VersionControlException,
                         WTPropertyVetoException
Deletes all iterations starting at the latest iteration in a version back to, but not including, a specified iteration in the same version. The iteration that is rolled back to (reversion) becomes the latest iteration. Returns the reversion if the operation is successful. If the two iterations involved in the rollback are identical null is returned.

Note: Since R3.0 rollback has changed its implementation from allowing a rollback between any two iterations, potentially from different versions, to the one described above.

It will throw conflict exception for branch point deletion if there exist iterations on successor branches.

Supported API: true

Specified by:
rollback in interface VersionControlService
Parameters:
iteration -
reversion -
Returns:
Iterated
Throws:
WTException
VersionControlException
WTPropertyVetoException

rollup

public Iterated rollup(Iterated iteration,
                       Iterated culmination)
                throws WTException,
                       VersionControlException,
                       WTPropertyVetoException
Deletes all iterations starting at the first iteration in a version up to, but not including, a specified iteration in the same version. The iteration that is rolled up to (culmination) becomes the first iteration. Returns the culmination if the operation is successful. If the two iterations involved in the rollup are identical null is returned.

Note: Since R3.0 rollup has changed its implementation from allowing a rollup between any two iterations, potentially from different versions, to the one described above.

It will throw conflict exception for branch point deletion if there exists iterations on successor branches.

Supported API: true

Specified by:
rollup in interface VersionControlService
Parameters:
iteration -
culmination -
Returns:
Iterated
Throws:
WTException
VersionControlException
WTPropertyVetoException

predecessorOf

public Iterated predecessorOf(Iterated iteration)
                       throws WTException,
                              VersionControlException,
                              PersistenceException
Finds the predecessor of the iteration.

Supported API: true

Specified by:
predecessorOf in interface VersionControlService
Parameters:
iteration -
Returns:
Iterated
Throws:
WTException
VersionControlException
PersistenceException

iterationsOf

public QueryResult iterationsOf(Iterated iteration)
                         throws WTException,
                                PersistenceException
Finds only the iterations directly associated with the given one. The result is an ordered list of iterations from the most recent one to the first one created for that version.

Supported API: true

Specified by:
iterationsOf in interface VersionControlService
Parameters:
iteration -
Returns:
QueryResult
Throws:
WTException
PersistenceException

iterationsOf

public QueryResult iterationsOf(long branch)
                         throws WTException,
                                PersistenceException
Deprecated. Please use the iterationsOf(branch:long, iteratedClass:Class) api for better performing searches

Finds only the iterations directly associated with the given branch id. The result is an ordered list of iterations from the most recent one to the first one created for that version.

The branch id can uniquely identify a branch in a system based on its property of being unique since it's generated from the OID pool.



Supported API: false

Specified by:
iterationsOf in interface VersionControlService
Parameters:
branch -
Returns:
QueryResult
Throws:
WTException
PersistenceException

allIterationsOf

public QueryResult allIterationsOf(Mastered master)
                            throws WTException,
                                   PersistenceException
Finds all of the iterations to the very first one created associated with the given master. The result is an ordered list of iterations from the most recent one to the first one created for that version.

Supported API: true

Specified by:
allIterationsOf in interface VersionControlService
Parameters:
master -
Returns:
QueryResult
Throws:
WTException
PersistenceException

allIterationsFrom

public QueryResult allIterationsFrom(Iterated iteration)
                              throws WTException,
                                     PersistenceException
Finds all of the iterations to the very first one created from the given one. The result is an ordered list of iterations from the given iteration to the first one created.

Supported API: true

Specified by:
allIterationsFrom in interface VersionControlService
Parameters:
iteration -
Returns:
QueryResult
Throws:
WTException
PersistenceException

allVersionsOf

public QueryResult allVersionsOf(Versioned version)
                          throws WTException,
                                 PersistenceException
Finds all of the versions to the very first one created associated [via its master] with the given version. The result is an ordered list of versions (i.e., latest iterations) from the most recent one to the first one created.

Supported API: true

Specified by:
allVersionsOf in interface VersionControlService
Parameters:
version -
Returns:
QueryResult
Throws:
WTException
PersistenceException

allVersionsOf

public QueryResult allVersionsOf(Mastered master)
                          throws WTException,
                                 PersistenceException
Finds all of the versions to the very first one created associated with the given master. The result is an ordered list of versions (i.e., latest iterations) from the most recent one to the first one created.

Supported API: true

Specified by:
allVersionsOf in interface VersionControlService
Parameters:
master -
Returns:
QueryResult
Throws:
WTException
PersistenceException

allVersionsOf

public QueryResult allVersionsOf(WTCollection masters,
                                 Class versionClass)
                          throws WTException,
                                 PersistenceException
Finds all of the versions to the very first one created associated with the given collection of masters. The result is not an ordered list of versions.

Supported API: true

Specified by:
allVersionsOf in interface VersionControlService
Parameters:
masters -
versionClass -
Returns:
QueryResult
Throws:
WTException
PersistenceException

allVersionsFrom

public QueryResult allVersionsFrom(Versioned version)
                            throws WTException,
                                   PersistenceException
Finds all of the versions to the very first one created from the given version. The result is an ordered list of versions (i.e., latest iterations) from the given iteration to the first one created.

Supported API: true

Specified by:
allVersionsFrom in interface VersionControlService
Parameters:
version -
Returns:
QueryResult
Throws:
WTException
PersistenceException

isFirstIteration

public boolean isFirstIteration(Iterated iteration)
                         throws WTException,
                                VersionControlException
Tests if the given iteration is the first one in the version branch.

Supported API: true

Specified by:
isFirstIteration in interface VersionControlService
Parameters:
iteration -
Returns:
boolean
Throws:
WTException
VersionControlException

iterationsOf

public QueryResult iterationsOf(long branch,
                                Class iteratedClass)
                         throws WTException,
                                PersistenceException
Finds only the iterations directly associated with the given branch id. The result is an ordered list of iterations from the most recent one to the first one created for that version.

The branch id can uniquely identify a branch in a system based on its property of being unique since it's generated from the OID pool.



Supported API: true

Specified by:
iterationsOf in interface VersionControlService
Parameters:
branch -
iteratedClass -
Returns:
QueryResult
Throws:
WTException
PersistenceException

iterationsOf

public QueryResult iterationsOf(WTCollection iterations,
                                Class iteratedClass,
                                boolean includeLatest)
                         throws WTException,
                                PersistenceException
Finds only the iterations directly associated with the given colletion of iterated objects. The result is not an ordered list.

If the flag includeLatest is false then the latest iteration is not included in the resulted list of iterations.

Supported API: true

Specified by:
iterationsOf in interface VersionControlService
Parameters:
iterations -
iteratedClass -
includeLatest -
Returns:
QueryResult
Throws:
WTException
PersistenceException

insertIteration

public Iterated insertIteration(Iterated target)
                         throws VersionControlException,
                                WTException
This client accessable API expects that the IterationInfo and VersionInfo cookie data has been constructed correctly. The method will use the IterationIdentifier to determin the proper place to insert the specified Iteration. If an Iteration already exists for the given IterationIdentifier the operation will fail with an exception. This method will also validate the correct configuration of the cookie data, and manage the predecessor links. The PRE and POST INSERT_ITERATION events will be dispatched around the store of the object. The persisted Iteration will be returned.

Supported API: false

Specified by:
insertIteration in interface VersionControlService
Parameters:
target -
Returns:
Iterated
Throws:
VersionControlException
WTException

appendIteration

public Iterated appendIteration(Iterated target)
                         throws VersionControlException,
                                WTException
This client accessable API expects that the IterationInfo and VersionInfo cookie data has been constructed correctly. The method will use the IteraionInfo to determin the proper place to append the specified Iteration. If an Iteration already exists for the given IterationIdentifier the operation will fail with an exception. This method will also validate the correct configuration of the cookie data, and manage the predecessor links and latest attribute. The PRE and POST INSERT_ITERATION events will be dispatched around the store of the object. The persisted Iteration will be returned.

Supported API: false

Specified by:
appendIteration in interface VersionControlService
Parameters:
target -
Returns:
Iterated
Throws:
VersionControlException
WTException

copyBranchInfo

public Iterated copyBranchInfo(Iterated source,
                               Iterated target)
                        throws VersionControlException,
                               WTException


Supported API: false

Specified by:
copyBranchInfo in interface VersionControlService
Parameters:
source -
target -
Returns:
Iterated
Throws:
VersionControlException
WTException

setSuccessorVersionable

public void setSuccessorVersionable(Iterated target,
                                    QueryResult successors)
                             throws VersionControlException,
                                    WTException
The predecessor links are managed during new object creation and via the successor method. This method is intended to support the connection of a branch to a Iteration.

Supported API: false

Specified by:
setSuccessorVersionable in interface VersionControlService
Parameters:
target -
successors -
Throws:
VersionControlException
WTException

setSuccessorVersionable

public void setSuccessorVersionable(Iterated target,
                                    Versionable successor)
                             throws VersionControlException,
                                    WTException
The predecessor links are managed during new object creation and via the successor method. This method is intended to support the connection of a branch to a Iteration.

Supported API: false

Specified by:
setSuccessorVersionable in interface VersionControlService
Parameters:
target -
successor -
Throws:
VersionControlException
WTException

merge

public Versioned merge(Versioned srcVersion,
                       Versioned destVersion,
                       String note)
                throws WTException,
                       WTPropertyVetoException
Creates a new iteration of srcVersion and re-parents it as the latest iteration of destVersion. The new iteration essentially has the business attributes of srcVersion and the administrative (and version label) attributes of destVersion. A MergeInfoLink is created between the new iteration and srcVersion.

Note that this class provides a multi-object equivalent of this method as well.

Supported API: true

Specified by:
merge in interface VersionControlService
Parameters:
srcVersion - the version to be merged from
destVersion - the version to be merged to
note - the iteration note to be assigned to the new iteration
Returns:
Versioned
Throws:
WTException
WTPropertyVetoException

merge

public WTValuedMap merge(WTValuedMap sourceToDestinationsMap,
                         String note)
                  throws WTException,
                         WTPropertyVetoException
Multi-object form of merge operation.

Returns map from source objects to newly formed "merged" iterations.

See comments on single-object merge operation for more details.

Supported API: true

Specified by:
merge in interface VersionControlService
Parameters:
sourceToDestinationsMap - map from merge sources to merge destinations
note - the iteration note to be assigned to the new iterations
Returns:
WTValuedMap
Throws:
WTException
WTPropertyVetoException

newIteration

public Iterated newIteration(Iterated iteration,
                             boolean copyAttributes)
                      throws WTException,
                             VersionControlException,
                             WTPropertyVetoException
Makes a new iteration/version as a copy from the given one, and does not increment its identifiier. Based on the boolean copyAttributes value, determines whether
are to be copied to the new object.

Supported API: true

Specified by:
newIteration in interface VersionControlService
Parameters:
iteration -
copyAttributes -
Returns:
Iterated
Throws:
WTException
VersionControlException
WTPropertyVetoException

getLatestIteration

public Iterated getLatestIteration(Iterated iteration,
                                   boolean includeMarkedForDelete)
                            throws WTException,
                                   VersionControlException
Get 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

Specified by:
getLatestIteration in interface VersionControlService
Parameters:
iteration -
includeMarkedForDelete -
Returns:
Iterated
Throws:
WTException
VersionControlException

deleteIterations

public void deleteIterations(Iterated beginIteration,
                             Iterated endIteration)
                      throws WTException,
                             VersionControlException,
                             WTPropertyVetoException
Deletes all iterations between beginIteration and endIteration of same version. Both beginIteration and endIteration will also get deleted. beginIteration should be chronologically smaller than endIteration. Also it will not delete all iterations in version, i.e., beginIteration can't be first of version and endIteration can't be latest of version simaltaneously.

Supported API: true

Specified by:
deleteIterations in interface VersionControlService
Parameters:
beginIteration -
endIteration -
Throws:
WTException
VersionControlException
WTPropertyVetoException

deleteIterations

public void deleteIterations(WTCollection iterations,
                             ConflictResolution[] resolvers)
                      throws WTException,
                             VersionControlException,
                             WTPropertyVetoException
This is for deletion of selective iterations. List of iterations can include iterations from different versions and different masters. It can throw conflict exception for branch point deletion if all iterations on successor branches are not selected for deletion. Also, conflict exception is thrown during deletion of latest iteration and decision for deletion of latest iteration is taken on basis of resolutions provided.

Supported API: true

Specified by:
deleteIterations in interface VersionControlService
Parameters:
iterations - WTCollection of all iterations to be deleted.
resolvers - Resolutions provided to resove oevrridable conflicts.
Throws:
WTException
VersionControlException
WTPropertyVetoException

insertNode

public Iterated insertNode(Iterated target,
                           Ufid targetUfid,
                           Ufid predBranchPointUfid)
                    throws WTException,
                           VersionControlException
Inserts the target node into the version tree of the object. Necessary information such as FederatableInfo, IterationIdentifier, VersionIdentifier, OneOffVersionIdentifier and View as required need to be set on the node before calling this API.

Supported API: false

Specified by:
insertNode in interface VersionControlService
Parameters:
target - Node to be inserted
targetUfid - Ufid of the node to be inserted
predBranchPointUfid - Ufid of the node from which the target node's version was branched.
Returns:
Iterated
Throws:
WTException
VersionControlException

insertNode

public Iterated insertNode(Iterated target,
                           Ufid targetUfid,
                           Ufid predBranchPointUfid,
                           Ufid[] inwardMergeUfids,
                           Ufid[] outwardMergeUfids)
                    throws WTException,
                           VersionControlException
Inserts the target node into the version tree of the object. Necessary information such as FederatableInfo, IterationIdentifier, VersionIdentifier, OneOffVersionIdentifier and View as required need to be set on the node before calling this API.

Supported API: false

Specified by:
insertNode in interface VersionControlService
Parameters:
target - Node to be inserted
targetUfid - Ufid of the node to be inserted
predBranchPointUfid - Ufid of the node from which the target node's version was branched.
inwardMergeUfids - Ufids of all the nodes that form the "from node" of merges terminating on the target node.
outwardMergeUfids - Ufids of all the nodes that form the "to node" of merges originating on the target node.
Returns:
Iterated
Throws:
WTException
VersionControlException

getPredBranchPointUfid

public Ufid getPredBranchPointUfid(Iterated target)
                            throws WTException,
                                   VersionControlException
Gets the Ufid of the node from which target node's version branched.

Supported API: false

Specified by:
getPredBranchPointUfid in interface VersionControlService
Parameters:
target -
Returns:
Ufid
Throws:
WTException
VersionControlException

getUfidOf

public Ufid getUfidOf(Iterated target)
               throws WTException,
                      VersionControlException
Gets the Ufid of the node.

Supported API: false

Specified by:
getUfidOf in interface VersionControlService
Parameters:
target -
Returns:
Ufid
Throws:
WTException
VersionControlException

getInwardsMergesOf

public Ufid[] getInwardsMergesOf(Iterated target)
                          throws WTException,
                                 VersionControlException
Gets the Ufids of all nodes which form the "from node" of merges terminating on the target node.

Supported API: false

Specified by:
getInwardsMergesOf in interface VersionControlService
Parameters:
target -
Returns:
Ufid[]
Throws:
WTException
VersionControlException

getOutwardMergesOf

public Ufid[] getOutwardMergesOf(Iterated target)
                          throws WTException,
                                 VersionControlException
Gets the Ufids of all nodes which form the "to node" of merges originating on the target node.

Supported API: false

Specified by:
getOutwardMergesOf in interface VersionControlService
Parameters:
target -
Returns:
Ufid[]
Throws:
WTException
VersionControlException

newIterations

public WTValuedMap newIterations(WTCollection iterations)
                          throws WTException,
                                 VersionControlException,
                                 WTPropertyVetoException
Deprecated.  

Makes a new iteration/version as a copy from the given one, and does not increment its identifiier.

Supported API: false

Specified by:
newIterations in interface VersionControlService
Parameters:
iterations -
Returns:
WTValuedMap
Throws:
WTException
VersionControlException
WTPropertyVetoException

newIterations

public WTValuedMap newIterations(WTCollection iterations,
                                 boolean copyAttributes)
                          throws WTException,
                                 VersionControlException,
                                 WTPropertyVetoException
Deprecated.  

Makes a new iteration/version as a copy from the given one, and does not increment its identifiier.

Supported API: false

Specified by:
newIterations in interface VersionControlService
Parameters:
iterations -
copyAttributes -
Returns:
WTValuedMap
Throws:
WTException
VersionControlException
WTPropertyVetoException

supersede

public WTValuedMap supersede(WTValuedMap iterationReplacementMap)
                      throws WTException,
                             VersionControlException,
                             WTPropertyVetoException
Supersedes each iteration passed as the key in the WTValuedMap with the corresponding iteration value in the WTValuedMap. Also, each superseding iteration's identifier is incremented.

Supported API: true

Specified by:
supersede in interface VersionControlService
Parameters:
iterationReplacementMap -
Returns:
WTValuedMap
Throws:
WTException
VersionControlException
WTPropertyVetoException

newVersions

public WTValuedMap newVersions(WTCollection versions)
                        throws WTException,
                               VersionControlException,
                               WTPropertyVetoException
Makes a new in-lined version from the given version. The newly in-lined version's identifier is incremented.

Supported API: true

Specified by:
newVersions in interface VersionControlService
Parameters:
versions -
Returns:
WTValuedMap
Throws:
WTException
VersionControlException
WTPropertyVetoException

newVersions

public WTValuedMap newVersions(WTKeyedMap versionMap)
                        throws WTException,
                               VersionControlException,
                               WTPropertyVetoException
Makes a new in-lined version from the given version. The newly in-lined version's version and iteration identifiers are set to the values passed in to this method..

Supported API: true

Specified by:
newVersions in interface VersionControlService
Parameters:
versionMap -
Returns:
WTValuedMap
Throws:
WTException
VersionControlException
WTPropertyVetoException

newVersionables

public WTList newVersionables(WTList versions)
                       throws WTException,
                              VersionControlException,
                              WTPropertyVetoException
API intended to be called internally by any API that intends to create a new version. It creates a new in-line version (with a new branch identifier), resets the iteration identifier, and assigns the version creator.

Supported API: true

Specified by:
newVersionables in interface VersionControlService
Parameters:
versions -
Returns:
WTList
Throws:
WTException
VersionControlException
WTPropertyVetoException

refresh

public Iterated refresh(VersionForeignKey key)
                 throws WTException
Retrieves a Iterated object given its VersionForeignKey.

Supported API: true

Specified by:
refresh in interface VersionControlService
Parameters:
key -
Returns:
Iterated
Throws:
WTException

getLatestIterations

public WTValuedMap getLatestIterations(WTCollection iterations,
                                       boolean includeMarkedForDelete)
                                throws WTException,
                                       VersionControlException
Get the "latest" iteration in the same branch as the ones passed in the collection. 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. The WTValuedMap that is returned gives a mapping from the iterations passed to the latest iterations found, a null value is returned for any non-persistent iterations passed, and for any working copies passed the same working copy will be the value.

Supported API: true

Specified by:
getLatestIterations in interface VersionControlService
Parameters:
iterations -
includeMarkedForDelete -
Returns:
WTValuedMap
Throws:
WTException
VersionControlException

insertIteration

private Iterated insertIteration(Iterated predecessor,
                                 Iterated target,
                                 Iterated successor)
                          throws VersionControlException,
                                 WTException
Throws:
VersionControlException
WTException

assignOneOffSeries

protected void assignOneOffSeries(OneOffVersioned version)
                           throws WTException
Throws:
WTException

orderedIterationsOf

protected QueryResult orderedIterationsOf(QueryResult iterations)
                                   throws VersionControlException
Throws:
VersionControlException

removeControlBranches

private int removeControlBranches(WTCollection iterations,
                                  Class targetClass)
                           throws WTException
Delete control branch for all those iterations in the collection that no longer have any other iterations left.. This is a brute force delete.... Returns number of rows deleted

Throws:
WTException

hasMasterWithNoIterations

private QueryResult hasMasterWithNoIterations(WTCollection iterations,
                                              Class targetClass,
                                              Class masterClass)
                                       throws WTException
Delete control branch for all those iterations in the collection that no longer have any other iterations left.. This is a brute force delete.... Returns number of rows deleted

Throws:
WTException

successorsOf

protected QueryResult successorsOf(WTCollection iterations,
                                   Class targetClass)
                            throws WTException
Find all the successors of a set of iterations, where a successor can't be one of the given iterations

Throws:
WTException

successorsOf

protected QueryResult successorsOf(Iterated iteration)
                            throws WTException
Find all successors of a given iteration

Throws:
WTException

iterationsBetween

protected Vector iterationsBetween(Iterated first,
                                   boolean include_first,
                                   Iterated last,
                                   boolean include_last)
                            throws WTException,
                                   VersionControlException,
                                   WTPropertyVetoException
Find all succeeding iterations between two iterations. The first iteration must come before the last one chronologically.

Throws:
WTException
VersionControlException
WTPropertyVetoException

allElementsOf

private QueryResult allElementsOf(Mastered master,
                                  Class type)
                           throws WTException
Factors the implementation of allVersionsOf and allIterationsOf into a common method.

Throws:
WTException

dispatchSingleObjectMergeEvent

private void dispatchSingleObjectMergeEvent(Versioned newIter,
                                            Versioned srcVersion,
                                            Versioned destVersion,
                                            boolean isPreEvent)
                                     throws WTException,
                                            WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

dispatchMultiObjectMergeEvent

private void dispatchMultiObjectMergeEvent(WTValuedMap sourceToDestinationsMap,
                                           WTValuedMap sourceToNewIterationsMap,
                                           WTValuedMap newIterationToDestinationsMap,
                                           WTValuedMap destinationToNewIterationMap,
                                           boolean isPreEvent)
                                    throws WTException,
                                           WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

duplicate

private static Object duplicate(Serializable object)
                         throws WTException
Duplicate any serializable object via serialization/deserialization (much like WTObject.duplicate)

Throws:
WTException

copyAdminAttrs

private void copyAdminAttrs(WTValuedMap sourceToDestinationsMap,
                            WTValuedMap newIterationToDestinationsMap,
                            String note)
                     throws WTException,
                            WTPropertyVetoException
Copies various admin-ish attributes from targetVersion to newIter. Used by merge right before firing pre-merge event. Should by all rights be done via pre-merge event (and was originally implemented this way) but other service owners objected to event listeners there. Thus this service is burdened with knowing about all existing admin-ish attributes to copy from the target version to the new merge iteration -- which is what this routine does.

Any additional copying should really be done via services that need their data copied in this manner, however, or, alternatively, a new attribute copying service could be created to house such logic. The latter was perceived as overly heavy and out-of-scope for the initial merge effort.

Throws:
WTException
WTPropertyVetoException

getFolder

private static Folder getFolder(FolderEntry folderEntry,
                                boolean bypassAccessControl)
                         throws WTException
Throws:
WTException

processPostMultiDelete

private void processPostMultiDelete(Object[] objectsToDelete)
                             throws VersionControlException
Throws:
VersionControlException

makeChainAndAdjust

private void makeChainAndAdjust(WTArrayList iterations,
                                WTHashSet deleteList,
                                HashMap postRollupMap,
                                HashMap postRollbackMap)
                         throws WTException,
                                VersionControlException,
                                WTPropertyVetoException
Throws:
WTException
VersionControlException
WTPropertyVetoException

prepareIterationChainForDelete

private WTHashSet prepareIterationChainForDelete(WTArrayList iterations,
                                                 WTHashSet analyzed,
                                                 HashMap postRollupMap,
                                                 HashMap postRollbackMap)
                                          throws WTException,
                                                 VersionControlException,
                                                 WTPropertyVetoException
Throws:
WTException
VersionControlException
WTPropertyVetoException

validateBranchConstraint

private void validateBranchConstraint(WTCollection outputIterations,
                                      boolean sameBranch)
                               throws WTException,
                                      VCBranchPointException
Throws:
WTException
VCBranchPointException

numOfIterations

private QueryResult numOfIterations(Set branchIDs)
                             throws WTException
Throws:
WTException

getBranchedControlBranches

private QueryResult getBranchedControlBranches(WTCollection iterations)
                                        throws WTException
Throws:
WTException

successorsOf

private QueryResult successorsOf(WTCollection iterations,
                                 WTHashSet excludeList)
                          throws WTException
Find all the successors of a set of iterations, where a successor can't be one of the given iterations and also it can't be from the excludeList. Iterations are of same class.

Throws:
WTException

getAPossiblePredecessor

private Versioned getAPossiblePredecessor(Hashtable insNodeTable)
                                   throws WTException
Throws:
WTException

getObjectBySeriesAndView

private Versioned getObjectBySeriesAndView(QueryResult vtSet,
                                           Series tSer,
                                           View tView,
                                           Series r1Ser)
                                    throws WTException
Throws:
WTException

getPredInLowerVersions

private Versioned getPredInLowerVersions(QueryResult vtSet,
                                         Series tSer,
                                         View aView,
                                         Series t1OffSer)

getFirstIterationOf

private Iterated getFirstIterationOf(long branchId)
                              throws VersionControlException,
                                     WTException
Throws:
VersionControlException
WTException

isAChildView

private boolean isAChildView(View aView,
                             View[] parentViews)

lowerVersion

private boolean lowerVersion(MultilevelSeries testSer,
                             MultilevelSeries refSer)

getParentViews

private View[] getParentViews(Hashtable insNodeTable)
                       throws VersionControlException,
                              WTException
Throws:
VersionControlException
WTException

getBestMatchPredecessor

private Iterated getBestMatchPredecessor(Iterated target,
                                         Hashtable insNodeTable)
                                  throws VersionControlException,
                                         WTException
Throws:
VersionControlException
WTException

fillTargetDetails

private void fillTargetDetails(Hashtable insNodeTable)
                        throws WTException,
                               VersionControlException
Throws:
WTException
VersionControlException

insertNodeVerifyTarget

private void insertNodeVerifyTarget(Iterated target,
                                    Ufid targetUfid)
                             throws WTException,
                                    VersionControlException
Throws:
WTException
VersionControlException

insertNode

private Iterated insertNode(Iterated target,
                            Hashtable insNodeTable)
                     throws WTException,
                            VersionControlException
Performs the insertion -- if master not persisted, persist the object and its CB -- else if the version of target exists, do an insertIteration -- else do an insertVersion

Throws:
WTException
VersionControlException

getControlBranchesOf

private QueryResult getControlBranchesOf(Versioned target)
                                  throws WTException,
                                         VersionControlException
Throws:
WTException
VersionControlException

insertNodeGetSuccessors

private void insertNodeGetSuccessors(Hashtable insNodeTable)
                              throws WTException,
                                     VersionControlException
Throws:
WTException
VersionControlException

lowerOrEqualView

private boolean lowerOrEqualView(View lView,
                                 View hView)
                          throws WTException
Throws:
WTException

isPredecessor

private boolean isPredecessor(Versioned low,
                              Versioned high)
                       throws WTException,
                              VersionControlException
Throws:
WTException
VersionControlException

insertNodeVersion

private Iterated insertNodeVersion(Iterated target,
                                   Hashtable insNodeTable)
                            throws WTException,
                                   VersionControlException,
                                   WTPropertyVetoException
Throws:
WTException
VersionControlException
WTPropertyVetoException

createMerge

private void createMerge(Versioned target,
                         Ufid other,
                         boolean inwards)
                  throws WTException,
                         VersionControlException
Throws:
WTException
VersionControlException

insertNodeCreateMerges

private void insertNodeCreateMerges(Iterated target,
                                    Hashtable insNodeTable)
                             throws WTException,
                                    VersionControlException
Throws:
WTException
VersionControlException

insertNodeUpdateSuccessors

private void insertNodeUpdateSuccessors(Iterated target,
                                        Hashtable insNodeTable)
                                 throws WTException,
                                        VersionControlException,
                                        WTPropertyVetoException
Throws:
WTException
VersionControlException
WTPropertyVetoException

insertNodeIteration

private Iterated insertNodeIteration(Iterated target)
                              throws VersionControlException,
                                     WTException
Throws:
VersionControlException
WTException

getBranchPointOf

private Iterated getBranchPointOf(Iterated target)
                           throws VersionControlException,
                                  WTException
Throws:
VersionControlException
WTException

getMergeUfidsOf

private Ufid[] getMergeUfidsOf(Iterated target,
                               boolean inwards)
                        throws WTException
Throws:
WTException

getMasterIds

private long[] getMasterIds(WTCollection objs,
                            boolean isMaster)
                     throws WTException
Throws:
WTException

getBranchIds

private long[] getBranchIds(WTCollection objs)
                     throws WTException
Throws:
WTException

getObjectIds

private long[] getObjectIds(WTCollection objs)
                     throws WTException
Throws:
WTException

validateVersionSchemeDuringMove

private void validateVersionSchemeDuringMove(WTCollection versions,
                                             WTValuedMap containedToDestinations,
                                             WTValuedMap containedToSources)
                                      throws WTException
Throws:
WTException

addDirective

protected void addDirective(WTCollection iters)
                     throws WTException
Add directive to PRE_DELETE listener

Throws:
WTException

putInTXMapForDelete

private void putInTXMapForDelete(WTCollection coll)
                          throws WTException
Throws:
WTException

existsInTXMapForDelete

private boolean existsInTXMapForDelete(ObjectReference objectRef)
                                throws WTException
Throws:
WTException

throwPreRollupRollbackEvents

private void throwPreRollupRollbackEvents(WTArrayList[][] version_list,
                                          HashMap preRollupMap,
                                          HashMap preRollbackMap)
                                   throws WTException,
                                          WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

throwPostRollupRollbackEvents

private void throwPostRollupRollbackEvents(HashMap preRollupMap,
                                           HashMap preRollbackMap,
                                           HashMap postRollupMap,
                                           HashMap postRollbackMap)
                                    throws WTException,
                                           WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

wtArrayListToVector

private Vector wtArrayListToVector(WTArrayList iterations,
                                   int from_index,
                                   int end_index)
                            throws WTException
Throws:
WTException

preCheckin

private void preCheckin(WTValuedMap checkedout_to_working)
                 throws WTException
Cache the iterations that we're checking in. so that we don't update historical iterations for them in post folder or domain change

Parameters:
checkedout_to_working -
Throws:
WTException

preChangeFolder

private void preChangeFolder(WTValuedMap targets_to_destinations,
                             WTValuedMap targets_to_sources)
                      throws WTException
Cache the objects that are in change folder, so that we know not to deal with them in the POST_CHANGE_DOMAIN listener

Parameters:
targets_to_destinations - Mapping of target FolderEntry objects to their destination Folders
targets_to_sources - Mapping of target FolderEntry objects to their source Folders
Throws:
WTException

postChangeFolder

private void postChangeFolder(WTKeyedMap destinations_to_targets,
                              WTValuedMap targets_to_sources)
                       throws WTException
Update the domain and cabinet of historical iterations

Parameters:
targets_to_sources - Mapping of target FolderEntry objects to their source Folders
Throws:
WTException

preChangeDomain

private void preChangeDomain(WTList domain_administereds,
                             WTList target_domains)
                      throws WTException
Veto the domain change of any non-latest iteration

Parameters:
domain_administereds - List of domain administereds
target_domains - List of the corresponding domains to move them to
Throws:
WTException

postChangeDomain

private void postChangeDomain(WTCollection iterateds)
                       throws WTException
Update the domain of historical iterations

Parameters:
iterateds - The iterated objects that have been moved to a new domain
Throws:
WTException

updateHistoricalIterations

int updateHistoricalIterations(WTCollection iterations,
                               ObjectReference destination_domain_ref,
                               ObjectReference destination_cabinet_ref,
                               ObjectReference destination_owner_ref)
                         throws WTException
Assign the previous iterations of the given collection of latest iterations to the given domain and cabinet

Parameters:
iterations - A collection of iterated objects
destination_domain_ref - The domain to move the iterations to. If null, then the domain isn't changed
destination_cabinet_ref - The cabinet to move the iterations to. If null, then the cabinet isn't changed
destination_owner_ref - The owner of the new folder that the objects are being moved to. If null, then the owner isn't changed
Returns:
The number of updated iterations
Throws:
WTException

refsEqual

boolean refsEqual(ObjectReference ref1,
                  ObjectReference ref2)