Package org.jboss.seam.wiki.core.plugin.metamodel

Examples of org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule


        // Iterate through the XML descriptor and bind every <macro> to corresponding metamodel instances
        List<Element> macroPlugins = root.elements("macro");
        for (Element descriptor : macroPlugins) {

            String moduleKey = descriptor.attributeValue("key");
            MacroPluginModule module = new MacroPluginModule(plugin, moduleKey);

            log.debug("binding macro plugin module: " + module.getFullyQualifiedKey());

            bindLabelDescription(descriptor, module, plugin);
            bindMacroApplicableTo(descriptor, module);
            bindMacroRenderOptions(descriptor, module);
            bindSkins(descriptor, module);
            bindCacheRegions(descriptor, module);

            String macroName = descriptor.attributeValue("name");
            if (registry.getMacroPluginModulesByMacroName().containsKey(macroName)) {
                throw new InvalidWikiConfigurationException("Duplicate macro name, needs to be globally unique: " + macroName);
            }
            module.setName(macroName);

            // Finally, bind it
            plugin.getModules().add(module);
            registry.getMacroPluginModulesByKey().put(module.getFullyQualifiedKey(), module);
            registry.getMacroPluginModulesByMacroName().put(module.getName(), module);
        }

    }
View Full Code Here


                preferenceRegistry.getPreferenceEntities(PreferenceVisibility.INSTANCE);
        for (PreferenceEntity entity : entitiesWithInstanceProperties) {
            if (entity.getMappedTo() != null && entity.getMappedTo().length() > 0) {
                // All INSTANCE properties of this entity are for one macro, ignore whatever is configured on the properties
                String macroPluginKey = entity.getMappedTo();
                MacroPluginModule macroPluginModule = registry.getMacroPluginModulesByKey().get(macroPluginKey);
                if (macroPluginModule != null) {
                    log.debug("binding all INSTANCE properties as parameters of macro '" + macroPluginModule.getName() +"': " + entity);
                    macroPluginModule.setPreferenceEntity(entity);
                } else {
                    throw new InvalidWikiConfigurationException(
                        "Configured mapping to macro module '"+macroPluginKey+"' not found for " + entity
                    );
                }
            } else {
                // Some INSTANCE properties are for one macro, others for other macros, so we need to mix and match
                for (PreferenceEntity.Property property : entity.getPropertiesInstanceVisible()) {
                    if (property.getMappedTo() == null || property.getMappedTo().length() == 0) continue;
                   
                    String macroPluginKey = property.getMappedTo();
                    MacroPluginModule macroPluginModule = registry.getMacroPluginModulesByKey().get(macroPluginKey);
                    if (macroPluginModule != null) {
                        log.debug("binding INSTANCE property as parameter of macro '" + macroPluginModule.getName() +"': " + property);
                        macroPluginModule.setPreferenceEntity(entity);
                        macroPluginModule.getParameters().add(property);
                    } else {
                        throw new InvalidWikiConfigurationException(
                            "Configured mapping to macro module  '"+macroPluginKey+"' not found for " + property + " in " + entity
                        );
                    }
View Full Code Here

TOP

Related Classes of org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule

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.