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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Translate the entire conversation x

Custom promotion with Design Check Loop before Approval - Code Error

SteveVinyard
1-Visitor

Custom promotion with Design Check Loop before Approval - Code Error

Hello everyone, I am putting together a custom workflow that is very basic. It's the same as the standard Promotion Workflow except that it has design check loop in it where it send the objects back and forth from design check and to the engineer...finally once approval is done it sends it away from Approval.


Now this is impossible with the standard workflow (plus a loop) as the Workflow does not pick up the new changes that were made to the CAD files during the Design Check loop. It only promotes and includes the EXACT objects (down to the iteration ie. A.1).


I've got some java expressions to have the promotion workflow check if the objects its promoting are the latest iteration of that model. If not then it goes and grabs them and puts them on the Promotion Request and they will be promoted.

I'm very close but I get a java error in my code and need some assistance. I've also attached the Workflow. Note that all custom expressions are contained in the first "conditional" node underneath the "Accepted" portion. Here is the error and the code below. I know it's just a "missing semi-colon" but I can't figure it out as it seems like everything is OK.
THANKS!


ERROR:
D:\ptc\Windchill\temp\WfExpression24296.java:54: ';' expected
WTPart latestPart = (wt.part.WTPart) VersionControlHelper.service.getLatestIteration(wt.part.WTPart, false) wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(wt.part.WTPart, wt.lifecycle.State.toState(INWORK));


CODE:
wt.fc.QueryResult qr = wt.fc.PersistenceServerHelper.expand(primaryBusinessObject, wt.maturity.PromotionTarget.PROMOTABLE_ROLE, wt.maturity.PromotionTarget.class, false);


wt.fc.collections.WTSet promotionTargets = new wt.fc.collections.WTHashSet(qr.size());
promotionTargets.addAll(qr);
java.util.Iterator i = promotionTargets.persistableIterator();

while (i.hasNext()) {

wt.maturity.PromotionTarget theTarget = (wt.maturity.PromotionTarget)i.next();
WTPart latestPart = (WTPart) VersionControlHelper.service.getLatestIteration(WTPart, false) wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(WTPart, wt.lifecycle.State.toState(INWORK));

}

14 REPLIES 14

This email contained a .zip file attachment. Raytheon does not allow email attachments that are considered likely to contain malicious code. For your protection this attachment has been removed.

If this email is from an unknown source, please simply delete this email.

If this email was expected, and it is from a known sender, you may follow the below suggested instructions to obtain these types of attachments.

+ Instruct the sender to enclose the file(s) in a ".zip" compressed file, and rename the ".zip" compressed file with a different extension, such as, ".rtnzip". Password protecting the renamed ".zip" compressed file adds an additional layer of protection. When you receive the file, please rename it with the extension ".zip".

Additional instructions and options on how to receive these attachments can be found at:


underneath the "Accepted" portion. Here is the error and the code below. I know it's just a "missing semi-colon" but I can't figure it out as it seems like everything is OK.THANKS!ERROR:D:\ptc\Windchill\temp\WfExpression24296.java:54: ';' expectedWTPart latestPart = (wt.part.WTPart) VersionControlH...


There is a semicolon missing in the code
*
*
*CODE:* wt.fc.QueryResult qr =
wt.fc.PersistenceServerHelper.expand(primaryBusinessObject,
wt.maturity.PromotionTarget.PROMOTABLE_ROLE,
wt.maturity.PromotionTarget.class, false); wt.fc.collections.WTSet
promotionTargets = new wt.fc.collections.WTHashSet(qr.size());
promotionTargets.addAll(qr); java.util.Iterator i =
promotionTargets.persistableIterator(); while (i.hasNext()) {
wt.maturity.PromotionTarget theTarget =
(wt.maturity.PromotionTarget)i.next(); WTPart latestPart = (WTPart)
VersionControlHelper.service.getLatestIteration(WTPart, false)
*;*wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(WTPart,
wt.lifecycle.State.toState(INWORK)); }

On Fri, May 14, 2010 at 11:48 AM, Steve Vinyard
<->wrote:

