Package org.ofbiz.minilang.method

Examples of org.ofbiz.minilang.method.ContextAccessor


    ContextAccessor toListAcsr;
    ContextAccessor orderByListAcsr;

    public OrderValueList(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        listAcsr = new ContextAccessor(element.getAttribute("list-name"));
        toListAcsr = new ContextAccessor(element.getAttribute("to-list-name"), element.getAttribute("list-name"));
        orderByListAcsr = new ContextAccessor(element.getAttribute("order-by-list-name"));
    }
View Full Code Here


    ContextAccessor valueAcsr;
    String doCacheClearStr;

    public RefreshValue(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        valueAcsr = new ContextAccessor(element.getAttribute("value-name"));
        doCacheClearStr = element.getAttribute("do-cache-clear");
    }
View Full Code Here

    protected Map<ContextAccessor, ContextAccessor> resultToResult = FastMap.newInstance();

    public CallService(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        serviceName = element.getAttribute("service-name");
        inMapAcsr = new ContextAccessor(element.getAttribute("in-map-name"));
        includeUserLoginStr = element.getAttribute("include-user-login");
        breakOnErrorStr = element.getAttribute("break-on-error");
        errorCode = element.getAttribute("error-code");
        if (errorCode == null || errorCode.length() == 0) errorCode = "error";
        this.requireNewTransactionStr = element.getAttribute("require-new-transaction");

        String timeoutStr = UtilXml.checkEmpty(element.getAttribute("transaction-timeout"), element.getAttribute("transaction-timout"));
        int timeout = -1;
        if (!UtilValidate.isEmpty(timeoutStr)) {
            try {
                timeout = Integer.parseInt(timeoutStr);
            } catch (NumberFormatException e) {
                Debug.logWarning(e, "Setting timeout to 0 (default)", module);
                timeout = 0;
            }
        }
        this.transactionTimeout = timeout;
       
        successCode = element.getAttribute("success-code");
        if (successCode == null || successCode.length() == 0) successCode = "success";

        errorPrefix = new FlexibleMessage(UtilXml.firstChildElement(element, "error-prefix"), "service.error.prefix");
        errorSuffix = new FlexibleMessage(UtilXml.firstChildElement(element, "error-suffix"), "service.error.suffix");
        successPrefix = new FlexibleMessage(UtilXml.firstChildElement(element, "success-prefix"), "service.success.prefix");
        successSuffix = new FlexibleMessage(UtilXml.firstChildElement(element, "success-suffix"), "service.success.suffix");
        messagePrefix = new FlexibleMessage(UtilXml.firstChildElement(element, "message-prefix"), "service.message.prefix");
        messageSuffix = new FlexibleMessage(UtilXml.firstChildElement(element, "message-suffix"), "service.message.suffix");
        defaultMessage = new FlexibleMessage(UtilXml.firstChildElement(element, "default-message"), "service.default.message");

        List resultsToMapElements = UtilXml.childElementList(element, "results-to-map");
        if (resultsToMapElements != null && resultsToMapElements.size() > 0) {
            Iterator iter = resultsToMapElements.iterator();
            while (iter.hasNext()) {
                Element resultsToMapElement = (Element) iter.next();

                resultsToMap.add(resultsToMapElement.getAttribute("map-name"));
            }
        }

        List resultToFieldElements = UtilXml.childElementList(element, "result-to-field");
        if (resultToFieldElements != null && resultToFieldElements.size() > 0) {
            Iterator iter = resultToFieldElements.iterator();
            while (iter.hasNext()) {
                Element resultToFieldElement = (Element) iter.next();
                ResultToFieldDef rtfDef = new ResultToFieldDef();

                rtfDef.resultName = resultToFieldElement.getAttribute("result-name");
                rtfDef.mapAcsr = new ContextAccessor(resultToFieldElement.getAttribute("map-name"));
                rtfDef.fieldAcsr = new ContextAccessor(resultToFieldElement.getAttribute("field-name"), rtfDef.resultName);

                resultToField.add(rtfDef);
            }
        }

        // get result-to-request and result-to-session sub-ops
        List resultToRequestElements = UtilXml.childElementList(element, "result-to-request");
        if (resultToRequestElements != null && resultToRequestElements.size() > 0) {
            Iterator iter = resultToRequestElements.iterator();
            while (iter.hasNext()) {
                Element resultToRequestElement = (Element) iter.next();
                FlexibleServletAccessor reqAcsr = new FlexibleServletAccessor(resultToRequestElement.getAttribute("request-name"), resultToRequestElement.getAttribute("result-name"));
                ContextAccessor resultAcsr = new ContextAccessor(resultToRequestElement.getAttribute("result-name"));
                resultToRequest.put(reqAcsr, resultAcsr);
            }
        }

        List resultToSessionElements = UtilXml.childElementList(element, "result-to-session");
        if (resultToSessionElements != null && resultToSessionElements.size() > 0) {
            Iterator iter = resultToSessionElements.iterator();
            while (iter.hasNext()) {
                Element resultToSessionElement = (Element) iter.next();
                FlexibleServletAccessor sesAcsr = new FlexibleServletAccessor(resultToSessionElement.getAttribute("session-name"), resultToSessionElement.getAttribute("result-name"));
                ContextAccessor resultAcsr = new ContextAccessor(resultToSessionElement.getAttribute("result-name"));
                resultToSession.put(sesAcsr, resultAcsr);
            }
        }

        List resultToResultElements = UtilXml.childElementList(element, "result-to-result");
        if (resultToResultElements != null && resultToResultElements.size() > 0) {
            Iterator iter = resultToResultElements.iterator();
            while (iter.hasNext()) {
                Element resultToResultElement = (Element) iter.next();
                ContextAccessor serResAcsr = new ContextAccessor(resultToResultElement.getAttribute("service-result-name"), resultToResultElement.getAttribute("result-name"));
                ContextAccessor resultAcsr = new ContextAccessor(resultToResultElement.getAttribute("result-name"));
                resultToResult.put(serResAcsr, resultAcsr);
            }
        }
    }
