cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

code to check Revision of Promoted object

vmcdaniel
2-Guest

code to check Revision of Promoted object

Hi All,

Can anyone share the java logic for capturing the revision of the promotable? (part/epm/doc)
I want to check they are Revision 'A' in an initial condition in the workflow.

Thanks!
Vaughn

1 REPLY 1

Vaughn,


Below is the sample code. Check if work for you



private static void revise(PromotionNotice pn) {


//wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice)primaryBusinessObject;




try {


wt.fc.QueryResult qr = wt.maturity.MaturityHelper.service.getPromotionTargets(pn);


while(qr.hasMoreElements()) {


// For all promotables


Object obj = qr.nextElement();


if (obj instanceof wt.lifecycle.LifeCycleManaged) {


// Get revision, and check if revision is not numeric


wt.enterprise.RevisionControlled rc = (wt.enterprise.RevisionControlled)obj;


String version = rc.getIterationDisplayIdentifier().toString();



System.out.println("+version);


//if (version equal to A)


//Do Something like


// else


// do Something



}


else {


System.out.println("No Lifecycle Managed object found!");


}


}


} catch (wt.maturity.MaturityException me) {


me.printStackTrace();


} catch (wt.util.WTException wte) {


wte.printStackTrace();


}


// END


}




Hope this helps !!!



Thanks,


Shreyas

Announcements


Top Tags