In my last blog article, Process Extension Development – Demoting a Change Order, I offered some source code that demotes a change order when one of the affected items on the change has an obsolete item on its BOM. There were a few follow up posts in the LinkedIn discussion about how to create a process extension, also called a PX. This blog will help outline the steps to package the source code, create the ICustomAction and configure Agile PLM to trigger the process extension (PX) on the submitted workflow step.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Agile PX - Creating an Agile PLM Process Extension
1. Creating an Agile PLM
Process Extension
Agile Process Extensions
(Agile PX)
2. Introduction/Background
In my last blog article, Process Extension Development
– Demoting a Change Order, I offered some source
code that demotes a change order when one of the
affected items on the change has an obsolete item on
its BOM
There were a few follow up posts in the LinkedIn
discussion about how to create a process extension,
also called a PX.
This will help outline the steps to package the source
code, create the ICustomAction and configure Agile
PLM to trigger the process extension (PX) on the
submitted workflow step.
3. Creating the Process Extension (PX)
A process extension is really nothing more than a Java archive file, or JAR
file. Here is the internal structure of the file:
+---com
¦ +---vestalsgap
¦ AbstractPX.class
¦ EcoDemoter.class
+---META-INF
+---services
com.agile.px.ICustomAction
Now that we have a sample structure, we can inspect all of the paths and
files that make it up.
4. Creating the Process Extension (PX) (cont)
META-INF/services/com.agile.px.ICustomAction - Process extensions are
required to have a com.agile.px.ICustomAction file. This file contains the
name of the PX classes in the JAR that are eligible to provide actions inside
of Agile. Later you will see why this file is so important. In our example
above, the file would contain com.vestalsgap.EcoDemoter. It is not
necessary to use the .class extension but it is important to make sure the
class package name is correct
com/vestalsgap/*.class – These are the Java classes that give my process
extension its functionality. I typically use (and reuse) the same Abstract
class that can pull from configuration files and provide logging
capability. The file mentioned in the ICustomAction does need to inherit
or implement the doAction method!
With the JAR file complete, we are ready to deploy it.
5. Deploying the Process Extension on
the Agile Server
The next step in this extension’s journey is to be copied on the
file system of the Agile PLM application server. Copy the
extension to AGILE_HOME/Agile931/integration/sdk/extensions
6. Adding the Process Extension (PX) to
Agile PLM
To add the process extension to Agile PLM
1. Launch the Java Client: http://server:port/JavaClient/start.html
2. Log in as an administrator
3. Navigate to Admin Tab | Settings | Data Settings | Process Extensions
4. Click New
5. Fill out the popup form.
6. Click OK
7. An edit screen will appear with all of your values in it, click close
8. Next go to the workflow you would like to edit and open it
9. Click the status tab
10. Highlight the workflow step you would like to add the extension on
11. Double click the desired row of the criteria section of the screen
12. Select the process extension
13. Click save
9. Conclusion
Your extension is now set up in Agile. It is very
easy to deploy custom process extensions
allowing you to customize your Agile PLM
installation so that it will adapt to your business
needs!
10. About Us
PLM Mechanic specializes in the technical
aspects of Oracle’s Agile PLM solution
We offer the following service:
– Agile PLM installations and upgrades
– Agile PLM maintenance and help desk functions
– Agile PLM hosting
– Customization
PLM Mechanic also has several product
offerings
Title: Agile Process Extensions - (Agile PX)Subtitle: Creating an Agile PLM Process Extension
Introduction/BackgroundIn my last blog article, Process Extension Development – Demoting a Change Order, I offered some source code that demotes a change order when one of the affected items on the change has an obsolete item on its BOM. There were a few follow up posts in the LinkedIn discussion about how to create a process extension, also called a PX. This blog will help outline the steps to package the source code, create the ICustomAction and configure Agile PLM to trigger the process extension (PX) on the submitted workflow step.
Creating the Process Extension (PX)A process extension is really nothing more than a Java archive file, or JAR file. Here is the internal structure of the file:+---com¦ +---vestalsgap¦ AbstractPX.class¦ EcoDemoter.class+---META-INF +---services com.agile.px.ICustomActionNow that we have a sample structure, we can inspect all of the paths and files that make it up.
Creating the Process Extension (PX) (cont)META-INF/services/com.agile.px.ICustomAction - Process extensions are required to have a com.agile.px.ICustomAction file. This file contains the name of the PX classes in the JAR that are eligible to provide actions inside of Agile. Later you will see why this file is so important. In our example above, the file would contain com.vestalsgap.EcoDemoter. It is not necessary to use the .class extension but it is important to make sure the class package name is correctcom/vestalsgap/*.class – These are the Java classes that give my process extension its functionality. I typically use (and reuse) the same Abstract class that can pull from configuration files and provide logging capability. The file mentioned in the ICustomAction does need to inherit or implement the doAction method!With the JAR file complete, we are ready to deploy it.
Deploying the Process Extension on the Agile ServerThe next step in this extension’s journey is to be copied on the file system of the Agile PLM application server. Copy the extension to AGILE_HOME/Agile931/integration/sdk/extensionsWith the JAR file deployed in the extensions directory, we are now ready to configure Agile PLM.
Adding the Process Extension (PX) to Agile PLMTo add the process extension to Agile PLMLaunch the Java Client: http://server:port/JavaClient/start.htmlLog in as an administratorNavigate to Admin Tab | Settings | Data Settings | Process ExtensionsClick NewFill out the popup form.Click OKAn edit screen will appear with all of your values in it, click closeNext go to the workflow you would like to edit and open itClick the status tabHighlight the workflow step you would like to add the extension onDouble click the desired row of the criteria section of the screenSelect the process extensionClick save
Source Code for the process extensionpackage com.vestalsgap.px;import com.agile.api.*;import com.agile.px.ActionResult;import java.util.*;import org.apache.log4j.Logger;public class EcoDemoter extends AbstractPX { /* * Process Extension Functionality * * Configure a Process Extension which can run on workflow change status to get Items on * Change Order and check all of its BOM for Obselete part if its failing, Dont release the * Change Order. * */ // consider a history message that mentions the actual affected items that are in violation // and a format string read from configuration rather than hard coded - this is only an example String history = "The change order was demoted because the BOM of one or more affected items contained an obsolete item"; // again this should be a configuration setting String invalidLifecycles = ",Obsolete,"; public ActionResultdoAction(IAgileSession session, INodeactionNode, IDataObjectaffectedObject) { // only process change ordersActionResult outcome = new ActionResult(); if ( !(affectedObjectinstanceofIChange) ) return outcome; IChange change = (IChange) affectedObject; try {ITableaffectedItems = change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS); Iterator<IRow> rows = affectedItems.iterator();IRow row;IItemaffectedItem = null; while(rows.hasNext()) { // get the affected item row = (IRow) (rows.next());affectedItem = (IItem) row.getReferent(); if ( !hasValidBOM(affectedItem) ) { outcome = new ActionResult(ActionResult.STRING, history); demote(change, history); break; } } return outcome; } catch (Throwableth) {logger.error("Error: " + th.getMessage()); return new ActionResult(ActionResult.EXCEPTION, th); } } private void demote(IChange change, String reason) throws Exception {IStatus[] states = change.getWorkflow().getStates();IStatus status = change.getStatus(); // a change cannot be demoted if it is already at the beginning of the workflow if (states[0] == status) { logger.info(change.getName() + " is already at the first workflow step ... cannot demote."); return; } for (inti=0; i<states.length; i++) { if (states[i] == status && i>0) { status = states[i-1]; break; } } Object[] approvers = change.getApproversEx(status); Object[] observers = change.getObserversEx(status);change.changeStatus(status, false, reason, true, false, new IUser[0], approvers, observers, false); } private booleanhasValidBOM(IItem parent) throws Exception {ITable items = parent.getTable(ItemConstants.TABLE_BOM); Iterator<IRow> rows = items.iterator();IRow row; String lifecycle = "";IItem item; while(rows.hasNext()) { row = rows.next(); // This should be a configuration parameter to check against a list of phases lifecycle = row.getReferent().getValue(ItemConstants.ATT_TITLE_BLOCK_LIFECYCLE_PHASE).toString(); if (lifecycle != null && invalidLifecycles.indexOf(lifecycle) > -1) return false; } return true; }}
ConclusionYour extension is now set up in Agile. It is very easy to deploy custom process extensions allowing you to customize your Agile PLM installation so that it will adapt to your business needs!
About UsPLM Mechanic specializes in the technical aspects of Oracle’s Agile PLM solutionWe offer the following service:Agile PLM installations and upgradesAgile PLM maintenance and help desk functionsAgile PLM hostingCustomizationPLM Mechanic also has several product offerings