com.ptc.wvs.server.publish
Class StandardPublishService
java.lang.Object
wt.services.StandardManager
com.ptc.wvs.server.publish.StandardPublishService
- All Implemented Interfaces:
- Manager, NetFactor, PublishService, Serializable
- public class StandardPublishService
- extends StandardManager
- implements PublishService, Serializable
Use the newStandardPublishService
static factory
method(s), not the StandardPublishService
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.
- See Also:
- Serialized Form
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 |
Method Summary |
protected WTSet |
copyRepresentations(Representable oldIteration,
Representable newIteration,
EPMDocument oldDoc,
EPMDocument newDoc,
WTList oldReps,
boolean forceCopyAll,
boolean includeAllMarkups,
WTKeyedMap newRepSavedMap)
|
void |
dispatchPublishCompleteEvent(Persistable persistable,
boolean success)
Dispatches a PublishServiceEvent to indicate that publishing in complete
Supported API: false |
String |
getConceptualClassname()
Returns the conceptual (modeled) name for the class. |
static StandardPublishService |
newStandardPublishService()
Default factory for the class. |
protected void |
performStartupProcess()
Dummy method to be overridden by subclasses. |
protected void |
processCheckInEvent(Vector objects,
ConfigSpec configSpec)
|
protected void |
processDocumentCheckInEvent(WTDocument doc,
ContentItem ci)
|
protected boolean |
processDocumentCheckInFile(WTDocument doc,
ContentItem ci,
boolean repDefault)
|
protected void |
processMarkupCopyForward(EnterpriseServiceEvent event)
single object version
protected void processMarkupCopyForward(PersistenceManagerEvent event) throws WTException
{
Object obj = event.getEventTarget();
if( (obj == null) || !(obj instanceof Viewable) || !(obj instanceof Workable) || !(obj instanceof Iterated) ) return;
boolean access = SessionServerHelper.manager.setAccessEnforced(false);
try {
if(VERBOSE) System.out.println("POST_STORE markup copy forward event is " + event);
Viewable newIteration = (Viewable)obj;
// as this is from POST_STORE, if the new iteration is a working copy than we do nothing as
// the POST_CHECKOUT will do the work. |
protected void |
processMarkupCopyForward(PersistenceManagerEvent event)
|
protected void |
processMarkupCopyForward(SandboxServiceCheckinEvent event)
|
protected void |
processMarkupCopyForward(SandboxServiceCheckoutEvent event)
|
protected void |
processMarkupCopyForward(SessionIterationEvent event)
SINGLE OBJECT VERSION **********************************
protected void processRepresentationCopyForward(Representable oldIteration, Representable newIteration, boolean forceCopyAll, boolean includeAllMarkups, boolean toSandbox, boolean fromSandbox) throws WTException
{
if( oldIteration == null || newIteration == null ) return;
Representable oldRepresentable = PublishUtils.findRepresentable(oldIteration);
Representable newRepresentable = PublishUtils.findRepresentable(newIteration);
boolean newIterationReset = false;
// if this is an EPMDocument, check that there is no WTPart before continuing
if( oldIteration instanceof EPMDocument ) {
boolean tosandboxcase = false;
if(VERBOSE) System.out.println("EPMDOC OLD REPRESENTABLE IS " + oldRepresentable);
if( !(oldRepresentable instanceof EPMDocument) ) {
// The old EPMDocument has a WTPart, but if the new EPMDocument is in a different container
// to the old EPMDocument, then the new EPMDocument is in the sandbox. |
protected void |
processMarkupCopyForward(WorkInProgressServiceEvent event)
|
protected void |
processMarkupCopyForward(WTValuedMap fromTo,
boolean emitEvent,
boolean allMarkups,
boolean checkContext)
|
protected void |
processRepresentationCopyForward(EnterpriseServiceEvent event)
single object verson
protected void processRepresentationCopyForward(PersistenceManagerEvent event) throws WTException
{
Object obj = event.getEventTarget();
if( (obj == null) || !(obj instanceof Representable) || !(obj instanceof Workable) || !(obj instanceof Iterated) ) return;
// only process depending on if Representable is a WTDocument and settings
if( obj instanceof WTDocument ) {
if( !copyDocumentRepresentationsForward ) return;
}
else {
if( !copyRepresentationsForward ) return;
}
boolean access = SessionServerHelper.manager.setAccessEnforced(false);
try {
if(VERBOSE) System.out.println("POST_STORE copy forward event is " + event);
Representable newIteration = (Representable)obj;
// as this is from POST_STORE, if the new iteration is a working copy than we do nothing as
// the POST_CHECKOUT will do the work. |
protected void |
processRepresentationCopyForward(PersistenceManagerEvent event)
|
protected void |
processRepresentationCopyForward(SandboxServiceCheckinEvent event)
|
protected void |
processRepresentationCopyForward(SandboxServiceCheckoutEvent event)
|
protected void |
processRepresentationCopyForward(WorkInProgressServiceEvent event)
|
protected void |
processRepresentationCopyForward(WTValuedMap fromTo,
boolean forceCopyAll,
boolean includeAllMarkups,
boolean toSandbox,
boolean fromSandbox)
|
protected void |
processRepresentationUpdate(KeyedEvent event,
boolean multiObject)
SINGLE OBJECT VERSION **********************************
protected void processMarkupCopyForward(Viewable oldIteration, Viewable newIteration, boolean emitEvent, boolean allMarkups) throws WTException
{
if( oldIteration == null || newIteration == null ) return;
// get the markups on the old iteration
QueryResult qr1 = ViewMarkUpHelper.service.getMarkUps( oldIteration );
if( qr1 == null || qr1.size() == 0 ) return;
// check that there are not already markups on the new iteration (called twice)
QueryResult qr2 = ViewMarkUpHelper.service.getMarkUps( newIteration );
if( qr2 != null && qr2.size() > 0 ) return;
// copy the markups
RepUpdateUtils.copyAllMarkups(oldIteration, newIteration, allMarkups, true);
if( emitEvent ) {
QueryResult qr3 = ViewMarkUpHelper.service.getMarkUps( newIteration );
if( qr3 != null && qr3.size() > 0 ) {
Vector newMarkupSavedVector = new Vector(5);
while( qr3.hasMoreElements() ) newMarkupSavedVector.addElement( qr3.nextElement() );
EDRHelper.service.dispatchMarkupSavedEvent( newIteration, newMarkupSavedVector );
}
}
} |
protected void |
processRepresentationUpdateForTargets(WTCollection target)
|
void |
registerEvents(ManagerService managerService)
Registers Publish service events with the service manager. |
void |
shutdown()
Manager shutdown operation. |
static Boolean |
testDocumentCheckinFilter(WTDocument doc,
ApplicationData ad)
|
static Boolean |
testEPMCheckinFilter(EPMDocument epmdoc)
|
Methods inherited from class wt.services.StandardManager |
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, setManagerService, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString |
RESOURCE
private static final String RESOURCE
- See Also:
- Constant Field Values
CLASSNAME
private static final String CLASSNAME
versionID
private static final String versionID
- See Also:
- Constant Field Values
WVS_COPY_FORWARD
public static final String WVS_COPY_FORWARD
- See Also:
- Constant Field Values
wvsProperties
private static WVSProperties wvsProperties
VERBOSE
private static boolean VERBOSE
republishOnEPMDocChange
private static boolean republishOnEPMDocChange
republishOnDocumentChange
private static boolean republishOnDocumentChange
ignoreDefaultEPMEvents
private static boolean ignoreDefaultEPMEvents
ignoreEventConfigSpec
private static boolean ignoreEventConfigSpec
onlyPublishClientSideViewables
private static boolean onlyPublishClientSideViewables
publishDocsOnCheckin
private static boolean publishDocsOnCheckin
publishDocsOnUpload
private static boolean publishDocsOnUpload
publishDocsOnRevise
private static boolean publishDocsOnRevise
markDocsRepOutOfDateOnUpload
private static boolean markDocsRepOutOfDateOnUpload
copyRepresentationsForward
private static boolean copyRepresentationsForward
copyForwardAllRepresentationsOnContainerChange
private static boolean copyForwardAllRepresentationsOnContainerChange
copyForwardAllRepresentationsOnCopy
private static boolean copyForwardAllRepresentationsOnCopy
copyForwardAllRepresentationsOnRevise
private static boolean copyForwardAllRepresentationsOnRevise
copyMarkupsForward
private static boolean copyMarkupsForward
copyRepresentationsForwardRestrict
private static boolean copyRepresentationsForwardRestrict
copyDocumentRepresentationsForward
private static boolean copyDocumentRepresentationsForward
copyDocumentMarkupsForward
private static boolean copyDocumentMarkupsForward
copyViewableMarkupsForward
private static boolean copyViewableMarkupsForward
filterEPMDocumentPublishMethod
private static Method filterEPMDocumentPublishMethod
filterDocumentPublishMethod
private static Method filterDocumentPublishMethod
includeSBInCopyForward
private static boolean includeSBInCopyForward
includeSBInCopyForwardto
private static boolean includeSBInCopyForwardto
StandardPublishService
public StandardPublishService()
getConceptualClassname
public String getConceptualClassname()
- Returns the conceptual (modeled) name for the class.
Supported API: false
- Specified by:
getConceptualClassname
in interface NetFactor
- Overrides:
getConceptualClassname
in class StandardManager
- Returns:
- String
performStartupProcess
protected void performStartupProcess()
throws ManagerException
- Description copied from class:
StandardManager
- Dummy method to be overridden by subclasses. Subclasses should override
this method and provide startup processing.
Supported API: false
- Overrides:
performStartupProcess
in class StandardManager
- Throws:
ManagerException
registerEvents
public void registerEvents(ManagerService managerService)
- Registers Publish service events with the service manager.
Supported API: false
- Specified by:
registerEvents
in interface Manager
- Overrides:
registerEvents
in class StandardManager
- Parameters:
managerService
-
dispatchPublishCompleteEvent
public void dispatchPublishCompleteEvent(Persistable persistable,
boolean success)
throws WTException
- Dispatches a PublishServiceEvent to indicate that publishing in complete
Supported API: false
- Specified by:
dispatchPublishCompleteEvent
in interface PublishService
- Parameters:
persistable
- success
-
- Throws:
WTException
shutdown
public void shutdown()
throws ManagerException
- Description copied from class:
StandardManager
- Manager shutdown operation.
Generally this operation changes the manager status from:
STATUS_STARTED -> STATUS_SHUTTING_DOWN -> STATUS_SHUTDOWN
Template routine for shutting down a service. This method calls the
shuttingDown method which handles generating and synchronously dispatching
an event to all listeners. Listeners may object to the shutdown by
throwing a ManagerException.
This is a template method and should generally not be overridden.
Typically the method performShutdownProcess should be overridden
by subclasses.
Supported API: false
- Specified by:
shutdown
in interface Manager
- Overrides:
shutdown
in class StandardManager
- Throws:
ManagerException
newStandardPublishService
public static StandardPublishService newStandardPublishService()
throws WTException
- Default factory for the class.
- Returns:
- StandardPublishService
- Throws:
WTException
processRepresentationCopyForward
protected void processRepresentationCopyForward(WorkInProgressServiceEvent event)
throws WTException
- Throws:
WTException
processRepresentationCopyForward
protected void processRepresentationCopyForward(PersistenceManagerEvent event)
throws WTException
- Throws:
WTException
processRepresentationCopyForward
protected void processRepresentationCopyForward(EnterpriseServiceEvent event)
throws WTException
- single object verson
protected void processRepresentationCopyForward(PersistenceManagerEvent event) throws WTException
{
Object obj = event.getEventTarget();
if( (obj == null) || !(obj instanceof Representable) || !(obj instanceof Workable) || !(obj instanceof Iterated) ) return;
// only process depending on if Representable is a WTDocument and settings
if( obj instanceof WTDocument ) {
if( !copyDocumentRepresentationsForward ) return;
}
else {
if( !copyRepresentationsForward ) return;
}
boolean access = SessionServerHelper.manager.setAccessEnforced(false);
try {
if(VERBOSE) System.out.println("POST_STORE copy forward event is " + event);
Representable newIteration = (Representable)obj;
// as this is from POST_STORE, if the new iteration is a working copy than we do nothing as
// the POST_CHECKOUT will do the work. POST_STORE gets fired when a new part is created from
// checkout before the link to the original copy is created, and that causes an exception
// in IBAValueUtility
if( WorkInProgressHelper.isWorkingCopy((Workable)newIteration) ) {
if(VERBOSE) System.out.println("ignore POST_STORE as it is a working copy");
}
else {
// get the old iteration
Representable oldIteration = (Representable)VersionControlHelper.service.predecessorOf( (Iterated)newIteration );
boolean performCopy = true;
boolean copyAll = false;
boolean copyAllMarkups = false;
boolean toSandbox = false;
boolean fromSandbox = false;
if( (oldIteration instanceof Versioned) && (newIteration instanceof Versioned) ) {
// if this is a sandbox "checkin" from a project to pdm, then oldItation will be a sandbox working copy
// and the newIteration will not be a sandbox working copy (I suspect it never will at this point in time though)
// to be certain, also check that the newIteration is in a different container to the oldIteration
if( SandboxHelper.service.isWorkingCopy((Versioned)oldIteration) &&
!SandboxHelper.service.isWorkingCopy((Versioned)newIteration) &&
!((WTContained)oldIteration).getContainerReference().equals( ((WTContained)newIteration).getContainerReference() ) ) {
if( includeSBInCopyForward ) {
if(VERBOSE) System.out.println("checkin to pdm from sandbox, ignore POST_STORE");
performCopy = false;
}
else {
if(VERBOSE) System.out.println("checkin to pdm from sandbox, - copy all");
copyAll = true;
copyAllMarkups = true;
fromSandbox = true;
}
}
// if the old and new iterations are in different containers then copy all representations
// depending on property setting
else if( !((WTContained)oldIteration).getContainerReference().equals( ((WTContained)newIteration).getContainerReference() ) ) {
if( includeSBInCopyForwardto ) {
if(VERBOSE) System.out.println("different containers, assume checkout from pdm to sandbox, ignore POST_STORE");
performCopy = false;
}
else {
if(VERBOSE) System.out.println("different containers, - copy all");
if( copyForwardAllRepresentationsOnContainerChange ) copyAll = true;
copyAllMarkups = true; // copy all markups if container changes
toSandbox = true;
}
}
// if this is a revise
else {
String vid = VersionControlHelper.getVersionIdentifier((Versioned)oldIteration).getValue();
if( vid != null && !vid.equals( VersionControlHelper.getVersionIdentifier((Versioned)newIteration).getValue() ) ) {
if( copyForwardAllRepresentationsOnRevise ) copyAll = true;
if(VERBOSE) System.out.println("revise - copyAll=" + copyAll);
}
}
}
if( performCopy && oldIteration != null && newIteration != null ) {
WTValuedMap vm = new WTValuedHashMap(1);
vm.put(oldIteration, newIteration);
processRepresentationCopyForward(vm, copyAll, copyAllMarkups, toSandbox, fromSandbox);
}
}
}
finally {
SessionServerHelper.manager.setAccessEnforced(access);
}
}
- Throws:
WTException
processRepresentationCopyForward
protected void processRepresentationCopyForward(SandboxServiceCheckinEvent event)
throws WTException
- Throws:
WTException
processRepresentationCopyForward
protected void processRepresentationCopyForward(SandboxServiceCheckoutEvent event)
throws WTException
- Throws:
WTException
processRepresentationCopyForward
protected void processRepresentationCopyForward(WTValuedMap fromTo,
boolean forceCopyAll,
boolean includeAllMarkups,
boolean toSandbox,
boolean fromSandbox)
throws WTException
- Throws:
WTException
copyRepresentations
protected WTSet copyRepresentations(Representable oldIteration,
Representable newIteration,
EPMDocument oldDoc,
EPMDocument newDoc,
WTList oldReps,
boolean forceCopyAll,
boolean includeAllMarkups,
WTKeyedMap newRepSavedMap)
throws WTException
- Throws:
WTException
processMarkupCopyForward
protected void processMarkupCopyForward(SessionIterationEvent event)
throws WTException
- SINGLE OBJECT VERSION **********************************
protected void processRepresentationCopyForward(Representable oldIteration, Representable newIteration, boolean forceCopyAll, boolean includeAllMarkups, boolean toSandbox, boolean fromSandbox) throws WTException
{
if( oldIteration == null || newIteration == null ) return;
Representable oldRepresentable = PublishUtils.findRepresentable(oldIteration);
Representable newRepresentable = PublishUtils.findRepresentable(newIteration);
boolean newIterationReset = false;
// if this is an EPMDocument, check that there is no WTPart before continuing
if( oldIteration instanceof EPMDocument ) {
boolean tosandboxcase = false;
if(VERBOSE) System.out.println("EPMDOC OLD REPRESENTABLE IS " + oldRepresentable);
if( !(oldRepresentable instanceof EPMDocument) ) {
// The old EPMDocument has a WTPart, but if the new EPMDocument is in a different container
// to the old EPMDocument, then the new EPMDocument is in the sandbox. If the new
// EPMDocument does not have a WTPart then allow the copy fom the old part to the new
// EPMDocument to take place
if( toSandbox ) {
if(VERBOSE) System.out.println("to sandbox case, old EPMDoc has part and new EPMDoc is in different container");
tosandboxcase = true;
}
else {
if(VERBOSE) System.out.println("ignore Event as it is an EPMDocument with a WTPart");
return;
}
}
// make certain that newIteration does not have a part, and if so make the part
// be the destination for the representations
if(VERBOSE) System.out.println("EPMDOC NEW REPRESENTABLE IS " + newRepresentable);
if( !(newRepresentable instanceof EPMDocument) ) {
if( tosandboxcase ) {
if(VERBOSE) System.out.println("to sandbox case, new EPMDoc has part, so don't copy to new EPMDoc");
return;
}
if(VERBOSE) System.out.println("newIteration reset to Representable of EPMDocument");
newIteration = newRepresentable;
newIterationReset = true;
}
if(tosandboxcase && VERBOSE) System.out.println("to sandbox case, new EPMDoc has no part, so allow copy from old part");
}
// check there are representations on old iteration
QueryResult qr = PublishUtils.getRepresentations( oldRepresentable, false );
if(VERBOSE) System.out.println("oldIteration representation count: " + (qr==null?0:qr.size()));
if( (qr == null || qr.size() == 0) && !fromSandbox ) return;
// check that there are no representations on the new iteration, could be because this
// listener is getting called twice, ie. 2 events.
//QueryResult qr1 = PublishUtils.getRepresentations( newRepresentable, false );
//if(VERBOSE) System.out.println("newIteration representation count: " + (qr1==null?0:qr1.size()));
//if( (qr1 != null && qr1.size() > 0) && !fromSandbox ) return;
// if this is going from a sandbox back to pdm, then need to remove any representations on the newIteration
// if the newIteration has been reset. This is when only the EPMDoc is checked out to the project,
// and on checkin the WTPart in product is iterated (and hence may copt representation forward) before the
// sandbox checkin event. The copied forward representaiton from the part previous iteration in the product
// will stop the representation being copied from the EPMDoc in the project
if( fromSandbox ) {
if(VERBOSE) System.out.println("from sandbox case");
if( newIterationReset ) {
if(VERBOSE) System.out.println("from sandbox case, new iteration has been reset");
// delete existing representations from new iteration, ie the iterated part in product
QueryResult qr1 = PublishUtils.getRepresentations( newRepresentable, false );
if( qr1 != null ) {
while( qr1.hasMoreElements() ) {
Representation repOnNew = (Representation)qr1.nextElement();
if(VERBOSE) System.out.println("from sandbox case, deleting rep " + repOnNew.getName() + " from " + newIteration);
if( repOnNew instanceof DerivedImage ) ViewMarkUpHelper.service.deleteDerivedImage((DerivedImage)repOnNew, true);
}
}
}
else {
if(VERBOSE) System.out.println("from sandbox case, but new iteration was not reset, so do not delete to reps");
}
// now return if there are no representations on the oldIteration (there will not be any on the to now anyway)
if( qr == null || qr.size() == 0 ) return;
}
// get the EPMDocument for the new iteration, if newIteration is not a WTPart will return null
EPMDocument newDoc = PublishUtils.findEPMDocument( newIteration );
EPMDocument oldDoc = PublishUtils.findEPMDocument( oldIteration );
if(VERBOSE) {
System.out.println("Number of Representations " + qr.size());
System.out.println("Copy Forward Representations from " + oldIteration.toString());
System.out.println("Copy Forward Representations to " + newIteration.toString());
System.out.println("forceCopyAll = " + forceCopyAll);
System.out.println("old EPMDoc " + oldDoc);
System.out.println("new EPMDoc " + newDoc);
}
// set the markup copy forward falg basd on if this is a WTDocument or not
boolean copyMkUpForward = copyMarkupsForward;
if( oldIteration instanceof WTDocument ) copyMkUpForward = copyDocumentMarkupsForward;
// if includeAllMarkups is set then we want to copy all markups irrespective of setting, and the
// individual markups copy forward flag
if( includeAllMarkups ) copyMkUpForward = true;
// for each of the Representations on old iteration, decide if it can be copied forward.
// Only consider copy forward if the structure type is EPM or EPM_PLUS_PARTS, which will actually include
// Representations created by the loader, in which case DerivedFrom is null. For EPM derived
// Representations, copy if there is no EPMDoc on the new iteration (eg. new view version), or the EPMDoc on the old
// iteration is not the same EPMDoc as the representation was derived from, ie. the Representation
// got onto the old iteration through copy/paste by the user.
boolean newRepSaved = false, newMarkupSaved = false;
Vector newRepSavedVector = new Vector(5);
Vector newMarkupSavedVector = new Vector(5);
// if newDoc and oldDoc are real EPMDocs and are different, then set flag used to decide if we don't want to
// copy forward. If there are same or either is not specified then we will copy forward
// If the Representable is an EPMDoc then they will always be different
boolean epmDocsDifferent = false;
if( newDoc != null && oldDoc != null ) {
if( ! PersistenceHelper.isEquivalent(oldDoc, newDoc) ) epmDocsDifferent = true;
}
if(VERBOSE) System.out.println("epmDocs different = " + epmDocsDifferent);
while( qr.hasMoreElements() ) {
Representation rep = (Representation)qr.nextElement();
if(VERBOSE) System.out.println("Processing representation " + rep.getName());
if( rep instanceof DerivedImage ) {
DerivedImage di = (DerivedImage)rep;
if( di.getDerivationType().equals( DerivationType.EPM) ||
di.getDerivationType().equals( DerivationType.EPM_PLUS_PARTS) ) {
boolean doCopy = true;
if(VERBOSE) System.out.println("Representation is candidate for copy forward");
ObjectReference derivedFromRef = di.getDerivedFromReference();
Class derivedFromClass = derivedFromRef==null?null:derivedFromRef.getReferencedClass();
if( derivedFromClass != null && !forceCopyAll ) {
if( EPMDocument.class.isAssignableFrom(derivedFromClass) ) {
if(VERBOSE) System.out.println("Representation has a derived from EPMDocument");
// is there an EMPDoc on the new iteration, and the old iteration, and they are different
// then epmDocsDifferent will be true, so cheack derivedForm. Also if
// operating in restricted copy forward mode check and only copy forward
// if derivedFrom is different to oldDoc.
if( epmDocsDifferent || copyRepresentationsForwardRestrict ) {
if(VERBOSE) System.out.println("epmDocs are different, or in restricted copy mode");
// only copy forward, if the derived from is not the EPMDoc on the old
// iteration, ie. the user has done copy/past to put it on old iteration
if( oldDoc != null && derivedFromRef.equals(ObjectReference.newObjectReference(oldDoc)) ) {
if(VERBOSE) System.out.println("Representation failed EPMDocument copy forward test");
doCopy = false;
}
}
}
else if( WTDocument.class.isAssignableFrom(derivedFromClass) ) {
if(VERBOSE) System.out.println("Representation has a derived from WTDocument");
// always copy forward on a WTDocument
}
else if( Representable.class.isAssignableFrom(derivedFromClass) ) {
if(VERBOSE) System.out.println("Representation has a derived from Representable");
// only copy forward, if the derived from is not the old iteration
if( derivedFromRef.equals(ObjectReference.newObjectReference(oldIteration)) ) {
if(VERBOSE) System.out.println("Representation failed Representable copy forward test");
doCopy = false;
}
}
}
if( doCopy ) {
if(VERBOSE) System.out.println("Representation passed copy forward test");
Representation newRep = RepUpdateUtils.copyDerivedImage(di, newIteration, copyMkUpForward, includeAllMarkups, true);
if( newRep != null ) {
newRepSaved = true;
newRepSavedVector.addElement( newRep );
if( copyMkUpForward && (newRep instanceof Viewable) ) {
QueryResult qr2 = ViewMarkUpHelper.service.getMarkUps( (Viewable)newRep );
if( qr2 != null && qr2.size() > 0 ) {
newMarkupSaved = true;
while( qr2.hasMoreElements() ) newMarkupSavedVector.addElement( qr2.nextElement() );
}
}
}
}
}
}
if(VERBOSE) System.out.println("Done representation " + rep.getName());
}
// fire the appropriate event if new representations or markups have been created
if( newRepSaved ) {
EDRHelper.service.dispatchRepresentationSavedEvent( newIteration, newRepSavedVector );
if( newMarkupSaved ) EDRHelper.service.dispatchMarkupSavedEvent( newIteration, newMarkupSavedVector );
}
}
- Throws:
WTException
processMarkupCopyForward
protected void processMarkupCopyForward(WorkInProgressServiceEvent event)
throws WTException
- Throws:
WTException
processMarkupCopyForward
protected void processMarkupCopyForward(PersistenceManagerEvent event)
throws WTException
- Throws:
WTException
processMarkupCopyForward
protected void processMarkupCopyForward(EnterpriseServiceEvent event)
throws WTException
- single object version
protected void processMarkupCopyForward(PersistenceManagerEvent event) throws WTException
{
Object obj = event.getEventTarget();
if( (obj == null) || !(obj instanceof Viewable) || !(obj instanceof Workable) || !(obj instanceof Iterated) ) return;
boolean access = SessionServerHelper.manager.setAccessEnforced(false);
try {
if(VERBOSE) System.out.println("POST_STORE markup copy forward event is " + event);
Viewable newIteration = (Viewable)obj;
// as this is from POST_STORE, if the new iteration is a working copy than we do nothing as
// the POST_CHECKOUT will do the work. POST_STORE gets fired when a new part is created from
// checkout before the link to the original copy is created, and that causes an exception
// in IBAValueUtility
if( WorkInProgressHelper.isWorkingCopy((Workable)newIteration) ) {
if(VERBOSE) System.out.println("ignore POST_STORE as it is a working copy");
}
else {
// get the old iteration
Viewable oldIteration = (Viewable)VersionControlHelper.service.predecessorOf( (Iterated)newIteration );
boolean performCopy = true;
boolean copyAll = false;
if( (oldIteration instanceof Versioned) && (newIteration instanceof Versioned) ) {
// if this is a sandbox "checkin" from a project to pdm, then oldItation will be a sandbox working copy
// and the newIteration will not be a sandbox working copy (I suspect it never will at this point in time though)
// to be certain, also check that the newIteration is in a different container to the oldIteration
if( SandboxHelper.service.isWorkingCopy((Versioned)oldIteration) &&
!SandboxHelper.service.isWorkingCopy((Versioned)newIteration) &&
!((WTContained)oldIteration).getContainerReference().equals( ((WTContained)newIteration).getContainerReference() ) ) {
if( includeSBInCopyForward ) {
if(VERBOSE) System.out.println("checkin to pdm from sandbox, ignore POST_STORE (markup)");
performCopy = false;
}
else {
if(VERBOSE) System.out.println("checkin to pdm from sandbox, - copy all (markup)");
copyAll = true;
}
}
// if the old and new iterations are in different containers then copy all markups
else if( !((WTContained)oldIteration).getContainerReference().equals( ((WTContained)newIteration).getContainerReference() ) ) {
if( includeSBInCopyForwardto ) {
if(VERBOSE) System.out.println("different containers, assume checkout from pdm to sandbox, ignore POST_STORE (markup)");
performCopy = false;
}
else {
if(VERBOSE) System.out.println("different containers, - copy all (markup)");
copyAll = true; // copy all markups if container changes
}
}
}
if( performCopy && oldIteration != null && newIteration != null ) {
WTValuedMap vm = new WTValuedHashMap(1);
vm.put(oldIteration, newIteration);
processMarkupCopyForward(vm, false, copyAll);
}
}
}
finally {
SessionServerHelper.manager.setAccessEnforced(access);
}
}
- Throws:
WTException
processMarkupCopyForward
protected void processMarkupCopyForward(SandboxServiceCheckinEvent event)
throws WTException
- Throws:
WTException
processMarkupCopyForward
protected void processMarkupCopyForward(SandboxServiceCheckoutEvent event)
throws WTException
- Throws:
WTException
processMarkupCopyForward
protected void processMarkupCopyForward(WTValuedMap fromTo,
boolean emitEvent,
boolean allMarkups,
boolean checkContext)
throws WTException
- Throws:
WTException
processRepresentationUpdate
protected void processRepresentationUpdate(KeyedEvent event,
boolean multiObject)
throws Exception
- SINGLE OBJECT VERSION **********************************
protected void processMarkupCopyForward(Viewable oldIteration, Viewable newIteration, boolean emitEvent, boolean allMarkups) throws WTException
{
if( oldIteration == null || newIteration == null ) return;
// get the markups on the old iteration
QueryResult qr1 = ViewMarkUpHelper.service.getMarkUps( oldIteration );
if( qr1 == null || qr1.size() == 0 ) return;
// check that there are not already markups on the new iteration (called twice)
QueryResult qr2 = ViewMarkUpHelper.service.getMarkUps( newIteration );
if( qr2 != null && qr2.size() > 0 ) return;
// copy the markups
RepUpdateUtils.copyAllMarkups(oldIteration, newIteration, allMarkups, true);
if( emitEvent ) {
QueryResult qr3 = ViewMarkUpHelper.service.getMarkUps( newIteration );
if( qr3 != null && qr3.size() > 0 ) {
Vector newMarkupSavedVector = new Vector(5);
while( qr3.hasMoreElements() ) newMarkupSavedVector.addElement( qr3.nextElement() );
EDRHelper.service.dispatchMarkupSavedEvent( newIteration, newMarkupSavedVector );
}
}
}
- Throws:
Exception
processRepresentationUpdateForTargets
protected void processRepresentationUpdateForTargets(WTCollection target)
throws Exception
- Throws:
Exception
processDocumentCheckInEvent
protected void processDocumentCheckInEvent(WTDocument doc,
ContentItem ci)
throws Exception
- Throws:
Exception
processDocumentCheckInFile
protected boolean processDocumentCheckInFile(WTDocument doc,
ContentItem ci,
boolean repDefault)
throws Exception
- Throws:
Exception
processCheckInEvent
protected void processCheckInEvent(Vector objects,
ConfigSpec configSpec)
throws Exception
- Throws:
Exception
testEPMCheckinFilter
public static Boolean testEPMCheckinFilter(EPMDocument epmdoc)
testDocumentCheckinFilter
public static Boolean testDocumentCheckinFilter(WTDocument doc,
ApplicationData ad)