Package org.apache.hivemind.schema.rules

Examples of org.apache.hivemind.schema.rules.ReadAttributeRule


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


    }

    private void enterReadAttribute(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();
        ReadAttributeRule rule = new ReadAttributeRule();

        push(elementName, rule, STATE_NO_CONTENT);

        checkAttributes();

        rule.setPropertyName(getAttribute("property"));
        rule.setAttributeName(getAttribute("attribute"));
        rule.setSkipIfNull(getBooleanAttribute("skip-if-null", true));
        rule.setTranslator(getAttribute("translator"));

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

                rule.setAttribute("attribute", par.getAttributeName());
            }
            else if (r instanceof ReadAttributeRule)
            {
                ReadAttributeRule rar = (ReadAttributeRule) r;
                rule = _document.createElement("read-attribute");

                rule.setAttribute("property", rar.getPropertyName());
                rule.setAttribute("attribute", rar.getAttributeName());
                if (!rar.getSkipIfNull())
                    rule.setAttribute("skip-if-null", "false");
                if (rar.getTranslator() != null)
                    rule.setAttribute("translator", rar.getTranslator());
            }
            else if (r instanceof ReadContentRule)
            {
                ReadContentRule rcr = (ReadContentRule) r;
                rule = _document.createElement("read-content");
View Full Code Here

        assertEquals(5, rl.size());

        CreateObjectRule rule1 = (CreateObjectRule) rl.get(0);
        assertEquals("package.Foo1", rule1.getClassName());

        ReadAttributeRule rule2 = (ReadAttributeRule) rl.get(1);

        assertEquals("bazomatic", rule2.getPropertyName());
        assertEquals("bar", rule2.getAttributeName());
        assertEquals(true, rule2.getSkipIfNull());

        ReadContentRule rule3 = (ReadContentRule) rl.get(2);

        assertEquals("description", rule3.getPropertyName());
View Full Code Here

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

        assertEquals(5, rl.size());

        CreateObjectRule rule1 = (CreateObjectRule) rl.get(0);
        assertEquals("package.Foo1", rule1.getClassName());

        ReadAttributeRule rule2 = (ReadAttributeRule) rl.get(1);

        assertEquals("bazomatic", rule2.getPropertyName());
        assertEquals("bar", rule2.getAttributeName());
        assertEquals(true, rule2.getSkipIfNull());

        ReadContentRule rule3 = (ReadContentRule) rl.get(2);

        assertEquals("description", rule3.getPropertyName());
View Full Code Here

                (AttributeMappingDescriptor) _attributeMappings.get(attributeName);

            if (amd == null)
            {
                _elementModel.addRule(
                    new ReadAttributeRule(
                        attributeName,
                        constructPropertyName(attributeName),
                        null,
                        getLocation()));
            }
            else
            {
                String propertyName = amd.getPropertyName();
                if (propertyName == null)
                    propertyName = constructPropertyName(attributeName);

                _elementModel.addRule(
                    new ReadAttributeRule(attributeName, propertyName, null, amd.getLocation()));

                _attributeMappings.remove(attributeName);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.schema.rules.ReadAttributeRule

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.