Package org.ofbiz.minilang

Examples of org.ofbiz.minilang.SimpleMethod


        return true;
    }

    public SimpleMethod getSimpleMethodToCall(ClassLoader loader) throws MiniLangException {
        SimpleMethod simpleMethodToCall = null;
        if (UtilValidate.isEmpty(xmlResource)) {
            simpleMethodToCall = this.simpleMethod.getSimpleMethodInSameFile(methodName);
        } else {
            Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(xmlResource, loader);
            simpleMethodToCall = simpleMethods.get(methodName);
View Full Code Here


            String xmlScript = processWfsEntity(typeName, queryElem, inputTmplUrl);

            // run simple method script to get a list of entities
            Document simpleDoc = UtilXml.readXmlDocument(xmlScript);
            Element simpleElem = simpleDoc.getDocumentElement();
            SimpleMethod meth = new SimpleMethod(simpleElem, null, null);
            MethodContext methodContext = new MethodContext(request, response, null);
            String retStr = meth.exec(methodContext); //Need to check return string
            List<GenericValue> entityList = UtilGenerics.cast(request.getAttribute("entityList"));
            request.setAttribute("entityList", entityList);

        } catch (TemplateException ioe) {
            sendError(response, "Problem handling event");
View Full Code Here

    protected void populateUsedEntities() throws GeneralException {
        // populate entitiesUsedByThisService and for each the reverse-associate cache in the aif
        if ("simple".equals(this.modelService.engineName)) {
            // we can do something with this!
            SimpleMethod simpleMethodToCall = null;
            try {
                Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(this.modelService.location, null);
                simpleMethodToCall = (SimpleMethod) simpleMethods.get(this.modelService.invoke);
            } catch (MiniLangException e) {
                Debug.logWarning("Error getting Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "]: " + e.toString(), module);
            }
            if (simpleMethodToCall == null) {
                Debug.logWarning("Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "] not found", module);
                return;
            }

            Set<String> allEntityNameSet = simpleMethodToCall.getAllEntityNamesUsed();
            populateEntitiesFromNameSet(allEntityNameSet);
        } else if ("java".equals(this.modelService.engineName)) {
            String fullClassPathAndFile = UtilJavaParse.findRealPathAndFileForClass(this.modelService.location);
            if (fullClassPathAndFile != null) {
                String javaFile = null;
View Full Code Here

    protected void populateCalledServices() throws GeneralException {
        // populate servicesCalledByThisService and for each the reverse-associate cache in the aif
        if ("simple".equals(this.modelService.engineName)) {
            // we can do something with this!
            SimpleMethod simpleMethodToCall = null;
            try {
                Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(this.modelService.location, null);
                simpleMethodToCall = (SimpleMethod) simpleMethods.get(this.modelService.invoke);
            } catch (MiniLangException e) {
                Debug.logWarning("Error getting Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "]: " + e.toString(), module);
            }
            if (simpleMethodToCall == null) {
                Debug.logWarning("Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "] not found", module);
                return;
            }

            Set<String> allServiceNameSet = simpleMethodToCall.getAllServiceNamesCalled();
            populateServicesFromNameSet(allServiceNameSet);
        } else if ("java".equals(this.modelService.engineName)) {
            String fullClassPathAndFile = UtilJavaParse.findRealPathAndFileForClass(this.modelService.location);
            if (fullClassPathAndFile != null) {
                String javaFile = null;
View Full Code Here

    protected void populateUsedEntities() throws GeneralException {
        // populate entitiesUsedByThisService and for each the reverse-associate cache in the aif
        if ("simple".equals(this.modelService.engineName)) {
            // we can do something with this!
            SimpleMethod simpleMethodToCall = null;
            try {
                Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(this.modelService.location, null);
                simpleMethodToCall = simpleMethods.get(this.modelService.invoke);
            } catch (MiniLangException e) {
                Debug.logWarning("Error getting Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "]: " + e.toString(), module);
            }
            if (simpleMethodToCall == null) {
                Debug.logWarning("Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "] not found", module);
                return;
            }

            Set<String> allEntityNameSet = simpleMethodToCall.getAllEntityNamesUsed();
            populateEntitiesFromNameSet(allEntityNameSet);
        } else if ("java".equals(this.modelService.engineName)) {
            String fullClassPathAndFile = UtilJavaParse.findRealPathAndFileForClass(this.modelService.location);
            if (fullClassPathAndFile != null) {
                String javaFile = null;
View Full Code Here

    protected void populateCalledServices() throws GeneralException {
        // populate servicesCalledByThisService and for each the reverse-associate cache in the aif
        if ("simple".equals(this.modelService.engineName)) {
            // we can do something with this!
            SimpleMethod simpleMethodToCall = null;
            try {
                Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(this.modelService.location, null);
                simpleMethodToCall = simpleMethods.get(this.modelService.invoke);
            } catch (MiniLangException e) {
                Debug.logWarning("Error getting Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "]: " + e.toString(), module);
            }
            if (simpleMethodToCall == null) {
                Debug.logWarning("Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "] not found", module);
                return;
            }

            Set<String> allServiceNameSet = simpleMethodToCall.getAllServiceNamesCalled();
            populateServicesFromNameSet(allServiceNameSet);
        } else if ("java".equals(this.modelService.engineName)) {
            String fullClassPathAndFile = UtilJavaParse.findRealPathAndFileForClass(this.modelService.location);
            if (fullClassPathAndFile != null) {
                String javaFile = null;
View Full Code Here

            String xmlScript = processWfsEntity(typeName, queryElem, inputTmplUrl);
           
            // run simple method script to get a list of entities
            Document simpleDoc = UtilXml.readXmlDocument(xmlScript);
            Element simpleElem = simpleDoc.getDocumentElement();
            SimpleMethod meth = new SimpleMethod(simpleElem, null, null);
            MethodContext methodContext = new MethodContext(request, response, null);
            String retStr = meth.exec(methodContext); //Need to check return string
            List entityList = (List)request.getAttribute("entityList");
            request.setAttribute("entityList", entityList);
           
        } catch (TemplateException ioe) {
            sendError(response, "Problem handling event");
View Full Code Here

    public boolean exec(MethodContext methodContext) {
        if (this.methodName != null && this.methodName.length() > 0) {
            String methodName = methodContext.expandString(this.methodName);
            String xmlResource = methodContext.expandString(this.xmlResource);

            SimpleMethod simpleMethodToCall = null;
            try {
                simpleMethodToCall = getSimpleMethodToCall(methodContext.getLoader());
            } catch (MiniLangException e) {
                String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [error getting methods from resource: " + e.getMessage() + "]";
                Debug.logError(e, errMsg, module);
                methodContext.setErrorReturn(errMsg, simpleMethod);
                return false;
            }

            if (simpleMethodToCall == null) {
                String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process, could not find SimpleMethod " + methodName + " in XML document in resource: " + xmlResource;
                methodContext.setErrorReturn(errMsg, simpleMethod);
                return false;
            }
           
            String returnVal = simpleMethodToCall.exec(methodContext);
            if (Debug.verboseOn()) Debug.logVerbose("Called inline simple-method named [" + methodName + "] in resource [" + xmlResource + "], returnVal is [" + returnVal + "]", module);
           
            if (returnVal != null && returnVal.equals(simpleMethodToCall.getDefaultErrorCode())) {
                // in this case just set the error code just in case it hasn't already been set, the error messages will already be in place...
                if (methodContext.getMethodType() == MethodContext.EVENT) {
                    methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
                } else if (methodContext.getMethodType() == MethodContext.SERVICE) {
                    methodContext.putEnv(simpleMethod.getServiceResponseMessageName(), simpleMethod.getDefaultErrorCode());
View Full Code Here

        return true;
    }
   
    public SimpleMethod getSimpleMethodToCall(ClassLoader loader) throws MiniLangException {
        SimpleMethod simpleMethodToCall = null;
        if (xmlResource == null || xmlResource.length() == 0) {
            simpleMethodToCall = this.simpleMethod.getSimpleMethodInSameFile(methodName);
        } else {
            Map simpleMethods = SimpleMethod.getSimpleMethods(xmlResource, loader);
            simpleMethodToCall = (SimpleMethod) simpleMethods.get(methodName);
View Full Code Here

   
    protected void populateUsedEntities() throws GeneralException {
        // populate entitiesUsedByThisService and for each the reverse-associate cache in the aif
        if ("simple".equals(this.modelService.engineName)) {
            // we can do something with this!
            SimpleMethod simpleMethodToCall = null;
            try {
                Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(this.modelService.location, null);
                simpleMethodToCall = (SimpleMethod) simpleMethods.get(this.modelService.invoke);
            } catch (MiniLangException e) {
                Debug.logWarning("Error getting Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "]: " + e.toString(), module);
            }
            if (simpleMethodToCall == null) {
                Debug.logWarning("Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "] not found", module);
                return;
            }
           
            Set<String> allEntityNameSet = simpleMethodToCall.getAllEntityNamesUsed();
            populateEntitiesFromNameSet(allEntityNameSet);
        } else if ("java".equals(this.modelService.engineName)) {
            String fullClassPathAndFile = UtilJavaParse.findRealPathAndFileForClass(this.modelService.location);
            if (fullClassPathAndFile != null) {
                String javaFile = null;
View Full Code Here

TOP

Related Classes of org.ofbiz.minilang.SimpleMethod

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.