Targets targets = BPELFactory.eINSTANCE.createTargets();
activity.setTargets(targets);
for(int i=0; i < flowActivity.targets().length; i++){
FlowLinkTarget linkTarget = flowActivity.targets()[i];
if (!linkTarget.name().equals("")){
Link link = linkMap.get(linkTarget.name());
if (link == null){
link = BPELFactory.eINSTANCE.createLink();
link.setName(linkTarget.name());
linkMap.put(linkTarget.name(), link);
flow.getLinks().getChildren().add(link);
}
Target target = BPELFactory.eINSTANCE.createTarget();
target.setLink(link);
target.setActivity(activity);
targets.getChildren().add(target);
}
}
}
if (flowActivity.sources().length > 0){
Sources sources = BPELFactory.eINSTANCE.createSources();
activity.setSources(sources);
for(int i=0; i < flowActivity.sources().length; i++){
FlowLinkSource linkSource = flowActivity.sources()[i];
Link link = linkMap.get(linkSource.name());
if (link == null){
link = BPELFactory.eINSTANCE.createLink();
link.setName(linkSource.name());
linkMap.put(linkSource.name(), link);
flow.getLinks().getChildren().add(link);
}
Source source = BPELFactory.eINSTANCE.createSource();
source.setLink(link);