Package org.andromda.core.cartridge.template

Examples of org.andromda.core.cartridge.template.ModelElement


        // - handle the templates WITH model elements
        if (templateModelElements != null && !templateModelElements.isEmpty())
        {
            for (final Iterator iterator = templateModelElements.getModelElements().iterator(); iterator.hasNext();)
            {
                final ModelElement templateModelElement = (ModelElement)iterator.next();

                // - if the template model element has a stereotype
                //   defined, then we filter the metafacades based
                //   on that stereotype, otherwise we get all metafacades
                //   and let the templateModelElement perform filtering on the
                //   metafacades by type and properties
                if (templateModelElement.hasStereotype())
                {
                    templateModelElement.setMetafacades(
                        factory.getMetafacadesByStereotype(templateModelElement.getStereotype()));
                }
                else if (templateModelElement.hasTypes())
                {
                    templateModelElement.setMetafacades(factory.getAllMetafacades());
                }
            }
            this.processTemplateWithMetafacades(
                factory,
                template);
View Full Code Here


                    // - now place the collections of elements by the given variable names.
                    //   (skip if the variable is NOT defined)
                    for (final Iterator iterator = modelElements.getModelElements().iterator(); iterator.hasNext();)
                    {
                        final ModelElement modelElement = (ModelElement)iterator.next();
                        final String modelElementVariable = modelElement.getVariable();
                        if (modelElementVariable != null && modelElementVariable.trim().length() > 0)
                        {
                            // - if a modelElement has the same variable defined
                            //   more than one time, then get the existing
                            //   model elements added from the last iteration
                            //   and add the new ones to that collection
                            Collection metafacades = (Collection)templateContext.get(modelElementVariable);
                            if (metafacades != null)
                            {
                                metafacades.addAll(modelElement.getMetafacades());
                            }
                            else
                            {
                                metafacades = modelElement.getMetafacades();
                                templateContext.put(
                                    modelElementVariable,
                                    new LinkedHashSet(metafacades));
                            }
                        }
                    }
                    this.processWithTemplate(
                        template,
                        templateContext,
                        null,
                        null);
                }
                else
                {
                    // - if outputToSingleFile isn't true, then
                    //   we just place the model element with the default
                    //   variable defined on the <modelElements/> into the
                    //   template.
                    for (final Iterator iterator = allMetafacades.iterator(); iterator.hasNext();)
                    {
                        final Map templateContext = new LinkedHashMap();
                        final Object metafacade = iterator.next();
                        final ModelAccessFacade model = factory.getModel();
                        for (final Iterator elements = modelElements.getModelElements().iterator(); elements.hasNext();)
                        {
                            final ModelElement modelElement = (ModelElement)elements.next();
                            String variable = modelElement.getVariable();

                            // - if the variable isn't defined on the <modelElement/>, try
                            //   the <modelElements/>
                            if (variable == null || variable.trim().length() == 0)
                            {
View Full Code Here

        Collection modelElements = template.getSupportedModeElements().getModelElements();
        assertNotNull(modelElements);
        assertEquals(
            1,
            modelElements.size());
        ModelElement element = (ModelElement)modelElements.iterator().next();
        assertEquals(
            "Entity",
            element.getStereotype());

        // second template
        template = (Template)templateIterator.next();
        assertEquals(
            "templates/webservice/axis/server-config.wsdd.vsl",
            template.getPath());
        assertEquals(
            "WEB-INF/server-config.wsdd",
            template.getOutputPattern());
        assertEquals(
            "axis-configuration",
            template.getOutlet());
        assertEquals("$viewType.equals('jsp')", template.getOutputCondition());
        assertTrue(template.isOverwrite());
        assertTrue(template.isOutputToSingleFile());
        assertFalse(template.isOutputOnEmptyElements());
        assertNotNull(template.getSupportedModeElements());
        assertEquals(
            "services",
            template.getSupportedModeElements().getVariable());
        modelElements = template.getSupportedModeElements().getModelElements();
        assertNotNull(modelElements);
        assertEquals(
            1,
            modelElements.size());
        element = (ModelElement)modelElements.iterator().next();
        assertNull(element.getVariable());
        assertNull(element.getStereotype());
       
        final Collection types = element.getTypes();
        assertNotNull(types);
        assertEquals(1, types.size());
        final Type type = (Type)types.iterator().next();
        final Collection properties = type.getProperties();
        assertEquals(2, properties.size());
View Full Code Here

TOP

Related Classes of org.andromda.core.cartridge.template.ModelElement

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.