
You can create processes using the GP design time API. The interface allows you to manipulate the process structure and properties.
You have instantiated the IGPDesigntimeUpdateManager. For more information, see Instantiating the Design Time Manager .
You need to specify a category for the newly-created process. For this purpose, you can create a new category or provide the Id of an existing one.
| Creating a Process |
|---|
importjava.util.Locale; importcom.sap.caf.eu.gp.context.api.IGPUserContext; importcom.sap.caf.eu.gp.process.api.IGPCategory; importcom.sap.caf.eu.gp.process.api.IGPModifiableProcess; importcom.sap.caf.eu.gp.process.api.GPProcessFactory; importcom.sap.caf.eu.gp.process.dt.api.IGPDesigntimeManager; importcom.sap.caf.eu.gp.process.dt.api.IGPDesigntimeUpdateManager; // instantiate the design time manager to get the root category IGPDesigntimeManagerdtManager = GPProcessFactory.getDesigntimeManager(); IGPCategoryroot = dtManager.getRootCategory(userContext); // create a new category "test" in the root category IGPCategory cat = manager.createCategory("test","A test category", root);// create a process in the cat category StringpName ="Test API Process"; StringpDescription ="Test API Process Description"; IGPModifiableProcessprocess=manager.createProcess( Locale.getDefault(), pName, pDescription, cat.getID() ); |
The process content is represented by a structure (IGPModifiableBlockStructure). It is an indexed sequence of items (IGPModifiableBlockStructureItem), which hold object references to activities within the process.
Process structure items also hold information about parameter mappings, transitions between activities, exception handling and role information.
The GP design time API provides the following functionalities for process structure manipulation:
Since the process itself is a top-level block, the operations listed above are equivalent to the ones described in Creating Blocks .
import com.sap.caf.eu.gp.process.api.IGPModifiableBlockStructure;import com.sap.caf.eu.gp.process.api.IGPModifiableBlock;// add a block to the process structureIGPModifiableBlockStructurepStruct = process.getModifiableStructure(); pStruct.addItem(block); |
setIsOverWriteAllowed()
import com.sap.caf.eu.gp.process.api.GPRoleType;// add role Processor of type InitiatorIGPModifiableRoleInfo role = process.addRole("processor","Processor", GPRoleType.ROLE_TYPE_INITIATOR);process.addRole("advisor","Advisor", GPRoleType.ROLE_TYPE_INITIATION_DEFINED);role.addDefault(defaultPrincipal); role.setIsOverWriteAllowed(true); |
manager.save(process); manager.release(process); |
Once you have created a process, assigned blocks and roles to it, you can also:
For more information on how to edit processes, see Editing GP Development Objects .