wt.ixb.util
Class IXBVersionHelper

java.lang.Object
  extended bywt.ixb.util.IXBVersionHelper

public class IXBVersionHelper
extends Object

helps publish objects with mapped version and iteration ids. -the setNewVersionIteration() method is useful to create new objects -the iterateOrRevise() method is useful for creating subsequent versions or iterations -the versionMappingType parameter in these methods determines the mapping policy -the version and iteration indexes are zero based.


Field Summary
static String CHECKOUT_WORKSPACE_NAME_KEY
           
private static boolean DEBUG
           
private static String MAP_NONE
          versionMappingType value - NONE just create a new iteration for every new piv.
private static String MAP_VERSION
          versionMappingType value - VERSION revise the object if necessary, iterates otherwise
private static String MAP_VERSION_ITERATION
          versionMappingType value - VERSION_ITERATION revise the object if necessary, else creates new iteration with specified iteration id
 
Constructor Summary
IXBVersionHelper()
           
 
Method Summary
static Workable checkinWorkable(Workable workable)
           
static Workable checkoutWorkable(Workable workable)
           
static Workable checkoutWorkable(Workable workable, Folder checkoutFolder)
           
static int compareVersion(Versioned versioned, int targetVersionIndex)
          determine if part needs to be revised -1 if target version is before the versioned object 0 if target version is same as the versioned object 1 if target version is a successor
static Versioned createPreviousIterator(Iterated iteration, IntegerSeries iterationSeries)
           
private static void createTestPart(String number, String versionMappingType)
           
private static String getEPMDocIdentifier(EPMDocument doc)
           
static int getIterationIndex(IntegerSeries iterationSeries)
           
static IntegerSeries getIterationSeries(int iterationIndex)
          utility fn to create a series obj used to set iterations.
static String getObjectIdentifier(Workable workable)
           
private static String getPartIdentifier(WTPart part)
           
static int getVersionIndex(String version)
           
static MultilevelSeries getVersionSeries(int versionIndex)
          utility fn to create a series obj used to set versions currently returns 'A' for 0, 'D'for 3 ...
private static String getWTDocIdentifier(WTDocument doc)
           
static int isSuccessor(Versioned versioned, int targetVersionIndex, int targetIterationIndex)
          checks if target version,iteration is really a successor for example an object B.3 can have C.4 as a successor -2 if target version is before the versioned object -1 if target iteration is before the versioned object 0 if target is same as the versioned object 1 if target iteration is a successor 2 if target version is a successor
private static Versioned iterate(Versioned source_object)
          creates a new iteration for the versioned object iteration id is next in sequence
private static Versioned iterate(Versioned source_object, int targetIterationIndex)
          creates a new iteration for the versioned object iterationIndex, if used, is the 0 based index to the target iteration id.
static Versioned iterateOrRevise(Versioned versioned, int targetVersionIndex, int targetIterationIndex, Boolean[] wasRevised)
           
private static Versioned iterateOrRevise(Versioned versioned, int targetVersionIndex, int targetIterationIndex, String versionMappingType, Boolean[] wasRevised)
          iterates or revises a Versioned object The versionMappingType decides which mapping to apply - NONE, VERSION, VERSION_ITERATION versionIndex, if used, is the 0 based index to the target version id for example pass 0 for 'A', 3 for 'D' ,...
static void main(String[] args)
           
private static void PP(String msg)
           
private static Versioned revise(Versioned source_object, int targetVersionIndex)
          revises a versioned object targetVersionIndex is the 0 based index to the version id for example pass 3 for 'D' ,...
private static Versioned revise(Versioned source_object, int targetVersionIndex, int targetIterationIndex)
          revises a versioned object targetVersionIndex is the 0 based index to the version id for example pass 3 for 'D' ,...
private static void reviseTestPart(String number, String versionMappingType)
           
static void setNewIteration(Versioned versioned, int targetIterationIndex)
          sets the iteration for a new Versioned object call this before the object is saved iterationIndex is the 0 based index to the target iteration id for example pass 0 for '1', 3 for '4' ,...
