Package org.apache.torque.generator.variable

Examples of org.apache.torque.generator.variable.Variable


            Namespace namespace
                    = controllerState.getOutlet().getName().getNamespace();
            QualifiedName variableQualifiedName = new QualifiedName(
                    variableName,
                    namespace);
            Variable variable
                    = controllerState.getVariableStore().getInHierarchy(
                            variableQualifiedName);
            if (variable == null)
            {
                log.info("clazz.getName() : Variable " + variableQualifiedName
                        + " is not set, returning the empty String");
                return "";
            }
            if (variable.getValue() == null)
            {
                log.info("clazz.getName() : Variable " + variableQualifiedName
                        + " is set to null, returning the empty String");
                return "";
            }
            return variable.getValue().toString();
        }
        else if (presetValue != null
                && sourceElementName == null
                && optionName == null
                && variableName == null)
View Full Code Here


            Variable.Scope scope,
            ControllerState controllerState)
    {
        QualifiedName qualifiedName
                = controllerState.getQualifiedName(key);
        Variable variable
                = new Variable(
                        qualifiedName,
                        value,
                        scope);
        VariableStore variableStore = controllerState.getVariableStore();
        variableStore.set(variable);
View Full Code Here

    public Object getVariable(String key, ControllerState controllerState)
    {
        QualifiedName qualifiedName
                = controllerState.getQualifiedName(key);
        VariableStore variableStore = controllerState.getVariableStore();
        Variable variable = variableStore.getInHierarchy(qualifiedName);

        Object value = null;
        if (variable != null)
        {
            value = variable.getValue();
        }

        return value;
    }
View Full Code Here

        store.startOutlet();
        QualifiedName qualifiedName
            = new QualifiedName("org.apache.torque.name");

        // fill store
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.GENERATOR",
                Variable.Scope.OUTLET));
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.CHILDREN1",
                Variable.Scope.CHILDREN));
        store.startOutlet();
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.CHILDREN2",
                Variable.Scope.CHILDREN));
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.FILE",
                Variable.Scope.FILE));
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.GLOBAL",
                Variable.Scope.GLOBAL));

        assertEquals(
View Full Code Here

    }

    public void testNamespaceVisibility()
    {
        VariableStore store = new VariableStore();
        store.set(new Variable(
                new QualifiedName("org.apache.torque.name"),
                "org.apache.torque.GENERATOR",
                Variable.Scope.OUTLET));
        store.set(new Variable(
                new QualifiedName("org.apache.name"),
                "org.apache.FILE",
                Variable.Scope.FILE));
        QualifiedName qualifiedName
            = new QualifiedName("org.apache.torque.name");
        assertEquals(
                "org.apache.torque.GENERATOR",
                store.getInHierarchy(qualifiedName).getValue());

        store.clear();
        store.set(new Variable(
                new QualifiedName("org.apache.name"),
                "org.apache.GENERATOR",
                Variable.Scope.OUTLET));
        store.set(new Variable(
                new QualifiedName("org.apache.torque.name"),
                "org.apache.torque.FILE",
                Variable.Scope.FILE));
        assertEquals(
                "org.apache.torque.FILE",
View Full Code Here

    }

    public void testGetInHierarchy()
    {
        VariableStore store = new VariableStore();
        store.set(new Variable(
                new QualifiedName("org.apache.torque.name"),
                "org.apache.torque",
                Variable.Scope.OUTLET));
        QualifiedName qualifiedName
            = new QualifiedName("org.apache.torque.name");
View Full Code Here

    public void testGetContents()
    {
        VariableStore store = new VariableStore();
        store.startOutlet();
        store.set(new Variable(
                new QualifiedName("org.apache.torque.generator"),
                "org.apache.torque.generator",
                Variable.Scope.OUTLET));
        store.set(new Variable(
                new QualifiedName("org.apache.torque.children1"),
                "org.apache.torque.children1",
                Variable.Scope.CHILDREN));
        store.startOutlet();
        store.set(new Variable(
                new QualifiedName("org.apache.torque.children2"),
                "org.apache.torque.children2",
                Variable.Scope.CHILDREN));
        store.set(new Variable(
                new QualifiedName("org.apache.torque.file"),
                "org.apache.torque.file",
                Variable.Scope.FILE));
        store.set(new Variable(
                new QualifiedName("org.apache.torque.global"),
                "org.apache.torque.global",
                Variable.Scope.GLOBAL));

        QualifiedNameMap<Variable> storeContent = store.getContent();
        assertEquals("storeContent should contain 5 entries",
                5,
                storeContent.size());

        {
            Variable variable
                    = storeContent.get(
                        new QualifiedName("org.apache.torque.generator"));
            assertEquals(
                    "org.apache.torque.generator",
                    variable.getValue());
        }
        {
            Variable variable
                    = storeContent.get(
                        new QualifiedName("org.apache.torque.children1"));
            assertEquals(
                    "org.apache.torque.children1",
                    variable.getValue());
        }
        {
            Variable variable
                    = storeContent.get(
                        new QualifiedName("org.apache.torque.children2"));
            assertEquals(
                    "org.apache.torque.children2",
                    variable.getValue());
        }
        {
            Variable variable
                    = storeContent.get(
                        new QualifiedName("org.apache.torque.file"));
            assertEquals(
                    "org.apache.torque.file",
                    variable.getValue());
        }
        {
            Variable variable
                    = storeContent.get(
                        new QualifiedName("org.apache.torque.global"));
            assertEquals(
                    "org.apache.torque.global",
                    variable.getValue());
        }
    }
View Full Code Here

        store.startOutlet();
        QualifiedName qualifiedName
            = new QualifiedName("org.apache.torque.name");

        // fill store
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.GENERATOR",
                Variable.Scope.OUTLET));
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.CHILDREN",
                Variable.Scope.CHILDREN));
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.FILE",
                Variable.Scope.FILE));
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.GLOBAL",
                Variable.Scope.GLOBAL));

        assertEquals(
                "org.apache.torque.GENERATOR",
                store.getInHierarchy(qualifiedName).getValue());

        store.remove(store.getInHierarchy(qualifiedName));

        assertEquals(
                "org.apache.torque.CHILDREN",
                store.getInHierarchy(qualifiedName).getValue());

        store.remove(store.getInHierarchy(qualifiedName));

        assertEquals(
                "org.apache.torque.FILE",
                store.getInHierarchy(qualifiedName).getValue());

        store.remove(store.getInHierarchy(qualifiedName));

        assertEquals(
                "org.apache.torque.GLOBAL",
                store.getInHierarchy(qualifiedName).getValue());

        store.remove(store.getInHierarchy(qualifiedName));

        assertNull(store.getInHierarchy(qualifiedName));

        // test whether we can remove hidden variables
        Variable childrenVariable = new Variable(
                qualifiedName,
                "org.apache.torque.CHILDREN",
                Variable.Scope.CHILDREN);

        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.GENERATOR",
                Variable.Scope.OUTLET));
        store.set(childrenVariable);
        store.set(new Variable(
                qualifiedName,
                "org.apache.torque.FILE",
                Variable.Scope.FILE));

        assertEquals(
View Full Code Here

TOP

Related Classes of org.apache.torque.generator.variable.Variable

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.