public BPELAssignementExpressionImpl(final Copy copy, final BPELProcess definition) { //super(((BPELElementImpl)copy).getTag(), null, (BPELElementImpl)copy); //this.assigner = new BPELAssigner(definition); this.copy = copy; this.bpelDefinition = definition; this.left = (BPELExpression) this.copy.getTo().copypaste(); this.right = (BPELExpression) this.copy.getFrom().copypaste(); }
public static String convertVariable2Expression(final VariablePart var) throws XPathExpressionException { String expression = null; if(var != null) { expression = "$" + var.getVariable(); if(var.getPart() != null) { expression = expression + "." + var.getPart(); } if(var.getQuery() != null) { if(!var.getQuery().getQueryLanguage().toString().equals("urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0")) { throw new XPathExpressionException("this query language (" + var.getQuery().getQueryLanguage() + ") is not recognized. Only XPATH1.0 language (urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0) is supported" ); } if(var.getQuery().getContent().startsWith("/")) { expression = expression + var.getQuery().getContent().trim(); } else { expression = expression + "/" + var.getQuery().getContent().trim(); } } } return expression.trim(); }
public void setPartnerLinkVar(final PartnerLinkVar partner) { this.model.setPartnerLink(partner.getPartnerLink()); this.partner = partner; }
if(definition.getFrom().getKind() == From.Kind.EXPRESSION) { final String value = definition.getFrom().getContent(); rightSide.setText(value); } else if(definition.getFrom().getKind() == From.Kind.LITERAL) { if(definition.getFrom().getLiteral().getElementContent() != null) { rightSide.addContent(definition.getFrom().getLiteral().getElementContent().detach()); } else if(definition.getFrom().getLiteral().getStringContent() != null) { rightSide.setText(definition.getFrom().getLiteral().getStringContent());
if(to.getKind() == To.Kind.PARTNERLINK) { partner = this.findPartner(scope, to.getPartnerLinkVar().getPartnerLink(), this.bpeldefinition); if(partner == null) { throw new CoreException("Impossible to find the partner: " + to.getPartnerLinkVar().getPartnerLink()); if(from.getKind() == From.Kind.LITERAL) { if(from.getLiteral().getElementContent() != null) { this.log.finest("litteral content = " + from.getLiteral().getElementContent()); } else { this.log.finest("litteral content = " + from.getLiteral().getStringContent()); if(from.getLiteral().getElementContent() != null) { eprFrom = this.getEpr((Element) ((Element)from.getLiteral().getElementContent().getChildren().get(0)).detach()); } else if(from.getLiteral().getStringContent() != null) { final Document doc = builder.build(new ByteArrayInputStream(from.getLiteral().getStringContent().getBytes())); root = (Element) ((Element) doc.getRootElement().getChildren().get(0)).clone(); eprFrom = this.getEpr(root); } else if((from.getKind() == From.Kind.EXPRESSION)||(from.getKind() == From.Kind.VARIABLE_PART)) { final ExpressionAnalyzer expressionAnalyzer = new ExpressionAnalyzer(""); if(from.getKind() == From.Kind.EXPRESSION) { expression = from.getContent(); } else if(from.getKind() == From.Kind.VARIABLE_PART) { expression = ExpressionUtil.convertVariable2Expression(from.getVariablePart()); } else if(from.getKind() == From.Kind.PARTNERLINK) {
if((to.getKind() == To.Kind.EXPRESSION)||(to.getKind() == To.Kind.VARIABLE_PART)) { if(to.getKind() == To.Kind.EXPRESSION) { expression = to.getContent().trim(); } else if(to.getKind() == To.Kind.VARIABLE_PART) { expression = ExpressionUtil.convertVariable2Expression(to.getVariablePart()); if(from.getKind() == From.Kind.LITERAL) { if(from.getLiteral().getElementContent() != null) { rightSide = (Element) from.getLiteral().getElementContent().detach(); } else if(from.getLiteral().getStringContent() != null) { rightSide = new Element("literal"); final Document doc = new Document(rightSide); rightSide.setText(from.getLiteral().getStringContent().trim()); } else if((from.getKind() == From.Kind.EXPRESSION)||(from.getKind() == From.Kind.VARIABLE_PART)) { if(from.getKind() == From.Kind.EXPRESSION) { expression = from.getContent().trim(); } else if(from.getKind() == From.Kind.VARIABLE_PART) { expression = ExpressionUtil.convertVariable2Expression(from.getVariablePart()); } else if(from.getKind() == From.Kind.VARIABLE_PART) { throw new NotImplementedException("Affectation using variable not implemented: Use affectation by expression"); } else {
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"); } }
private Variable findVariable(final Scope scope, final FromAndTo to) throws CoreException { Variable v = null; // find variable in scope String variableName = null; if(to.getKind() != To.Kind.PARTNERLINK) { if(to.getKind() == To.Kind.EXPRESSION) { variableName = BPELVariableImpl.getVariableNameInXPathExpression(to.getContent()); } else if(to.getKind() == To.Kind.VARIABLE_PART) { variableName = to.getVariablePart().getVariable().getLocalPart(); } variableName = variableName.trim(); this.log.finest("find variable " + variableName); v = scope.findVariable(new QName(Util.getLocalPartWithoutPrefix(variableName))); if(v == null) { throw new CoreException("Error: impossible to find the variable: " + variableName); } } return v; }
public Expression affect(final Scope scope, final Expression left, final Expression right) throws CoreException { Variable v = null; try { this.log.finest("affect " + right + " in " + left); final Element leftSide = null; final Element rightSide = null; if(!(left instanceof To)) { throw new BPELException("Incorrect affectation !!!"); } if(!(right instanceof From)) { throw new BPELException("Incorrect affectation !!!"); } final To to = (To)left; final From from = (From)right; if((to.getKind() == To.Kind.PARTNERLINK)||(from.getKind() == From.Kind.PARTNERLINK)) { v = this.affectPartner(scope, leftSide, rightSide, to, from); } else { v = this.affectVariable(scope, leftSide, rightSide, to, from); } } catch (final BPELException e) { throw new CoreException(e); } return v; }
null); to .setKind(To.Kind.VARIABLE_PROPERTY); to .setVariableProperty(new VariablePropertyImpl( inputVariable, prop .getQName())); new TFrom(), null); from .setKind(From.Kind.VARIABLE_PROPERTY);
public void validate() { // validation if((this.query.getQueryLanguage() != null) && !this.query.getQueryLanguage().toString().equals("urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0") && !this.query.getQueryLanguage().toString().equals("http://www.w3.org/TR/1999/REC-xpath-19991116")) { BPELStaticAnalysisImpl.getInstance().addError(new BPELErrorImpl(this.query, new BPELException("In expressionLanguage => Unknowned uri: " + this.query.getQueryLanguage() + ". Only the uri " + "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0" + " and " + "http://www.w3.org/TR/1999/REC-xpath-19991116"+ " are supported"))); } }
final To to = (To) corr.getOriginator(); final Variable varTo = scope.findVariable(new QName(to.getVariableProperty().getVariable())); if(varTo == null) { throw new CoreException("Impossible to find variable corresponding to this name " + to.getVariableProperty().getVariable()); queryTo.getContent().add(propAliasTo.getQuery().getContentString()); queryTo.setQueryLanguage(propAliasTo.getQuery().getQueryLanguage()); final VariablePart vTO = new VariablePartImpl(new QName(to.getVariableProperty().getVariable()), propAliasTo.getPart(), new QueryImpl(queryTo, to));
if (definition.getFrom().getKind() == From.Kind.EXPRESSION) { final String value = definition.getFrom().getContent(); rightSide.setText(value); } else if (definition.getFrom().getKind() == From.Kind.LITERAL) { if (definition.getFrom().getLiteral().getElementContent() != null) { rightSide.addContent(definition.getFrom().getLiteral() .getElementContent().detach()); } else if (definition.getFrom().getLiteral() .getStringContent() != null) { rightSide.setText(definition.getFrom().getLiteral() .getStringContent());