Skip to main content
1-Visitor
Nov 10, 2010 5:05 PM UTC
Question

How to Update the Lifecycle State of Resulting objects from a Change Notice

I am attempting to set the Lifecycle State of the Resulting (Document) Objects from within the Change Notice Workflow, the following code fails a Syntax Check (at LINE 1 below). Any ideas how to correct this and get this working ?

//Find Resulting Objects and set State to Under Review

wt.change2.ChangeOrder2 pbo = (wt.change2.ChangeOrder2) primaryBusinessObject;
wt.fc.QueryResult activities = wt.change2.ChangeHelper2.service.getChangeActivities(pbo);
while (activities.hasMoreElements()) {
wt.change2.ChangeActivity2 activity = (wt.change2.ChangeActivity2) activities.nextElement();
System.out.println("IDW 1 task " + activity.getDisplayIdentity().getLocalizedMessage(java.util.Locale.ENGLISH));
wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter(activity);
while (resulting.hasMoreElements()) {
// set State for each Document
wt.fc.Persistable persistable = (wt.fc.Persistable)resulting.nextElement();
if (persistable instanceof wt.doc.WTDocument){
wt.doc.WTDocument docAff = (wt.doc.WTDocument)persistable;
State state = toState("UNDERREVIEW"); //LINE 1

docAff.setLifeCycleState(state);

wt.doc.WTDocumentMaster dmaster = (wt.doc.WTDocumentMaster) docAff.getMaster();
String affName = dmaster.getName();
System.out.println("IDW 2 Affected Doc: " + affName);
}
}
}

3 replies

1-Visitor
Nov 10, 2010 5:27 PM UTC
Try the following:

wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter( (wt.change2.ChangeOrderIfc) primaryBusinessObject);
while(resulting.hasMoreElements())
{
wt.fc.Persistable persistable = (wt.fc.Persistable)resulting.nextElement();
if (persistable instanceof wt.doc.WTDocument)
{
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(((wt.lifecycle.LifeCycleManaged)resulting.nextElement()),wt.lifecycle.State.toState("UNDERREVIEW"),true);
wt.doc.WTDocument docAff = (wt.doc.WTDocument)persistable;
wt.doc.WTDocumentMaster dmaster = (wt.doc.WTDocumentMaster) docAff.getMaster();
String affName = dmaster.getName();
System.out.println("IDW 2 Affected Doc: " + affName);
}
}

Thanks,
Dax
Translate
1-Visitor
Nov 10, 2010 5:36 PM UTC
State state = toState("UNDERREVIEW");

Should be

State state = State.toState("UNDERREVIEW");

-Thomas R. Busch
Sr. Software Developer
Stryker Instruments
(269) 323-7700 x4014
tom.busch@stryker.com<">mailto:tom.busch@stryker.com>
Translate
1-Visitor
Nov 10, 2010 5:51 PM UTC
Ahhh by the way you might have to fully qualify it:

wt.lifecycle.State state = wt.lifecycle.State.toState("UNDERREVIEW");

-Thomas R. Busch
Sr. Software Developer
Stryker Instruments
(269) 323-7700 x4014
tom.busch@stryker.com<">mailto:tom.busch@stryker.com>
Translate