static void setNewVersion(Versioned versioned, int targetVersionIndex)
          sets the version for a new Versioned object call this before the object is saved versionIndex is the 0 based index to the target version id for example pass 0 for 'A', 3 for 'D' ,...
static void setNewVersionIteration(Versioned versioned, int targetVersionIndex, int targetIterationIndex)
           
private static void setNewVersionIteration(Versioned versioned, int targetVersionIndex, int targetIterationIndex, String versionMappingType)
          sets the version and iteration for a new Versioned object call this before the object is saved The versionMappingType decides which mapping to apply - NONE, VERSION, VERSION_ITERATION versionIndex, if used, is the 0 based index to the target version id for example pass 0 for 'A', 3 for 'D' ,...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECKOUT_WORKSPACE_NAME_KEY

public static final String CHECKOUT_WORKSPACE_NAME_KEY
See Also:
Constant Field Values

MAP_NONE

private static final String MAP_NONE
versionMappingType value - NONE just create a new iteration for every new piv. the value can be blank or null also

See Also:
Constant Field Values

MAP_VERSION

private static final String MAP_VERSION
versionMappingType value - VERSION revise the object if necessary, iterates otherwise

See Also:
Constant Field Values

MAP_VERSION_ITERATION

private static final String MAP_VERSION_ITERATION
versionMappingType value - VERSION_ITERATION revise the object if necessary, else creates new iteration with specified iteration id

See Also:
Constant Field Values

DEBUG

private static boolean DEBUG
Constructor Detail

IXBVersionHelper

public IXBVersionHelper()
Method Detail

setNewVersionIteration

public static void setNewVersionIteration(Versioned versioned,
                                          int targetVersionIndex,
                                          int targetIterationIndex)
                                   throws WTException
Throws:
WTException

setNewVersionIteration

private static void setNewVersionIteration(Versioned versioned,
                                           int targetVersionIndex,
                                           int targetIterationIndex,
                                           String versionMappingType)
                                    throws WTException
sets the version and iteration for a new Versioned object call this before the object is saved The versionMappingType decides which mapping to apply - NONE, VERSION, VERSION_ITERATION versionIndex, if used, is the 0 based index to the target version id for example pass 0 for 'A', 3 for 'D' ,... iterationIndex, if used, is the 0 based index to the target iteration id. 0 represents the minimum iteration of wt.series.IntegerSeries.min in wt.properties. 1 represents the next iteration configured in the wt.properties.

Throws:
WTException

iterateOrRevise

private static Versioned iterateOrRevise(Versioned versioned,
                                         int targetVersionIndex,
                                         int targetIterationIndex,
                                         String versionMappingType,
                                         Boolean[] wasRevised)
                                  throws WTException
iterates or revises a Versioned object The versionMappingType decides which mapping to apply - NONE, VERSION, VERSION_ITERATION versionIndex, if used, is the 0 based index to the target version id for example pass 0 for 'A', 3 for 'D' ,... iterationIndex, if used, is the 0 based index to the target iteration id. 0 represents the minimum iteration of wt.series.IntegerSeries.min in wt.properties. 1 represents the next iteration configured in the wt.properties. wasRevised[0] will be set to true if a new version was created in this case, the obj will have to saved after setting attrs wasRevised[0] will be set to false if a new iteration was created in this case, the obj will have to be checkedin after setting attrs

Throws:
WTException

iterateOrRevise

public static Versioned iterateOrRevise(Versioned versioned,
                                        int targetVersionIndex,
                                        int targetIterationIndex,
                                        Boolean[] wasRevised)
                                 throws WTException
Throws:
WTException

setNewVersion

public static void setNewVersion(Versioned versioned,
                                 int targetVersionIndex)
                          throws WTException
sets the version for a new Versioned object call this before the object is saved versionIndex is the 0 based index to the target version id for example pass 0 for 'A', 3 for 'D' ,...

Throws:
WTException

setNewIteration

public static void setNewIteration(Versioned versioned,
                                   int targetIterationIndex)
                            throws WTException
sets the iteration for a new Versioned object call this before the object is saved iterationIndex is the 0 based index to the target iteration id for example pass 0 for '1', 3 for '4' ,...

Throws:
WTException

compareVersion

