proc.setactivity_Group(actGrp);
//setting variables
tVariables variables = new tVariables();
ProcessVariable pvds[] = srcProcDef.getProcessVariables();
for(int i=0; i<pvds.length; i++){
ProcessVariable pvd = pvds[i];
tVariable variable = new tVariable();
variable.setname_Attribute(new XNCName(BPELSerializer.toSafeName(pvd.getName(), "variable"+i)));
//review: should be xsi type
variable.settype_Attribute(getXSDTypeName(pvd));
variables.addvariable(variable);
}
Vector addVariables = (Vector)context.get("addVariables");
for(Enumeration enumeration = addVariables.elements(); enumeration.hasMoreElements(); ){
Object [] varCtx = (Object[])enumeration.nextElement();
String variableName = (String)varCtx[0];
XQName variableType = (XQName)varCtx[1];
tVariable variable = new tVariable();
variable.setname_Attribute(new XNCName(variableName) );
//review: should be xsi type
variable.setmessageType_Attribute(variableType);
variables.addvariable(variable);
}
proc.setvariables(variables);
//
//setting partners
tPartnerLinks partnerLinks = new tPartnerLinks();
Role roles[] = srcProcDef.getRoles();
for(int i=0; i<roles.length; i++){
Role role = roles[i];
tPartnerLink partnerLink = new tPartnerLink();
String roleName = BPELSerializer.toSafeName(role.getName(), "role"+i);
partnerLink.setname_Attribute(new XNCName(roleName));
partnerLink.setpartnerLinkType_Attribute(new XQName("sdns", "", roleName + "PartnerLinkType"));
partnerLink.setpartnerRole_Attribute(new XNCName("partnerRole"));
partnerLinks.addpartnerLink(partnerLink);
}
//add my role
tPartnerLink partnerLink = new tPartnerLink();
partnerLink.setname_Attribute(new XNCName("myRole") );
partnerLink.setpartnerLinkType_Attribute(new XQName("sdns", "", srcProcName + "PartnerLinkType"));
partnerLink.setpartnerRole_Attribute(new XNCName("myRole"));
partnerLinks.addpartnerLink(partnerLink);
//
proc.setpartnerLinks(partnerLinks);
//
//setting correlations
tCorrelationSets correlationSets = new tCorrelationSets();
for(int i=0; i<roles.length; i++){
Role role = roles[i];
ProcessVariable identifier = role.getIdentifier();
if(identifier==null) identifier = srcProcDef.getProcessVariables()[0];//continue;
tCorrelationSet correlationSet = new tCorrelationSet();
correlationSet.setname_Attribute(new XNCName(BPELSerializer.toSafeName(role.getName(), "role"+i)+"Identification"));
//review:
correlationSet.setproperties_Attribute(new XQName("sdns","","property_" + identifier.getName()));
correlationSets.addcorrelationSet(correlationSet);
}
proc.setcorrelationSets(correlationSets);
//