Sharing project area process using the API
Is anyone aware of any server side code that cn be used to set the process of an unconfigured process project area to share it's process from another project area.
We are trying to automate project setup and are able to successfully create an unconfigured project area programmatically using the API, but are struggling to share our mast projcte areas process with it after the fact.
I think it may require us to set some ProcessConfigurationElement or possibly add some ProcessConfigurationData, but the process source configuration xml for a project we are able to do this on manually does contain any elements so we are not sure how to proceed.
Thanks in advance for any assistance
We are trying to automate project setup and are able to successfully create an unconfigured project area programmatically using the API, but are struggling to share our mast projcte areas process with it after the fact.
I think it may require us to set some ProcessConfigurationElement or possibly add some ProcessConfigurationData, but the process source configuration xml for a project we are able to do this on manually does contain any elements so we are not sure how to proceed.
Thanks in advance for any assistance
4 answers
Is anyone aware of any server side code that cn be used to set the process of an unconfigured process project area to share it's process from another project area.
We are trying to automate project setup and are able to successfully create an unconfigured project area programmatically using the API, but are struggling to share our mast projcte areas process with it after the fact.
I think it may require us to set some ProcessConfigurationElement or possibly add some ProcessConfigurationData, but the process source configuration xml for a project we are able to do this on manually does contain any elements so we are not sure how to proceed.
Thanks in advance for any assistance
ProjectArea has functions setProcessProvider (used for local project area within one server) and setRemoteProcessProviderUrl (used for cross server project area) to use process from another project area. Below is an example code:
if (projectAreaParms.internalProcessProviderUUID != null) {
//local provider
if (projectAreaParms.internalProcessProviderUUID.equals(ITEMID_NONE)) {
((ProjectArea) projectArea).setProcessProvider(null);
} else {
((ProjectArea) projectArea).setProcessProvider((IProjectAreaHandle) IProjectArea.ITEM_TYPE.createItemHandle(UUID.valueOf(projectAreaParms.internalProcessProviderUUID), null));
((ProjectArea) projectArea).setRemoteProcessProviderUrl(null);
}
}
if (projectAreaParms.internalRemoteProcessProviderUrl != null) {
//remote provider
if (projectAreaParms.internalRemoteProcessProviderUrl.equals(ITEMID_NONE)) {
((ProjectArea) projectArea).setRemoteProcessProviderUrl(null);
} else {
((ProjectArea) projectArea).setRemoteProcessProviderUrl(projectAreaParms.internalRemoteProcessProviderUrl);
((ProjectArea) projectArea).setProcessProvider(null);
}
}
Have it working with the client libraries now. The getProcessProvider put me on the right track. Sample code fyi below:
IProjectArea projectArea = null;
IProjectArea parentArea = null;
ProcessProviderWorkingCopy provider = null;
ProjectAreaWorkingCopy paworkingcopy = null;
ProcessProviderWorkingCopy processcopy = null;
for (Object object : processAreas) {
processArea = (IProjectArea) object;
if (processArea.getName().equals(rtcprojectname)) {
projectArea = (IProjectArea) processArea;
paworkingcopy = (ProjectAreaWorkingCopy) service
.getWorkingCopyManager().createPrivateWorkingCopy(
processArea);
provider = paworkingcopy.getProcessProvider();
}
if (processArea.getName().equals(parentProjectName)) {
parentArea = (IProjectArea) processArea;
}
}
System.out.println("Setting project area to use process provider");
provider.setProcessProvider(parentArea);
System.out.println("Setting shared process area");
provider.setUsesProcessProvider(true);
System.out.println("Saving pa working copy");
paworkingcopy.save(monitor);
IProjectArea projectArea = null;
IProjectArea parentArea = null;
ProcessProviderWorkingCopy provider = null;
ProjectAreaWorkingCopy paworkingcopy = null;
ProcessProviderWorkingCopy processcopy = null;
for (Object object : processAreas) {
processArea = (IProjectArea) object;
if (processArea.getName().equals(rtcprojectname)) {
projectArea = (IProjectArea) processArea;
paworkingcopy = (ProjectAreaWorkingCopy) service
.getWorkingCopyManager().createPrivateWorkingCopy(
processArea);
provider = paworkingcopy.getProcessProvider();
}
if (processArea.getName().equals(parentProjectName)) {
parentArea = (IProjectArea) processArea;
}
}
System.out.println("Setting project area to use process provider");
provider.setProcessProvider(parentArea);
System.out.println("Setting shared process area");
provider.setUsesProcessProvider(true);
System.out.println("Saving pa working copy");
paworkingcopy.save(monitor);