public static int compareVersion(Versioned versioned,
                                 int targetVersionIndex)
                          throws WTException
determine if part needs to be revised -1 if target version is before the versioned object 0 if target version is same as the versioned object 1 if target version is a successor

Throws:
WTException

isSuccessor

public static int isSuccessor(Versioned versioned,
                              int targetVersionIndex,
                              int targetIterationIndex)
                       throws WTException
checks if target version,iteration is really a successor for example an object B.3 can have C.4 as a successor -2 if target version is before the versioned object -1 if target iteration is before the versioned object 0 if target is same as the versioned object 1 if target iteration is a successor 2 if target version is a successor

Throws:
WTException

revise

private static Versioned revise(Versioned source_object,
                                int targetVersionIndex)
                         throws WTException
revises a versioned object targetVersionIndex is the 0 based index to the version id for example pass 3 for 'D' ,... iterationIndex is the 0

Throws:
WTException

revise

private static Versioned revise(Versioned source_object,
                                int targetVersionIndex,
                                int targetIterationIndex)
                         throws WTException
revises a versioned object targetVersionIndex is the 0 based index to the version id for example pass 3 for 'D' ,... iterationIndex, if used, is the 0 based index to the target iteration id. 0 represents the minimum iteration of wt.series.IntegerSeries.min in wt.properties. 1 represents the next iteration configured in the wt.properties.

Throws:
WTException

iterate

private static Versioned iterate(Versioned source_object,
                                 int targetIterationIndex)
                          throws WTException
creates a new iteration for the versioned object iterationIndex, if used, is the 0 based index to the target iteration id. 0 represents the minimum iteration of wt.series.IntegerSeries.min in wt.properties. 1 represents the next iteration configured in the wt.properties.

Throws:
WTException

iterate

private static Versioned iterate(Versioned source_object)
                          throws WTException
creates a new iteration for the versioned object iteration id is next in sequence

Throws:
WTException

getVersionSeries

public static MultilevelSeries getVersionSeries(int versionIndex)
                                         throws WTException
utility fn to create a series obj used to set versions currently returns 'A' for 0, 'D'for 3 ...

Throws:
WTException

getVersionIndex

public static int getVersionIndex(String version)
                           throws WTException
Throws:
WTException

getIterationSeries

public static IntegerSeries getIterationSeries(int iterationIndex)
                                        throws WTException
utility fn to create a series obj used to set iterations. iterationIndex, if used, is the 0 based index to the target iteration id. 0 represents the minimum iteration of wt.series.IntegerSeries.min in wt.properties. 1 represents the next iteration configured in the wt.properties.

Throws:
WTException

getIterationIndex

public static int getIterationIndex(IntegerSeries iterationSeries)
                             throws WTException
Throws:
WTException

createPreviousIterator

public static Versioned createPreviousIterator(Iterated iteration,
                                               IntegerSeries iterationSeries)
                                        throws WTException
Throws:
WTException

main

public static void main(String[] args)

createTestPart

private static void createTestPart(String number,
                                   String versionMappingType)
                            throws Exception
Throws:
Exception

reviseTestPart

private static void reviseTestPart(String number,
                                   String versionMappingType)
                            throws Exception
Throws:
Exception

checkoutWorkable

public static Workable checkoutWorkable(Workable workable,
                                        Folder checkoutFolder)
                                 throws WTException
Throws:
WTException

checkoutWorkable

public static Workable checkoutWorkable(Workable workable)
                                 throws WTException
Throws:
WTException

checkinWorkable

public static Workable checkinWorkable(Workable workable)
                                throws WTException
Throws:
WTException

getPartIdentifier

private static String getPartIdentifier(WTPart part)
                                 throws WTException
Throws:
WTException

getEPMDocIdentifier

private static String getEPMDocIdentifier(EPMDocument doc)
                                   throws WTException
Throws:
WTException

getWTDocIdentifier

private static String getWTDocIdentifier(WTDocument doc)
                                  throws WTException
Throws:
WTException

getObjectIdentifier

public static String getObjectIdentifier(Workable workable)
                                  throws WTException
Throws:
WTException

PP

private static void PP(String msg)