Package org.jboss.seam.wiki.preferences.metamodel

Examples of org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity


            }

            protected void invokeApplication() throws Exception {

                PreferenceRegistry registry = (PreferenceRegistry)getInstance(PreferenceRegistry.class);
                PreferenceEntity docEditorEntity = registry.getPreferenceEntitiesByName().get("DocEditor");

                invokeMethod("#{userHome.initPreferencesEditor}");

                PreferenceEditor prefEditor = (PreferenceEditor)getInstance(PreferenceEditor.class);
                prefEditor.selectPreferenceEntity(docEditorEntity);
View Full Code Here


            }

            protected void invokeApplication() throws Exception {

                PreferenceRegistry registry = (PreferenceRegistry)getInstance(PreferenceRegistry.class);
                PreferenceEntity wikiEntity = registry.getPreferenceEntitiesByName().get("Wiki");

                invokeMethod("#{adminHome.initPreferencesEditor}");

                PreferenceEditor prefEditor = (PreferenceEditor)getInstance(PreferenceEditor.class);
                prefEditor.selectPreferenceEntity(wikiEntity);
View Full Code Here

        log.debug("assembling preference values for '"
                    + preferenceEntityName
                    + "' and user '" + user
                    + "' and wiki macro ' " + instance + "'");

        PreferenceEntity entity = preferenceRegistry.getPreferenceEntitiesByName().get(preferenceEntityName);
        SortedSet<PreferenceValue> valueHolders = new TreeSet<PreferenceValue>();

        Set<PreferenceValue> systemValueHolders = null;
        if (visibilities.contains(PreferenceVisibility.SYSTEM)) {
            log.trace("retrieving SYSTEM preference values from database");

            systemValueHolders = loadSystemValues(preferenceEntityName);

            // Check if all SYSTEM-level properties were present in the database
            for (PreferenceEntity.Property systemVisibleProperty : entity.getPropertiesSystemVisible()) {
                WikiPreferenceValue newValueHolder = new WikiPreferenceValue(systemVisibleProperty);
                // If not, queue a new value holder (with a null "value") for that property and return it
                if (!systemValueHolders.contains(newValueHolder)) {
                    systemValueHolders.add(newValueHolder);
                    newValueHolders.add(newValueHolder);
                }
            }
            valueHolders.addAll(systemValueHolders);
        }

        Set<PreferenceValue> userValueHolders;
        if (visibilities.contains(PreferenceVisibility.USER)) {
            if (user == null)
                throw new IllegalArgumentException("can't load preferences for null user");
            log.trace("retrieving USER preference values from database");

            userValueHolders = loadUserValues(preferenceEntityName, user);

            // We need them when we iterate through missing properties next
            if (systemValueHolders == null) systemValueHolders = loadSystemValues(preferenceEntityName);

            // Check if all USER-level properties were present in the database
            for (PreferenceEntity.Property userVisibleProperty : entity.getPropertiesUserVisible()) {
                WikiPreferenceValue newValueHolder = new WikiPreferenceValue(userVisibleProperty);

                // If not, queue a new value for that property and return it
                if (!userValueHolders.contains(newValueHolder)) {
                    log.trace("creating new preference value for user, missing in database " + userVisibleProperty);
View Full Code Here

        return new HashSet(values);
    }

    private Set<PreferenceValue> loadInstanceValues(String entityName, WikiPluginMacro instance) {
        Set<PreferenceValue> valueHolders = new HashSet<PreferenceValue>();
        PreferenceEntity preferenceEntity = preferenceRegistry.getPreferenceEntitiesByName().get(entityName);
        for (Map.Entry<String, String> entry : instance.getParams().entrySet()) {
            log.trace("converting WikiMacro parameter into WikiPreferenceValue: " + entry.getKey());

            // TODO: Maybe we should log the following as DEBUG level, these occur when the user edits macro parameters

            PreferenceEntity.Property property = preferenceEntity.getPropertiesByName().get(entry.getKey());
            if (property == null) {
                log.info("can't convert unknown property as WikiMacro parameter: " + entry.getKey());
                continue;
            }
            if (!property.getVisibility().contains(PreferenceVisibility.INSTANCE)) {
View Full Code Here

            }
        }
    }

    private boolean setPropertyReference(WikiPreferenceValue value, String entityName, PreferenceVisibility visibility) {
        PreferenceEntity entity = preferenceRegistry.getPreferenceEntitiesByName().get(entityName);
        if (entity == null) {
            log.warn("orphaned preference value found in database, please clean up: " + value);
            return false;
        }
        PreferenceEntity.Property property = entity.getPropertiesByName().get(value.getPropertyName());
        if (property == null) {
            log.warn("orphaned preference value found in database, please clean up: " + value);
            return false;
        }
        if (!property.getVisibility().contains(visibility)) {
View Full Code Here

            }

            protected void invokeApplication() throws Exception {

                PreferenceRegistry registry = (PreferenceRegistry)getInstance(PreferenceRegistry.class);
                PreferenceEntity wikiEntity = registry.getPreferenceEntitiesByName().get("Wiki");

                invokeMethod("#{adminHome.initPreferencesEditor}");

                PreferenceEditor prefEditor = (PreferenceEditor)getInstance(PreferenceEditor.class);
                prefEditor.selectPreferenceEntity(wikiEntity);
View Full Code Here

TOP

Related Classes of org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity

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.