Examples of GeneratorException


Examples of org.apache.torque.generator.GeneratorException

            StringBuilder result = new StringBuilder();
            for (OutletResult part : input)
            {
                if (!part.isStringResult())
                {
                    throw new GeneratorException(
                            "first OutletResult to concatenate is a "
                            + "String result but a following result is a "
                            + "byte array."
                            + " All concatenated results must be "
                            + "of the same type");
                }
                String partContent = part.getStringResult();
                if (partContent != null)
                {
                    result.append(partContent);
                }
            }
            return new OutletResult(result.toString());
        }
        int totalLength = 0;
        for (OutletResult part : input)
        {
            if (!part.isByteArrayResult())
            {
                throw new GeneratorException(
                        "first OutletResult to concatenate is a "
                        + "byte array result but a following result is a "
                        + "String result."
                        + " All concatenated results must be "
                        + "of the same type");
View Full Code Here

Examples of org.apache.torque.generator.GeneratorException

            try
            {
                OutletResult actionResult = action.execute(controllerState);
                if (!actionResult.isStringResult())
                {
                    throw new GeneratorException(
                            "mergepoint actions "
                            + "must return a String result! Mergepoint name: "
                            + mergepointName
                            + ", outlet name: "
                            + controllerState.getOutlet().getName().toString());
View Full Code Here

Examples of org.apache.torque.generator.GeneratorException

            {
                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 "
View Full Code Here

Examples of org.apache.torque.generator.GeneratorException

                    Namespace.ROOT_NAMESPACE);

            outlet = outletConfiguration.getOutlet(outletQName);
            if (outlet == null)
            {
                throw new GeneratorException("TraverseAllAction : The outlet "
                        + outletName
                        + " does not exist");
            }
        }

        SourceElement currentElement = controllerState.getSourceElement();
        String detokenizedElementToTraverseName
                = tokenReplacer.process(elementsToTraverseName);

        List<SourceElement> selectedElements
                = SourcePath.getElements(
                        currentElement,
                        detokenizedElementToTraverseName);
        if (!acceptEmpty && selectedElements.isEmpty())
        {
            throw new GeneratorException(
                    "TraverseAllAction : selected element "
                        + elementsToTraverseName
                        + " does not exist and acceptEmpty was set to false");
        }
View Full Code Here

Examples of org.apache.torque.generator.GeneratorException

        Outlet outlet = controllerState.getUnitConfiguration()
                .getOutletConfiguration()
                .getOutlet(qualifiedOutletName);
        if (outlet == null)
        {
            throw new GeneratorException("ApplyAction : The outlet "
                    + outletName
                    + " does not exist");
        }

        SourceElement currentElement = controllerState.getSourceElement();
        String detokenizedPath = tokenReplacer.process(path);

        List<SourceElement> selectedElements
                = SourcePath.getElements(currentElement, detokenizedPath);
        if (selectedElements.isEmpty())
        {
            if (!acceptNotSet)
            {
                throw new GeneratorException(
                        "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)");
View Full Code Here

Examples of org.apache.torque.generator.GeneratorException

            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);
View Full Code Here

Examples of org.apache.torque.generator.GeneratorException

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

Examples of org.apache.torque.generator.GeneratorException

                targetFile,
                encoding);

        if (!generationResult.isStringResult())
        {
            throw new GeneratorException(
                    "The merge target file strategy onlys works"
                    + " for String generation results (target file="
                    + targetFile.getAbsolutePath() + ")");
        }
View Full Code Here

Examples of org.apache.torque.generator.GeneratorException

                    IOUtils.toByteArray(inputStream));
            return result;
        }
        catch (IOException e)
        {
            throw new GeneratorException("CopyOutlet with name "
                    + getName()
                    + ": cannot read Resource "
                    + path,
                e);
        }
View Full Code Here

Examples of org.castor.ddlgen.GeneratorException

     */
    public final void merge(final ForeignKey fk) throws GeneratorException {
        if (fk == null) {
            String msg = "Foreign key to merge is missing.";
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (!equals(getName(), fk.getName())) {
            String msg = "Name of foreign key differs from: " + getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (!equals(getTable(), fk.getTable())) {
            String msg = "Table of foreign key differs from: " + getTable().getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (getFieldCount() != fk.getFieldCount()) {
            String msg = "Field count of foreign key differs from: " + getFieldCount();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        for (int i = 0; i < getFieldCount(); i++) {
            if (!equals(getField(i), fk.getField(i))) {
                String msg = "Field of foreign key differs from: "
                           + getField(i).getName();
                LOG.error(msg);
                throw new GeneratorException(msg);
            }
        }
       
        if (!equals(getReferenceTable().getName(), fk.getReferenceTable().getName())) {
            String msg = "Referenced table of foreign key differs from: "
                       + getReferenceTable().getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (getReferenceFieldCount() != fk.getReferenceFieldCount()) {
            String msg = "Referenced field count of foreign key differs from: "
                       + getReferenceFieldCount();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        for (int i = 0; i < getReferenceFieldCount(); i++) {
            if (!equals(getReferenceField(i), fk.getReferenceField(i))) {
                String msg = "Referenced field of foreign key differs from: "
                           + getReferenceField(i).getName();
                LOG.error(msg);
                throw new GeneratorException(msg);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.