//
//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);