protected void addParameters(FunctionCallExpr function, Iterator paramIter) { while ( paramIter.hasNext() ) { function.addParameter( (Expr) paramIter.next() ); } }
private void compileGetVariableProperty(FunctionCallExpr c) throws CompilationException{ List params = c.getParameters(); if (params.size() != 2) { throw new CompilationException( __msgs.errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETVARIABLEPROPRTY)); } String varName = getLiteralFromExpression((Expr)params.get(0)); OScope.Variable v = _cctx.resolveVariable(varName); _out.vars.put(varName, v); String propName = getLiteralFromExpression((Expr)params.get(1)); QName qname = _nsContext.derefQName(propName); if (qname == null) throw new CompilationException( __msgs.errInvalidQName(propName)); OProcess.OProperty property = _cctx.resolveProperty(qname); // Make sure we can... _cctx.resolvePropertyAlias(v, qname); _out.properties.put(propName, property); _out.vars.put(varName, v); }
private void compileGetLinkStatus(FunctionCallExpr c) throws CompilationException { List params = c.getParameters(); if (params.size() != 1) { throw new CompilationException(__msgs.errInvalidNumberOfArguments(c.getFunctionName())); } String linkName = getLiteralFromExpression((Expr)params.get(0)); OLink olink = _cctx.resolveLink(linkName); _out.links.put(linkName, olink); }
private static void extractPrefixes( Expr expr, Set<String> prefixes ) { if ( expr instanceof BinaryExpr ) { extractPrefixes( ( (BinaryExpr) expr ).getLHS(), prefixes ); extractPrefixes( ( (BinaryExpr) expr ).getRHS(), prefixes ); } else if ( expr instanceof FilterExpr ) { extractPrefixes( ( (FilterExpr) expr ).getExpr(), prefixes ); for ( Object pred : ( (FilterExpr) expr ).getPredicates() ) { extractPrefixes( (Predicate) pred, prefixes ); } } else if ( expr instanceof FunctionCallExpr ) { extractPrefix( ( (FunctionCallExpr) expr ).getPrefix(), prefixes ); for ( Object param : ( (FunctionCallExpr) expr ).getParameters() ) { extractPrefixes( (Expr) param, prefixes ); } } else if ( expr instanceof LocationPath ) { for ( Object step : ( (LocationPath) expr ).getSteps() ) { extractPrefixes( (Step) step, prefixes ); } } else if ( expr instanceof PathExpr ) { extractPrefixes( ( (PathExpr) expr ).getFilterExpr(), prefixes ); extractPrefixes( ( (PathExpr) expr ).getLocationPath(), prefixes ); } else if ( expr instanceof UnaryExpr ) { extractPrefixes( ( (UnaryExpr) expr ).getExpr(), prefixes ); } else if ( expr instanceof VariableReferenceExpr ) { extractPrefix( ( (VariableReferenceExpr) expr ).getPrefix(), prefixes ); } }
/** */ public void endFunction() { super.endFunction(); FunctionCallExpr c = (FunctionCallExpr)peekFrame() .getLast(); String prefix = c.getPrefix(); // empty string prefix should resolve to xpath namespace, NOT bpel if ((prefix == null) || "".equals(prefix)) { return; } String ns = _nsContext.getNamespaceURI(prefix); if (ns == null) { throw new CompilationException( __msgs.errUndeclaredFunctionPrefix(prefix,c.getFunctionName())); } else if (isBpelNamespace(ns)) { if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(c.getFunctionName())) { compileGetVariableData(c); } else if (Constants.EXT_FUNCTION_GETVARIABLEPROPRTY.equals(c .getFunctionName())) { compileGetVariableProperty(c); } else if (Constants.EXT_FUNCTION_GETLINKSTATUS.equals(c.getFunctionName())) { compileGetLinkStatus(c); } else if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(c.getFunctionName())) { compileDoXslTransform(c); } else { throw new CompilationException(__msgs.errUnknownBpelFunction(c.getFunctionName())); } } }
private void compileDoXslTransform(FunctionCallExpr c) throws CompilationException { List params = c.getParameters(); if (params.size() < 2 || params.size() % 2 != 0) { throw new CompilationException( __msgs.errInvalidNumberOfArguments(Constants.EXT_FUNCTION_DOXSLTRANSFORM)); } String xslUri = getLiteralFromExpression((Expr)params.get(0)); OXslSheet xslSheet = _cctx.compileXslt(xslUri); try { XslTransformHandler.getInstance().parseXSLSheet(_cctx.getOProcess().getQName(), xslSheet.uri, xslSheet.sheetBody, new XslCompileUriResolver(_cctx, _out)); } catch (Exception e) { throw new CompilationException( __msgs.errInvalidNumberOfArguments(xslUri)); } _out.setXslSheet(xslSheet.uri, xslSheet); }
/** * Compile a <code>bpws:getVariableData(...)</em> function call. Note that all arguments * to this call <em>must</em> be literal values. Therefore, we are able to "pre-compile" * all possible invocations of this call, and save ourselves the problem of compiling * query expressions at runtime. * @param c {@link FunctionCallExpr} for this invocation * @throws CompilationException */ private void compileGetVariableData(FunctionCallExpr c) throws CompilationException { List params = c.getParameters(); if (params.size() < 1 || params.size() > 3) { throw new CompilationException( __msgs.errInvalidNumberOfArguments(c.getFunctionName())); } String varname = getLiteralFromExpression((Expr)params.get(0)); String partname = params.size() > 1 ? getLiteralFromExpression((Expr)params.get(1)) : null; String locationstr = params.size() > 2 ? getLiteralFromExpression((Expr)params.get(2)) : null; OScope.Variable var = _cctx.resolveVariable(varname); OMessageVarType.Part part = partname != null ? _cctx.resolvePart(var,partname) : null; OExpression location = null; if (locationstr != null) { location = _cctx.compileExpr(locationstr,_nsContext); } _out.addGetVariableDataSig(varname, partname, locationstr, new OXPath10Expression.OSigGetVariableData(_cctx.getOProcess(),var, part,location)); }
listener.enterFunctionCallExpr(func); for (Object arg : func.getParameters()) { walk((Expr) arg);
listener.enterFunctionCallExpr(func); for (Object arg : func.getParameters()) { walk((Expr) arg);