> *Hello everyone*, I am putting together a custom workflow that is very
> basic. It's the same as the standard Promotion Workflow except that it has
> design check loop in it where it send the objects back and forth from design
> check and to the engineer...finally once approval is done it sends it away
> from Approval.
>
> Now this is impossible with the standard workflow (plus a loop) as the
> Workflow does not pick up the new changes that were made to the CAD files
> during the Design Check loop. It only promotes and includes the EXACT
> objects (down to the iteration ie. A.1).
>
> I've got some java expressions to have the promotion workflow check if the
> objects its promoting are the latest iteration of that model. If not then it
> goes and grabs them and puts them on the Promotion Request and they will be
> promoted. I'm very close but I get a java error in my code and need some
> assistance. I've also attached the Workflow. Note that all custom
> expressions are contained in the first "conditional" node underneath the
> "Accepted" portion. Here is the error and the code below. I know it's just a
> "missing semi-colon" but I can't figure it out as it seems like everything
> is OK. THANKS!
>
> *ERROR:* D:\ptc\Windchill\temp\WfExpression24296.java:54: ';' expected
> WTPart latestPart = (wt.part.WTPart)
> VersionControlHelper.service.getLatestIteration(wt.part.WTPart, false)
> wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(wt.part.WTPart,
> wt.lifecycle.State.toState(INWORK));
>
> *CODE:* wt.fc.QueryResult qr =
> wt.fc.PersistenceServerHelper.expand(primaryBusinessObject,
> wt.maturity.PromotionTarget.PROMOTABLE_ROLE,
> wt.maturity.PromotionTarget.class, false); wt.fc.collections.WTSet
> promotionTargets = new wt.fc.collections.WTHashSet(qr.size());
> promotionTargets.addAll(qr); java.util.Iterator i =
> promotionTargets.persistableIterator(); while (i.hasNext()) {
> wt.maturity.PromotionTarget theTarget =
> (wt.maturity.PromotionTarget)i.next(); WTPart latestPart = (WTPart)
> VersionControlHelper.service.getLatestIteration(WTPart, false)
> wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(WTPart,
> wt.lifecycle.State.toState(INWORK)); }

This email contained a .zip file attachment. Raytheon does not allow email attachments that are considered likely to contain malicious code. For your protection this attachment has been removed.

If this email is from an unknown source, please simply delete this email.

If this email was expected, and it is from a known sender, you may follow the below suggested instructions to obtain these types of attachments.

+ Instruct the sender to enclose the file(s) in a ".zip" compressed file, and rename the ".zip" compressed file with a different extension, such as, ".rtnzip". Password protecting the renamed ".zip" compressed file adds an additional layer of protection. When you receive the file, please rename it with the extension ".zip".

Additional instructions and options on how to receive these attachments can be found at:


underneath the "Accepted" portion. Here is the error and the code below. I know it's just a "missing semi-colon" but I can't figure it out as it seems like everything is OK.THANKS!ERROR:D:\ptc\Windchill\temp\WfExpression24296.java:54: ';' expectedWTPart latestPart = (wt.part.WTPart) VersionControlH...


This email contained a .zip file attachment. Raytheon does not allow email attachments that are considered likely to contain malicious code. For your protection this attachment has been removed.

If this email is from an unknown source, please simply delete this email.

If this email was expected, and it is from a known sender, you may follow the below suggested instructions to obtain these types of attachments.

+ Instruct the sender to enclose the file(s) in a ".zip" compressed file, and rename the ".zip" compressed file with a different extension, such as, ".rtnzip". Password protecting the renamed ".zip" compressed file adds an additional layer of protection. When you receive the file, please rename it with the extension ".zip".

Additional instructions and options on how to receive these attachments can be found at:


underneath the "Accepted" portion. Here is the error and the code below. I know it's just a "missing semi-colon" but I can't figure it out as it seems like everything is OK.THANKS!ERROR:D:\ptc\Windchill\temp\WfExpression24296.java:54: ';' expectedWTPart latestPart = (wt.part.WTPart) VersionControlH...


As of 9.1 M050 (i believe) there are additional helper classes that will
do this. You will need to call the methods.

Jeff Zemsky helped us get these created for 9.0 and they have now been
bundled in the codebase.

Steve D.

