Package org.apache.torque.generator.outlet

Examples of org.apache.torque.generator.outlet.OutletResult


            // but of the real outlet
            // TODO: is this a good idea ? make configurable ?
            controllerState.setOutletNamespace(
                    output.getContentOutlet().getNamespace());
            filenameOutlet.beforeExecute(controllerState);
            OutletResult filenameResult
                = filenameOutlet.execute(controllerState);
            if (!filenameResult.isStringResult())
            {
                throw new GeneratorException(
                        "The result of a filename generation must be a String,"
                        + " not a byte array");
            }
            String filename = filenameResult.getStringResult();
            filenameOutlet.afterExecute(controllerState);
            if (log.isDebugEnabled())
            {
                log.debug("End generation of Output File path, result is "
                        + filename);
View Full Code Here


                }
            }
        }

        outlet.beforeExecute(controllerState);
        OutletResult result = outlet.execute(controllerState);
        outlet.afterExecute(controllerState);

        existingTargetStrategy.afterGeneration(
                output.getOutputDirKey(),
                output.getFilename(),
View Full Code Here

                acceptNotSet);
        if (sourceElement == null)
        {
            if (acceptNotSet)
            {
                return new OutletResult("");
            }
            else
            {
                throw new GeneratorException("SourceElementAttributeAction: "
                        + "No element "
                        + elementPath
                        + "can be found.");
            }
        }
        String detokenizedAttributeName = tokenReplacer.process(attributeName);
        Object result = sourceElement.getAttribute(detokenizedAttributeName);
        if (result == null)
        {
            if (acceptNotSet)
            {
                return new OutletResult("");
            }
            throw new GeneratorException("SourceElementAttributeAction: "
                    + "The attribute "
                    + attributeName
                    + " is not set on the element "
                    + sourceElement.getName()
                    + " (element path was "
                    + elementPath
                    + ")");
        }
        return new OutletResult(result.toString());
    }
View Full Code Here

            outlet.afterExecute(controllerState);
        }
        controllerState.setSourceElement(currentElement);
        if (resultList.isEmpty())
        {
            return new OutletResult("");
        }
        return OutletResult.concatenate(resultList);
    }
View Full Code Here

                        "ApplyAction : selected path "
                            + path
                            + " does not match an element"
                            + " and acceptNotSet was set to false");
            }
            return new OutletResult("");
        }
        if (selectedElements.size() > 1)
        {
            throw new GeneratorException(
                    "ApplyAction : selected path "
                        + path
                        + " contains more than one element ("
                        + selectedElements.size()
                        + " times)");
        }
        // selectedElements has size 1
        controllerState.setSourceElement(selectedElements.get(0));
        outlet.beforeExecute(controllerState);
        OutletResult result = outlet.execute(controllerState);
        outlet.afterExecute(controllerState);
        controllerState.setSourceElement(currentElement);
        return result;
    }
View Full Code Here

        Object option = controllerState.getOption(optionName);
        if (option == null)
        {
            if (acceptNotSet)
            {
                return new OutletResult("");
            }
            throw new GeneratorException("OptionAction: The option "
                    + optionName
                    + " is not set");
        }
        return new OutletResult(option.toString());
    }
View Full Code Here

    public OutletResult execute(ControllerState controllerState)
        throws GeneratorException
    {
        TokenReplacer tokenReplacer = new TokenReplacer(controllerState);
        String detokenizedValue = tokenReplacer.process(value);
        return new OutletResult(detokenizedValue);
    }
View Full Code Here

            Binding binding = new Binding();
            GroovyShell shell = new GroovyShell(binding);

            String result = (String) shell.evaluate(
                    getContent(controllerState));
            return new OutletResult(result);
        }
        finally
        {
            if (log.isDebugEnabled())
            {
View Full Code Here

        SourceElement rootElement = new SourceElement("root");
        rootElement.getChildren().add(new SourceElement("child"));
        ControllerState controllerState = new ControllerState();
        controllerState.setRootElement(rootElement);
        XmlOutlet xmlOutlet = new XmlOutlet(new QualifiedName("test"));
        OutletResult result = xmlOutlet.execute(controllerState);
        assertEquals(
                "<root>\n  <child/>\n</root>\n",
                result.getStringResult());
    }
View Full Code Here

        rootElement.getChildren().add(new SourceElement("child"));
        ControllerState controllerState = new ControllerState();
        controllerState.setRootElement(rootElement);
        XmlOutlet xmlOutlet = new XmlOutlet(new QualifiedName("test"));
        xmlOutlet.setCreateIdAttributes(true);
        OutletResult result = xmlOutlet.execute(controllerState);
        assertEquals(
                "<root id=\"1\">\n  <child id=\"2\"/>\n</root>\n",
                result.getStringResult());
    }
View Full Code Here

TOP

Related Classes of org.apache.torque.generator.outlet.OutletResult

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.