Created On:  17 January 2012

Problem:

Using the StarTeam SDK, how can the ‘Process Rules’ options be enabled or disabled?

Resolution:

This has been tested using StarTeam 2009 R2 SDK, the code may vary for StarTeam 12 SDK or later.



Use the following extract of Java code as an example to enable process items and restrict selection to 'open' Change Requests.

//Require selection of process items when files are added or checked in (1)
proj.setProcessItemsRequired(true);            
   
// ** repeat the following section for each required setting (Change Requests, Requirements, or Tasks) as required **
Type crtype = proj.getSerer().typeForName(proj.getSerer().getTypeNames().CHANGEREQUEST);
proj.setProcessItemTypeEnabled(crtype, true); // "Permit selection of change requests as process items" (2)  

// You need to get the property object representing the cr status...
Property p = crtype.propertyForName(proj.getSerer().getPropertyNames().CR_STATUS);

// Then get the enumerated alues from this property object...
Enumeratedalue[] = p.getEnumeratedalues();
Enumeratedalue e = null;

//Iterate oer this set and find the one that has an id equals PropertyEnums.CR_STATUS_OPEN (or CR_STATUS_IN_PROGRESS)...
for (int i=0; i < .length; i )
 if(.getCode()==PropertyEnums.CR_STATUS_OPEN)
  e = ;
proj.setActieProcessItemStateEnabled(e, true); // "Restrict status to:" (3)
// ** end repeat section **

proj.setEnhancedProcessItemsEnabled(true); // "Enable enhanced process links" (4)
proj.update();

Incident #2554278