> Hello everyone, I am putting together a custom workflow that is very
> basic. It's the same as the standard Promotion Workflow except that it
> has design check loop in it where it send the objects back and forth from
> design check and to the engineer...finally once approval is done it sends
> it away from Approval.Now this is impossible with the standard workflow
> (plus a loop) as the Workflow does not pick up the new changes that were
> made to the CAD files during the Design Check loop. It only promotes and
> includes the EXACT objects (down to the iteration ie. A.1).I've got some
> java expressions to have the promotion workflow check if the objects its
> promoting are the latest iteration of that model. If not then it goes and
> grabs them and puts them on the Promotion Request and they will be
> promoted.I'm very close but I get a java error in my code and need some
> assistance. I've also attached the Workflow. Note that all custom
> expressions are contained in the first "conditional" node
> underneath the "Accepted" portion. Here is the error and the code below.
> I know it's just a "missing semi-colon" but I can't figure it out as it
> seems like everything is
> OK.THANKS!ERROR:D:\ptc\Windchill\temp\WfExpression24296.java:54: ';'
> expectedWTPart latestPart = (wt.part.WTPart)
> VersionControlHelper.service.getLatestIteration(wt.part.WTPart, false)
> wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(wt.part.WTPart,
> wt.lifecycle.State.toState(INWORK));CODE:wt.fc.QueryResult qr =
> wt.fc.PersistenceServerHelper.expand(primaryBusinessObject,
> wt.maturity.PromotionTarget.PROMOTABLE_ROLE,
> wt.maturity.PromotionTarget.class, false);wt.fc.collections.WTSet
> promotionTargets = new
> wt.fc.collections.WTHashSet(qr.size());promotionTargets.addAll(qr);java.util.Iterator
> i = promotionTargets.persistableIterator();while (i.hasNext())
> {wt.maturity.PromotionTarget theTarget =
> (wt.maturity.PromotionTarget)i.next();WTPart latestPart = (WTPart)
> VersionControlHelper.service.getLatestIteration(
> WTPart, false)
> wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(WTPart,
> wt.lifecycle.State.toState(INWORK));}
>

Interesting, and thanks. Hi Jeff, can you pass along any information related to this promotion request? I may have some of those helpers already in here, I got most of it from Tech Support. Jeff if you have a workflow that already does this and PTC is ok with you releasing it I'd be interested in taking a look and modifying it to meet my needs.

Some day Windchill needs to have an "App Store" with all of these customizations in it 🙂

Steve Vinyard
Application Engineer

The Resulting Objects table of a Change Task points to and changes the state of the latest Iteration OTB...
One reason to use exclusively the Change process rather than Promotion.

The following is what you need to add to your code. Add this before the
actual promote step of the workflow or potentially during the review -
see attached image for an example workflow concept

<<picture (device=" independent=" bitmap)=">>

Add the following code to the expression robot to call the update method
:

com.ptc.windchill.enterprise.maturity.PromotionNoticeWorkflowHelper
helper = new
com.ptc.windchill.enterprise.maturity.PromotionNoticeWorkflowHelper((wt.
maturity.PromotionNotice)primaryBusinessObject, false);

helper.updateWithLatestIterations();

Note : Replace 'false' with 'true' to test the scenario where you need
to update only the promotion targets in the baseline and seeds. 'false'
would imply update ALL - i.e update with latest iterations for
promotion targets, baselineables in the baseline and the promotion
seeds.

Also you will need to click the button "Check Syntax" on the expression
code popup to compile the above code.

Works! Thanks everyone! This really is an easy fix and certainly makes the promotion workflows much more functional.

You the man Jeff,
Thanks

Steve Vinyard
Application Engineer

[cid:image001.gif@01CAF375.E2D6C690]


I am following these instructions but when I check syntax I get this error:

/apps/mda/ptc/windchill9/windchill/tmp/WfExpression101208138.java:36: cannot find symbol
symbol : class PromotionNoticeWorkflowHelper
location: package com.ptc.windchill.enterprise.maturity
com.ptc.windchill.enterprise.maturity.PromotionNoticeWorkflowHelper((wt.maturity.PromotionNotice)primaryBusinessObject, false);

Could anyone provide some information on what I am doing wrong?

Thank you!

Hi Joy,

I think you are missing method in your syntax.

com.ptc.windchill.enterprise.maturity.PromotionNoticeWorkflowHelper.
doSomething((wt.maturity.PromotionNotice)primaryBusinessObject, false);


*Thank you*
*Sudeep Bhattarai*
*Principal Solutions Architect*
*NajaNaja Ltd*
*847-220-7008*
*


Hi Sudeep,

I ran a windchill shell and it says resource not found for this class.

Is the class not available in 9.1. M040?


This class does NOT appear to be in 9.1 M040 and I have never heard of it or
had a need to use it.



I did not load Rational Rose, but did load every jar and class file under
codebase into Eclipse from 9.1 M040. Only closest named class in that java
package is PromotionPreferenceHelper



It almost sounds like a custom class someone wrote and added as a solution
in this earlier email thread w/o actually providing the source code.



HTH,

Dave






This is ootb in 9.1 m050



On Jun 8, 2010, at 10:15 PM, David DeMay <-
Announcements

Top Tags