A quick tutorial for middleware products

  • WeblogicArch

  • J2EEArch

  • FussionArch

Monday, September 4, 2017

On September 04, 2017 by Kamlesh   No comments

Creating My First Process Extension

while developing PX for Agile PLM, the most important part is project structure.
  1. Create a Java Project in Eclipse
  2. Under source folder add META-INF folder
  3. Create services folder under META-INF
  4. Create com.agile.px.ICustomAction file in services folder
So the project structure should be like :
Project
    =>src
         =>com.first.px
              =>HelloWorld.java
         =>META-INF
              =>services
                   =>com.agile.px.ICustomAction






What does com.agile.px.ICustomAction:

This file contains the full name of the PX class, when we say full name it means name of the class along with package. In our case this file will contain 
com.first.px.HelloWorld
Note: In this file we dont need to specify .class or .java extension

Why this structure:

This structure is important because when we deploy our jar in extensions folder, Agile PLM reads the structure and gets the PX class name from META-INF->services->com.agile.px.ICustomAction file. If we miss this structure PX framework will not be able to read it.

Code:

Every PX needs to implement ICustomAction Interface in order to recognized as PX in Agile PLM. The only method that needs to override/impelent is doAction. This method will provide our process extension following from PX framework.
  1. Session
  2. node
  3. IDataObject which is current business object like Part, Document, change etc
here is a demo code that can be used to create a hello world PX
package com.first.px;
import com.agile.api.APIException;
import com.agile.api.IAgileSession;
import com.agile.api.IDataObject;
import com.agile.api.INode;
import com.agile.px.ActionResult;
import com.agile.px.ICustomAction;
public class HelloWorld implements ICustomAction {
@Override
public ActionResult doAction(IAgileSession session, INode arg1,IDataObject object) {
String objectName="";
try {
objectName= object.getName();
} catch (APIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// TODO Auto-generated method stub
return new ActionResult(ActionResult.STRING, objectName);
}
}

Note: Please add AgileAPI.jar in your project class path in order to compile your PX.