org.eclipse.bpel.model.Process process = classProcessMap.get(f.getDeclaringType());
if (process != null){
PartnerLink plink = null;
PartnerLinkType plinkType = null;
Role partnerRole = null;
String plinkName = f.getSimpleName();
if (plinkAnnotation != null && !plinkAnnotation.name().equals(""))
plinkName = plinkAnnotation.name();
String roleName = plinkName;
if (plinkAnnotation != null && !plinkAnnotation.role().equals(""))
plinkName = plinkAnnotation.role();
String partnerLinkTypeName = plinkName + process.getName() + "LT";
Iterator<PartnerLink> plit = process.getPartnerLinks().getChildren().iterator();
while (plit.hasNext()){
PartnerLink pl = plit.next();
if (pl.getName().equals(plinkName)){
partnerLinkTypeName = pl.getPartnerLinkType().getName();
plink = pl;
break;
}
}
if (plink == null){
plink = BPELFactory.eINSTANCE.createPartnerLink();
plinkType = PartnerlinktypeFactory.eINSTANCE.createPartnerLinkType();
plink.setName(plinkName);
partnerRole = PartnerlinktypeFactory.eINSTANCE.createRole();
partnerRole.setName(roleName);
partnerRole.setPortType(portType);
partnerRole.setRequired(true);
plinkType.setName(partnerLinkTypeName);
plinkType.setName(partnerLinkTypeName);
plinkType.setElementType(plinkType.getElementType());
plinkType.setRequired(true);
plinkType.getRole().add(partnerRole);
plink.setPartnerRole(partnerRole);
plink.setPartnerLinkType(plinkType);
process.getPartnerLinks().getChildren().add(plink);
} else {
plinkType = plink.getPartnerLinkType();
partnerRole = PartnerlinktypeFactory.eINSTANCE.createRole();
partnerRole.setName(roleName);
partnerRole.setPortType(portType);
partnerRole.setRequired(true);
plinkType.getRole().add(partnerRole);
plink.setPartnerRole(partnerRole);
}
fieldPartnerLinkMap.put(f, plink);