org.xiruss.snapcm.api
Interface Version

All Superinterfaces:
RepositoryObject
All Known Subinterfaces:
CompoundDocument, FileStorageObject, Organizer, StorageObject, TextStorageObject, XmlStorageObject
All Known Implementing Classes:
CompoundDocumentBase, CompoundDocumentStorageObject, CompoundDocumentStorageObjectProxy, NullVersion, OrganizerBase, OrganizerProxy, ReferentTrackingDocument, ReferentTrackingDocument, StorageObjectBase, StorageObjectProxy, TextStorageObjectBase, TextStorageObjectProxy, VersionBase, VersionProxy, XmlStorageObjectBase, XmlStorageObjectProxy

public interface Version
extends RepositoryObject


Method Summary
 void addDependency(DependencyLink dependency)
           
 void addNextVersion(Version ver)
          Adds a version as being a previous version of this version.
 void addPreviousVersion(Version effectiveVer)
          Adds a version as being a next version of this version.
 void checkIsNotFixed()
           
 void collectTargetVersions(VersionMap members, Snapshot onSnapshot, java.lang.String dependencyTypeName)
          Gets all the versions on which this version is dependent for a given dependency class.
 boolean dependsOn(Resource resource)
          Returns true if the version has one or more dependency relationships of any type to the specified resource.
 boolean dependsOn(Resource resource, java.lang.String dependencyTypeName)
          Returns true if the version has one or more dependency relationships to the specified resource.
 DependencyMap getDependencies()
          Returns the set of dependency
 DependencyMap getDependenciesByType(java.lang.String typeName)
          Returns a collection of dependencies of the specififed type, if any.
 VersionMap getNext()
          Gets the previous versions for this version.
 VersionMap getPrevious()
          Gets the previous versions for this version.
 Resource getResource()
           
 void initialize(java.lang.String versionId, java.lang.String versionName, Resource res)
          Initialize the core properties of the version.
 void initialize(java.lang.String versionId, java.lang.String versionName, java.util.Set previousVersions, Resource res)
           
 boolean isFixed()
           
 void setAsFixed()
          Sets the version as "fixed", meaning that it cannot be mutated further.
 void setPrevious(VersionMap previousVersions)
          Sets the previous versions for this version.
 
Methods inherited from interface org.xiruss.snapcm.api.RepositoryObject
accept, compareTo, getId, getName, getProperties, getProperty, getPropertyNames, getRepository, getType, hasProperty, initialize, isNull, setId, setName, setProperty, toString
 

Method Detail

initialize

void initialize(java.lang.String versionId,
                java.lang.String versionName,
                Resource res)
                throws VersionMutationException
Initialize the core properties of the version.

Parameters:
versionName -
res -
Throws:
VersionMutationException

initialize

void initialize(java.lang.String versionId,
                java.lang.String versionName,
                java.util.Set previousVersions,
                Resource res)
                throws VersionMutationException
Parameters:
versionName -
previousVersions -
res -
Throws:
VersionMutationException

setAsFixed

void setAsFixed()
Sets the version as "fixed", meaning that it cannot be mutated further. This method also adds the version to the resource. While versions know what resource they are a version of, until they are committed to the repository, the resource doesn't know about the version.


isFixed

boolean isFixed()

checkIsNotFixed

void checkIsNotFixed()
                     throws VersionMutationException
Throws:
VersionMutationException

addDependency

void addDependency(DependencyLink dependency)
                   throws VersionMutationException
Throws:
VersionMutationException

getDependencies

DependencyMap getDependencies()
Returns the set of dependency

Returns:

getDependenciesByType

DependencyMap getDependenciesByType(java.lang.String typeName)
Returns a collection of dependencies of the specififed type, if any.

Parameters:
typeName - The fully-qualified type name for the dependency (the Java class name for the dependency type.
Returns:
The set of dependencies of the specified type. May be empty.

getResource

Resource getResource()

dependsOn

boolean dependsOn(Resource resource)
Returns true if the version has one or more dependency relationships of any type to the specified resource.

Parameters:
resource -
Returns:
Returns true if there are any dependencies.

dependsOn

boolean dependsOn(Resource resource,
                  java.lang.String dependencyTypeName)
Returns true if the version has one or more dependency relationships to the specified resource.

Parameters:
resource -
dependencyTypeName - The name of the dependency type to check. If null, checks all dependency types.
Returns:
Returns true if there are any dependencies of the specified type.

getPrevious

VersionMap getPrevious()
Gets the previous versions for this version.

Returns:
VersionMap of previous versions, if any.

getNext

VersionMap getNext()
Gets the previous versions for this version.

Returns:
VersionMapImpl of next versions, if any.

setPrevious

void setPrevious(VersionMap previousVersions)
                 throws VersionMutationException
Sets the previous versions for this version. Cannot be called once the version is fixed.

Parameters:
previousVersions - Versionmap of previous versions.
Throws:
VersionMutationException

addPreviousVersion

void addPreviousVersion(Version effectiveVer)
Adds a version as being a next version of this version. Also adds the specified version as a previous version of this version. This can be done at any time, whether or not the versions involved are fixed.

Parameters:
nextVer -

addNextVersion

void addNextVersion(Version ver)
Adds a version as being a previous version of this version. Note that we can't add this version as a next version of the specified previous version at this time unless this version is fixed. That is, fixed versions cannot point to versions in mutable snapshots, at least as far as the invariant part of the repository is concerned. This normally happens when a version is created on a snapshot, although it could be done at other times.

Parameters:
prevVer - previous version

collectTargetVersions

void collectTargetVersions(VersionMap members,
                           Snapshot onSnapshot,
                           java.lang.String dependencyTypeName)
Gets all the versions on which this version is dependent for a given dependency class.

Parameters:
members - The version map to which the target versions are added
onSnapshot - The snapshot on which to resolve the dependencies
dependencyTypeName - The class name of the dependency type