Examples of ElementModelImpl


Examples of org.apache.hivemind.schema.impl.ElementModelImpl

    public void testGetContentTranslator()
    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();

        ElementModelImpl em = new ElementModelImpl();

        em.setElementName("fred");
        em.setContentTranslator("smart");

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);
        schema.setModule(m);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

    public void testGetContentTranslatorUnspecified()
    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();

        ElementModelImpl em = new ElementModelImpl();

        em.setElementName("fred");
        // No content handler specified

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);
        schema.setModule(m);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

    public void testGetAttributeTranslator()
    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();

        ElementModelImpl em = new ElementModelImpl();

        AttributeModelImpl am = new AttributeModelImpl();
        am.setName("wife");
        am.setTranslator("service");

        em.setElementName("fred");
        em.addAttributeModel(am);

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadAttributeRule rule = new ReadAttributeRule();
        rule.setPropertyName("value");
        rule.setAttributeName("wife");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);
        schema.setModule(m);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

    }

    public void testKeyedElement()
    {
        ElementModelImpl em = new ElementModelImpl();

        em.setElementName("cartoon");
        em.setKeyAttribute("name");

        AttributeModelImpl am = new AttributeModelImpl();
        am.setName("name");
        am.setTranslator("cartoon");

        em.addAttributeModel(am);

        em.addRule(new CreateObjectRule("StringHolderImpl"));

        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);

        MockControl control = newControl(Module.class);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

     * is marked unique and is translated by translator 'qualified-id'. Both contributed elements
     * use same untranslated value in the unique attribute. Fixes HIVEMIND-100.
     */
    public void testUniqueElement()
    {
        ElementModelImpl em = new ElementModelImpl();

        em.setElementName("cartoon");

        AttributeModelImpl am = new AttributeModelImpl();
        am.setName("name");
        am.setTranslator("qualified-id");
        am.setUnique(true);

        em.addAttributeModel(am);

        em.addRule(new CreateObjectRule("StringHolderImpl"));

        ReadAttributeRule rule = new ReadAttributeRule();
        rule.setAttributeName("name");
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);

        MockControl control1 = newControl(Module.class);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        elementModel.addRule(rule);
    }

    private void enterPushAttribute(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();

        PushAttributeRule rule = new PushAttributeRule();

        push(elementName, rule, STATE_NO_CONTENT);

        checkAttributes();

        rule.setAttributeName(getAttribute("attribute"));

        elementModel.addRule(rule);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        elementModel.addRule(rule);
    }

    private void enterPushContent(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();

        PushContentRule rule = new PushContentRule();

        push(elementName, rule, STATE_NO_CONTENT);

        checkAttributes();

        elementModel.addRule(rule);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        // <element> is recursive ... possible, but tricky, if using Digester.

        if (elementName.equals("element"))
        {
            ElementModelImpl elementModel = (ElementModelImpl) peekObject();

            elementModel.addElementModel(enterElement(elementName));
            return;
        }

        unexpectedElement(elementName);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        element.setContent(peekContent());
    }

    private void enterAttribute(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();

        AttributeModelImpl attributeModel = new AttributeModelImpl();

        push(elementName, attributeModel, STATE_NO_CONTENT);

        checkAttributes();

        attributeModel.setName(getAttribute("name"));
        attributeModel.setRequired(getBooleanAttribute("required", false));
        attributeModel.setUnique(getBooleanAttribute("unique", false));
        attributeModel.setTranslator(getAttribute("translator", "smart"));
        attributeModel.setDefault(getAttribute("default"));

        elementModel.addAttributeModel(attributeModel);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        md.addSchemaAssignment(sad);
    }

    private void enterConversion(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();

        ConversionDescriptor cd = new ConversionDescriptor(_errorHandler, elementModel);

        push(elementName, cd, STATE_CONVERSION);

        checkAttributes();

        cd.setClassName(getAttribute("class"));

        String methodName = getAttribute("parent-method");

        if (methodName != null)
            cd.setParentMethodName(methodName);

        elementModel.addRule(cd);
    }
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.