private Node generateAssign(final Scope scope, final Assign assign, final BPELProcess bpelprocess) throws CoreException { this.log.finest("start generate assign"); Node assignNode = null; if (assign != null) { // create assign node final AssignBehaviour assignBehaviour = new AssignBehaviourImpl(); for (final Copy copy : assign.getCopy()) { final BPELAssignementExpression assignExp = new BPELAssignementExpressionImpl( copy, bpelprocess); if (!this.log.getName() .equals(BPELCompilerImpl.class.getName())) { assignExp.setLog(this.log); } assignBehaviour.addAssignementExpression(assignExp); } assignNode = scope.createNode(assign.getName(), assignBehaviour); } this.log.finest("end generate assign"); return assignNode; }
public void addAssign(Activity a, String assignName, String fromXPath, String toXPath) throws Exception{ Assign assign1 = new AssignImpl(new TAssign(),a); Copy c = new CopyImpl(new TCopy(), assign1); From from = new FromImpl(new TFrom(), c); from.setContent(fromXPath); from.setExpressionLanguage(URI.create("http://www.w3.org/TR/xpath20/")); To to = new ToImpl(new TTo(), c); to.setExpressionLanguage(URI.create("http://www.w3.org/TR/xpath20/")); to.setContent(toXPath); c.setFrom(from); c.setTo(to); assign1.addCopy(c); assign1.setName(assignName); if(a instanceof Sequence){ ((Sequence) a).addActivity(assign1); }else{ throw new Exception("addActivity not yet implemented for "+a.getClass().getName()+" activity"); } }
@Override public void validate() { // validation if((((TAssign)((BPELElementImpl)this.getActivity()).getModel()).getValidate() != null) && ((TAssign)((BPELElementImpl)this.getActivity()).getModel()).getValidate().equals(TBoolean.YES)) { BPELStaticAnalysisImpl.getInstance().addInfo(new BPELInfoImpl(this.getActivity(), "In assign " + this.getActivity().getName() + " => [BPEL engine Restriction] Sorry, but the validate attribute at yes is ignored for the moment")); } if((((TAssign)((BPELElementImpl)this.getActivity()).getModel()).getCopyOrExtensionAssignOperation() == null) || (((TAssign)((BPELElementImpl)this.getActivity()).getModel()).getCopyOrExtensionAssignOperation().size() == 0)) { BPELStaticAnalysisImpl.getInstance().addError(new BPELErrorImpl(this.getActivity(), new BPELException("In assign " + this.getActivity().getName() + " => the assign MUST have at less one copy"))); } }