String uid = this.configuration.getUser();
String project = this.configuration.getProject();
if (redeploy) {
LEADresourceDocument leadResourceDocument = this.stub
.getCollection(uid, templateID.toString());
if (leadResourceDocument != null) {
// No need to create a new collection because it's already
// there.
LEADResourceType leadResource = leadResourceDocument
.getLEADresource();
String resourceID = leadResource.getResourceID();
return resourceID;
}
// It comes here when the workflow template is only in GPEL, not
// in myLEAD.
}
String workflowTemplatesCollectionID = stub.getWorkflowTemplateCollectionId(uid, project);
if( null == workflowTemplatesCollectionID){
throw new MyLeadException("Template collection not found for the project :"+project+" for user :"+uid);
}
String name = workflow.getName();
String description = workflow.getDescription();
LEADresourceDocument resourceDocument = createResourceDocument(
templateID, uid, name, description);
// TODO change this to true in the future.
boolean assignNewResourceID = false;
String parentResourceID = workflowTemplatesCollectionID;
//
// LEADResourceType resourceType = LEADResourceType.Factory
// .newInstance();
// OtheridinfoType newWorkflow = resourceType.addNewWorkflow();
String resourceID =
this.stub.createCollection(uid, resourceDocument.getLEADresource(), parentResourceID,
assignNewResourceID);
return resourceID;
} catch (RuntimeException e) {
throw new MyLeadException(e);
}