Agile Process Extensions        (Agile PX)     Demoting a Change Order
Introduction/Background I was reviewing the Agile PLM SDK group in LinkedIn Someone was having an issue with obsolete pa...
Agile PLM Change OrderAgile PLM Change Order containing part 140002 (not obsolete) and its BOM.
Agile PLM PartHere is the title page of the item (140001) that was on the BOM of theaffected item (140002)
Problem DecompositionHere is the functional decomposition of what needs to happen in the AgilePLM process extension (PX) t...
End ResultsHere is the aftermath the process extension fires
Source Code                                               (page 1)package com.vestalsgap.px;import com.agile.api.*;import ...
Source Code                                               (page 2)try {        ITable affectedItems = change.getTable(Chan...
Source Code                                                 (page 3)private void demote(IChange change, String reason) thr...
Source Code                                                 (page 4)private boolean hasValidBOM(IItem parent) throws Excep...
About Us PLM Mechanic specializes in the technical  aspects of Oracle’s Agile PLM solution We offer the following servic...
Contact Us   Web: http://www.plmmechanic.com   Blog: http://www.plmmechanic.com/blog   Email: sales@plmmechanic.com   ...
Upcoming SlideShare
Loading in …5
×

Agile PX - Demoting a Change Order

948 views

Published on

I often go through the Agile PLM SDK group in LinkedIn. On a recent visit, someone was having an issue with obsolete parts showing on the BOM of an item on a change order. To be clear, the issue is not that parts on the change were obsolete, it is that parts on the BOM of the affected items of a change were obsolete. A process extension (PX) was proposed by another group member to remedy this business rule. This blog illustrates the implementation of that process extension.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
948
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
22
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Title: Agile Process Extensions - (Agile PX)Subtitle: Demoting a Change Order
  • Introduction/BackgroundI was reviewing the Agile PLM SDK group in LinkedInSomeone was having an issue with obsolete parts showing on the BOM of an item on a change orderThe issue is not that parts on the change were obsolete, it is that parts on the BOM of the affected items of a change were obsoleteA process extension (PX) was proposed by another group member to remedy this business ruleThis presentation illustrates the implementation of that process extension.
  • This is a picture of the Agile PLM Change Order containing part 140002 (not obsolete) and its BOM.
  • Here is a picture of the title page of the item (140001) that was on the BOM of the affected item (140002)
  • Here is the functional decomposition of what needs to happen in the Agile PLM process extension (PX) to get the desired results:Pull the affected items table for the change order passed into the process extensionFor each item on the changeGet the underlying Agile item from the referenced affected itemGet the BOM of the affected itemLook at the title page lifecycle attribute for each item on the BOMIf we find an obsolete part, we need to demoteIf we need to demoteGet the workflow status’Make sure we are not at the beginning of the workflow – if we are, do nothingDemote to the prior workflow state and add a history item
  • Here is the aftermath the process extension fires
  • 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; }}
  • 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
  • Contact UsWeb: http://www.plmmechanic.comBlog: http://www.plmmechanic.com/blogEmail: sales@plmmechanic.comPhone: 512-827-2262 Fax: 512-582-2932
  • Agile PX - Demoting a Change Order

    1. 1. Agile Process Extensions (Agile PX) Demoting a Change Order
    2. 2. Introduction/Background I was reviewing the Agile PLM SDK group in LinkedIn Someone was having an issue with obsolete parts showing on the BOM of an item on a change order The issue is not that parts on the change were obsolete, it is that parts on the BOM of the affected items of a change were obsolete A process extension (PX) was proposed by another group member to remedy this business rule This presentation illustrates the implementation of that process extension.
    3. 3. Agile PLM Change OrderAgile PLM Change Order containing part 140002 (not obsolete) and its BOM.
    4. 4. Agile PLM PartHere is the title page of the item (140001) that was on the BOM of theaffected item (140002)
    5. 5. Problem DecompositionHere is the functional decomposition of what needs to happen in the AgilePLM process extension (PX) to get the desired results: Pull the affected items table for the change order passed into the process extension – For each item on the change • Get the underlying Agile item from the referenced affected item – Get the BOM of the affected item » Look at the title page lifecycle attribute for each item on the BOM • If we find an obsolete part, we need to demote If we need to demote – Get the workflow status’ – Make sure we are not at the beginning of the workflow – if we are, do nothing – Demote to the prior workflow state and add a history item
    6. 6. End ResultsHere is the aftermath the process extension fires
    7. 7. Source Code (page 1)package 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 ActionResult doAction(IAgileSession session, INode actionNode, IDataObject affectedObject) { // only process change orders ActionResult outcome = new ActionResult(); if ( !(affectedObject instanceof IChange) ) return outcome; IChange change = (IChange) affectedObject;
    8. 8. Source Code (page 2)try { ITable affectedItems = change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS); Iterator<IRow> rows = affectedItems.iterator(); IRow row; IItem affectedItem = 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 (Throwable th) { logger.error("Error: " + th.getMessage()); return new ActionResult(ActionResult.EXCEPTION, th); } }
    9. 9. Source Code (page 3)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 (int i=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); }
    10. 10. Source Code (page 4)private boolean hasValidBOM(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; }}
    11. 11. 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
    12. 12. Contact Us Web: http://www.plmmechanic.com Blog: http://www.plmmechanic.com/blog Email: sales@plmmechanic.com Phone: 512-827-2262 Fax: 512-582-2932

    ×