View Full Code Here

            if (resultToRequest.size() > 0) {
                Iterator iter = resultToRequest.entrySet().iterator();
                while (iter.hasNext()) {
                    Map.Entry entry = (Map.Entry) iter.next();
                    FlexibleServletAccessor requestAcsr = (FlexibleServletAccessor) entry.getKey();
                    ContextAccessor resultAcsr = (ContextAccessor) entry.getValue();
                    requestAcsr.put(methodContext.getRequest(), resultAcsr.get(result, methodContext), methodContext.getEnvMap());
                }
            }

            if (resultToSession.size() > 0) {
                Iterator iter = resultToSession.entrySet().iterator();
                while (iter.hasNext()) {
                    Map.Entry entry = (Map.Entry) iter.next();
                    FlexibleServletAccessor sessionAcsr = (FlexibleServletAccessor) entry.getKey();
                    ContextAccessor resultAcsr = (ContextAccessor) entry.getValue();
                    sessionAcsr.put(methodContext.getRequest().getSession(), resultAcsr.get(result, methodContext), methodContext.getEnvMap());
                }
            }
        }

        // only run this if it is in an SERVICE context
        if (methodContext.getMethodType() == MethodContext.SERVICE) {
            if (resultToResult.size() > 0) {
                Iterator iter = resultToResult.entrySet().iterator();
                while (iter.hasNext()) {
                    Map.Entry entry = (Map.Entry) iter.next();
                    ContextAccessor targetResultAcsr = (ContextAccessor) entry.getKey();
                    ContextAccessor resultAcsr = (ContextAccessor) entry.getValue();
                    targetResultAcsr.put(methodContext.getResults(), resultAcsr.get(result, methodContext), methodContext);
                }
            }
        }

        String errorPrefixStr = errorPrefix.getMessage(methodContext.getLoader(), methodContext);
View Full Code Here

    protected boolean setIfNull; // default to false
    protected boolean setIfEmpty; // default to true

    public SetCalendar(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        this.field = new ContextAccessor(element.getAttribute("field"));
        this.fromField = new ContextAccessor(element.getAttribute("from-field"));
        this.valueExdr = new FlexibleStringExpander(element.getAttribute("value"));
        this.defaultExdr = new FlexibleStringExpander(element.getAttribute("default-value"));
        this.yearsExdr = new FlexibleStringExpander(element.getAttribute("years"));
        this.monthsExdr = new FlexibleStringExpander(element.getAttribute("months"));
        this.daysExdr = new FlexibleStringExpander(element.getAttribute("days"));
View Full Code Here

    protected ContextAccessor envAcsr;
    protected ContextAccessor toEnvAcsr;

    public EnvToEnv(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        envAcsr = new ContextAccessor(element.getAttribute("env-name"));
        toEnvAcsr = new ContextAccessor(element.getAttribute("to-env-name"));
    }
View Full Code Here

    protected String countStr;


    public Loop(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
        this.countStr = element.getAttribute("count");

        SimpleMethod.readOperations(element, subOps, simpleMethod);
    }
View Full Code Here

    protected ContextAccessor entryAcsr;
    protected ContextAccessor listAcsr;

    public Iterate(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        this.entryAcsr = new ContextAccessor(element.getAttribute("entry-name"));
        this.listAcsr = new ContextAccessor(element.getAttribute("list-name"));

        SimpleMethod.readOperations(element, subOps, simpleMethod);
    }
View Full Code Here

    protected boolean setIfNull; // default to false
    protected boolean setIfEmpty; // default to true

    public SetOperation(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        this.field = new ContextAccessor(element.getAttribute("field"));
        this.fromField = new ContextAccessor(element.getAttribute("from-field"));
        this.valueExdr = new FlexibleStringExpander(element.getAttribute("value"));
        this.defaultExdr = new FlexibleStringExpander(element.getAttribute("default-value"));
        this.type = element.getAttribute("type");
        // default to false, anything but true is false
        this.setIfNull = "true".equals(element.getAttribute("set-if-null"));
View Full Code Here

    ContextAccessor valueAcsr;
    String doCacheClearStr;

    public CreateValue(Element element, SimpleMethod simpleMethod) {
        super(element, simpleMethod);
        valueAcsr = new ContextAccessor(element.getAttribute("value-name"));
        doCacheClearStr = element.getAttribute("do-cache-clear");
    }
View Full Code Here

TOP

Related Classes of org.ofbiz.minilang.method.ContextAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.