Package org.rhq.core.domain.configuration.definition

Examples of org.rhq.core.domain.configuration.definition.PropertyDefinitionEnumeration


            String name = option.getName();
            if (name == null) {
                name = option.getValue();
            }

            PropertyDefinitionEnumeration enumeration = new PropertyDefinitionEnumeration(name, option.getValue());
            parentProperty.addEnumeratedValues(enumeration);
        }

        parentProperty.setAllowCustomEnumeratedValue(options.isAllowCustomValue());
View Full Code Here


        pd.setReadOnly(false);
        pd.setSummary(true);
        pd.setOrder(4);
        pd.setConfigurationDefinition(configDef);

        PropertyDefinitionEnumeration normalEnum = new PropertyDefinitionEnumeration(DriftHandlingMode.normal.name(),
            DriftHandlingMode.normal.name());
        normalEnum.setOrderIndex(0);

        PropertyDefinitionEnumeration plannedEnum = new PropertyDefinitionEnumeration(DriftHandlingMode.plannedChanges
            .name(), DriftHandlingMode.plannedChanges.name());
        plannedEnum.setOrderIndex(1);

        ArrayList<PropertyDefinitionEnumeration> pdEnums = new ArrayList<PropertyDefinitionEnumeration>(2);
        pdEnums.add(normalEnum);
        pdEnums.add(plannedEnum);
        pd.setEnumeratedValues(pdEnums, false);
View Full Code Here

        pd.setDisplayName("Value Context");
        pd.setReadOnly(readOnly);
        pd.setSummary(true);
        pd.setOrder(0);

        PropertyDefinitionEnumeration pcEnum = new PropertyDefinitionEnumeration(
            BaseDirValueContext.pluginConfiguration.name(), BaseDirValueContext.pluginConfiguration.name());
        pcEnum.setOrderIndex(0);

        PropertyDefinitionEnumeration rcEnum = new PropertyDefinitionEnumeration(
            BaseDirValueContext.resourceConfiguration.name(), BaseDirValueContext.resourceConfiguration.name());
        rcEnum.setOrderIndex(1);

        PropertyDefinitionEnumeration mtEnum = new PropertyDefinitionEnumeration(BaseDirValueContext.measurementTrait
            .name(), BaseDirValueContext.measurementTrait.name());
        mtEnum.setOrderIndex(2);

        PropertyDefinitionEnumeration fsEnum = new PropertyDefinitionEnumeration(BaseDirValueContext.fileSystem.name(),
            BaseDirValueContext.fileSystem.name());
        fsEnum.setOrderIndex(3);

        ArrayList<PropertyDefinitionEnumeration> pdEnums = new ArrayList<PropertyDefinitionEnumeration>(4);
        pdEnums.add(pcEnum);
        pdEnums.add(rcEnum);
        pdEnums.add(mtEnum);
View Full Code Here

            "a String enum prop with <=5 items - should be rendered as radio buttons", false,
            PropertySimpleType.STRING);
        simplePropDef.setDisplayName(simplePropDef.getName());
        defaultConfiguration.put(new PropertySimple("StringEnum1", "NJ"));
        ArrayList<PropertyDefinitionEnumeration> propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
        propDefEnums.add(new PropertyDefinitionEnumeration("NY", "NY"));
        propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ"));
        propDefEnums.add(new PropertyDefinitionEnumeration("PA", "PA"));
        simplePropDef.setEnumeratedValues(propDefEnums, false);
        addPropertyDefinition(configDef, simplePropDef, orderIndex++);

        simplePropDef = new PropertyDefinitionSimple("StringEnum2",
            "a String enum prop with >5 items - should be rendered as a popup menu", false, PropertySimpleType.STRING);
        simplePropDef.setDisplayName(simplePropDef.getName());
        defaultConfiguration.put(new PropertySimple("StringEnum2", "blue"));
        propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
        propDefEnums.add(new PropertyDefinitionEnumeration("red", "red"));
        propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange"));
        propDefEnums.add(new PropertyDefinitionEnumeration("yellow", "yellow"));
        propDefEnums.add(new PropertyDefinitionEnumeration("green", "green"));
        propDefEnums.add(new PropertyDefinitionEnumeration("blue", "blue"));
        propDefEnums.add(new PropertyDefinitionEnumeration("purple", "purple"));
        simplePropDef.setEnumeratedValues(propDefEnums, false);
        addPropertyDefinition(configDef, simplePropDef, orderIndex++);

        PropertyDefinitionMap mapPropDef = new PropertyDefinitionMap("MapOfSimples", "a map of simples", false);
        mapPropDef.put(createStringPropDef1());
        mapPropDef.put(createStringPropDef2());
        mapPropDef.put(createBooleanPropDef());
        mapPropDef.put(createIntegerPropDef());
        mapPropDef.setDisplayName(mapPropDef.getName());
        addPropertyDefinition(configDef, mapPropDef, orderIndex++);

        PropertyDefinitionMap openMapPropDef = new PropertyDefinitionMap("OpenMapOfSimples", "an open map of simples",
            false);
        openMapPropDef.setDisplayName(openMapPropDef.getName());
        addPropertyDefinition(configDef, openMapPropDef, orderIndex++);

        PropertyDefinitionMap readOnlyOpenMapPropDef = new PropertyDefinitionMap("ReadOnlyOpenMapOfSimples",
            "a read-only open map of simples", false);
        readOnlyOpenMapPropDef.setDisplayName(readOnlyOpenMapPropDef.getName());
        readOnlyOpenMapPropDef.setReadOnly(true);
        addPropertyDefinition(configDef, readOnlyOpenMapPropDef, orderIndex++);

        PropertyDefinitionList listOfSimplesPropDef = new PropertyDefinitionList("ListOfSimples",
            "a list of Integer simples", true, new PropertyDefinitionSimple("integer", "an integer", false,
                PropertySimpleType.INTEGER));
        listOfSimplesPropDef.setDisplayName(listOfSimplesPropDef.getName());
        listOfSimplesPropDef.setMax(listOfSimplesPropDef.getMax());
        listOfSimplesPropDef.setMin(listOfSimplesPropDef.getMin());
        addPropertyDefinition(configDef, listOfSimplesPropDef, orderIndex++);

        PropertyDefinitionMap mapInListPropDef =
            new PropertyDefinitionMap("MapOfSimplesInList", "a map of simples in a list", false);
        mapInListPropDef.put(createStringPropDef1());
        mapInListPropDef.put(createStringPropDef2());
        mapInListPropDef.put(createBooleanPropDef());
        mapInListPropDef.put(createIntegerPropDef());
        mapInListPropDef.setDisplayName(mapInListPropDef.getName());

        PropertyDefinitionList listPropDef = new PropertyDefinitionList("ListOfMaps", "a list of maps", true,
            mapInListPropDef);
        listPropDef.setDisplayName(listPropDef.getName());
        addPropertyDefinition(configDef, listPropDef, orderIndex++);

        PropertyDefinitionMap mapInReadOnlyListPropDef =
            new PropertyDefinitionMap("MapOfSimplesInReadOnlyList", "a map of simples in a list", false);
        PropertyDefinitionSimple propDef = createStringPropDef1();
        propDef.setReadOnly(true);
        mapInReadOnlyListPropDef.put(propDef);
        propDef = createStringPropDef2();
        propDef.setReadOnly(true);
        mapInReadOnlyListPropDef.put(propDef);
        propDef = createBooleanPropDef();
        propDef.setReadOnly(true);
        mapInReadOnlyListPropDef.put(propDef);
        propDef = createIntegerPropDef();
        propDef.setReadOnly(true);
        mapInReadOnlyListPropDef.put(propDef);
        mapInReadOnlyListPropDef.setDisplayName(mapInReadOnlyListPropDef.getName());

        PropertyDefinitionList readOnlyListPropDef = new PropertyDefinitionList("ReadOnlyListOfMaps",
            "a read-only list of maps", true, mapInReadOnlyListPropDef);
        readOnlyListPropDef.setDisplayName(readOnlyListPropDef.getName());
        readOnlyListPropDef.setReadOnly(true);
        addPropertyDefinition(configDef, readOnlyListPropDef, orderIndex++);

        PropertyGroupDefinition propertyGroupDefinition = new PropertyGroupDefinition("myGroup");
        propertyGroupDefinition.setDisplayName(propertyGroupDefinition.getName());
        propertyGroupDefinition.setDescription("this is an example group");

        PropertyDefinitionSimple myString = new PropertyDefinitionSimple("myString1", "my little string", true,
            PropertySimpleType.STRING);
        myString.setDisplayName(myString.getName());
        myString.setSummary(true);
        addPropertyDefinition(configDef, myString, orderIndex++);
        myString.setPropertyGroupDefinition(propertyGroupDefinition);

        PropertyDefinitionSimple myString2 = new PropertyDefinitionSimple("myString2", "my other little string", true,
            PropertySimpleType.STRING);
        myString2.setDisplayName(myString2.getName());
        myString2.setSummary(true);
        addPropertyDefinition(configDef, myString2, orderIndex++);
        myString2.setPropertyGroupDefinition(propertyGroupDefinition);

        PropertyGroupDefinition propertyGroupDefinition2 = new PropertyGroupDefinition("myGroup2");
        propertyGroupDefinition2.setDisplayName(propertyGroupDefinition2.getName());
        propertyGroupDefinition2.setDescription("this is another example group");

        PropertyDefinitionSimple myString3 = new PropertyDefinitionSimple("myString3", "my third string", true,
            PropertySimpleType.STRING);
        myString3.setDisplayName((myString3.getName()));
        myString3.setSummary(true);
        addPropertyDefinition(configDef, myString3, orderIndex++);
        myString3.setPropertyGroupDefinition(propertyGroupDefinition2);

        PropertyDefinitionSimple enumExample = new PropertyDefinitionSimple("myEnum",
            "a grouped enum prop with <=5 items", false, PropertySimpleType.STRING);
        enumExample.setDisplayName(enumExample.getName());
        defaultConfiguration.put(new PropertySimple("myEnum", "Burlington"));
        ArrayList<PropertyDefinitionEnumeration> myEnums = new ArrayList<PropertyDefinitionEnumeration>();
        myEnums.add(new PropertyDefinitionEnumeration("Burlington", "Burlington"));
        myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden"));
        myEnums.add(new PropertyDefinitionEnumeration("Gloucester", "Gloucester"));
        enumExample.setEnumeratedValues(myEnums, false);
        addPropertyDefinition(configDef, enumExample, orderIndex++);
        enumExample.setPropertyGroupDefinition(propertyGroupDefinition2);

        return configDef;
View Full Code Here

            // filter if the user provided a filter
            if (filterPattern != null) {
                Matcher m = filterPattern.matcher(name);
                if (m.matches()) {
                    PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name);
                    pds.getEnumeratedValues().add(pde);
                }
            } else { // Filter is null -> none provided -> do not filter
                PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name);
                pds.getEnumeratedValues().add(pde);
            }
        } else if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
            //  for configuration we need to drill down into the resource configuration
            if (!handleConfigurationTarget(resource, baseResource, pds, expression, foundResource))
View Full Code Here

            for (Property tmp : propertyList) {
                PropertySimple ps = (PropertySimple) tmp;
                String name = ps.getStringValue();
                if (name != null) {
                    PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
                    pds.getEnumeratedValues().add(pde);
                }
            }
        } else if (propertyList.get(0) instanceof PropertyMap) {
            if (!isMapOrList) {
                LOG.warn(resource + " in " + baseResource + ": expected a List of simple, but got a list of Maps");
                return false;
            }
            String subPropName;
            subPropName = expression.substring(expression.indexOf("=") + 1);

            for (Property tmp : propertyList) {
                PropertyMap pm = (PropertyMap) tmp;
                Property ps = pm.get(subPropName);
                if (ps == null) {
                    LOG.warn(resource + " in " + baseResource + ": option source expression for property "
                        + pds.getName() + " and target configuration does not have a map element " + subPropName);
                    return false;
                }
                if (!(ps instanceof PropertySimple)) {
                    LOG.warn(resource + " in " + baseResource + ": ListOfMapOf!Simple are not supported");
                    return false;
                }
                PropertySimple propertySimple = (PropertySimple) ps;
                String name = propertySimple.getStringValue();
                if (name != null) {
                    PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
                    pds.getEnumeratedValues().add(pde);
                }
            }
        }
View Full Code Here

        simplePropDef = new PropertyDefinitionSimple("StringEnum1",
            "a String enum prop with <=5 items - should be rendered as radio buttons", false, PropertySimpleType.STRING);
        simplePropDef.setDisplayName(simplePropDef.getName());
        defaultConfiguration.put(new PropertySimple("StringEnum1", "NJ"));
        ArrayList<PropertyDefinitionEnumeration> propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
        propDefEnums.add(new PropertyDefinitionEnumeration("NY", "NY"));
        propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ"));
        propDefEnums.add(new PropertyDefinitionEnumeration("PA", "PA"));
        simplePropDef.setEnumeratedValues(propDefEnums, false);
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = new PropertyDefinitionSimple("StringEnum2",
            "a String enum prop with >5 items - should be rendered as a popup menu", false, PropertySimpleType.STRING);
        simplePropDef.setDisplayName(simplePropDef.getName());
        defaultConfiguration.put(new PropertySimple("StringEnum2", "blue"));
        propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
        propDefEnums.add(new PropertyDefinitionEnumeration("red", "red"));
        propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange"));
        propDefEnums.add(new PropertyDefinitionEnumeration("yellow", "yellow"));
        propDefEnums.add(new PropertyDefinitionEnumeration("green", "green"));
        propDefEnums.add(new PropertyDefinitionEnumeration("blue", "blue"));
        propDefEnums.add(new PropertyDefinitionEnumeration("purple", "purple"));
        simplePropDef.setEnumeratedValues(propDefEnums, false);
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        PropertyDefinitionMap mapPropDef = new PropertyDefinitionMap("MapOfSimples", "a map of simples", false);
        mapPropDef.put(createStringPropDef1());
        mapPropDef.put(createStringPropDef2());
        mapPropDef.put(createIntegerPropDef());
        mapPropDef.setDisplayName(mapPropDef.getName());
        propertyDefinitions.put(mapPropDef.getName(), mapPropDef);

        PropertyDefinitionMap openMapPropDef = new PropertyDefinitionMap("OpenMapOfSimples", "an open map of simples",
            false);
        openMapPropDef.setDisplayName(openMapPropDef.getName());
        propertyDefinitions.put(openMapPropDef.getName(), openMapPropDef);

        PropertyDefinitionMap readOnlyOpenMapPropDef = new PropertyDefinitionMap("ReadOnlyOpenMapOfSimples",
            "a read-only open map of simples", false);
        readOnlyOpenMapPropDef.setDisplayName(readOnlyOpenMapPropDef.getName());
        readOnlyOpenMapPropDef.setReadOnly(true);
        propertyDefinitions.put(readOnlyOpenMapPropDef.getName(), readOnlyOpenMapPropDef);

        PropertyDefinitionList listOfSimplesPropDef = new PropertyDefinitionList("ListOfStrings",
            "another list of Strings", true, new PropertyDefinitionSimple("note", "a note", false,
                PropertySimpleType.STRING));
        listOfSimplesPropDef.setDisplayName(listOfSimplesPropDef.getName());
        propertyDefinitions.put(listOfSimplesPropDef.getName(), listOfSimplesPropDef);

        PropertyDefinitionMap mapInListPropDef = new PropertyDefinitionMap("MapOfSimplesInList", "a map of simples in a list", false);
        mapInListPropDef.put(createStringPropDef1());
        mapInListPropDef.put(createStringPropDef2());
        mapInListPropDef.put(createIntegerPropDef());
        mapInListPropDef.setDisplayName(mapInListPropDef.getName());

        PropertyDefinitionList listPropDef = new PropertyDefinitionList("ListOfMaps", "a list of maps", true,
            mapInListPropDef);
        listPropDef.setDisplayName(listPropDef.getName());
        propertyDefinitions.put(listPropDef.getName(), listPropDef);

        PropertyDefinitionMap mapInReadOnlyListPropDef = new PropertyDefinitionMap("MapOfSimplesInReadOnlyList", "a map of simples in a list", false);
        mapInReadOnlyListPropDef.put(createStringPropDef1());
        mapInReadOnlyListPropDef.put(createStringPropDef2());
        mapInReadOnlyListPropDef.put(createIntegerPropDef());
        mapInReadOnlyListPropDef.setDisplayName(mapInReadOnlyListPropDef.getName());

        PropertyDefinitionList readOnlyListPropDef = new PropertyDefinitionList("ReadOnlyListOfMaps",
            "a read-only list of maps", true, mapInReadOnlyListPropDef);
        readOnlyListPropDef.setDisplayName(readOnlyListPropDef.getName());
        readOnlyListPropDef.setReadOnly(true);
        propertyDefinitions.put(readOnlyListPropDef.getName(), readOnlyListPropDef);

        PropertyGroupDefinition propertyGroupDefinition = new PropertyGroupDefinition("myGroup");
        propertyGroupDefinition.setDisplayName(propertyGroupDefinition.getName());
        propertyGroupDefinition.setDescription("this is an example group");

        PropertyDefinitionSimple myString = new PropertyDefinitionSimple("myString1", "my little string", true,
            PropertySimpleType.STRING);
        myString.setDisplayName(myString.getName());
        myString.setSummary(true);
        propertyDefinitions.put(myString.getName(), myString);
        myString.setPropertyGroupDefinition(propertyGroupDefinition);

        PropertyDefinitionSimple myString2 = new PropertyDefinitionSimple("myString2", "my other little string", true,
            PropertySimpleType.STRING);
        myString2.setDisplayName(myString2.getName());
        myString2.setSummary(true);
        propertyDefinitions.put(myString2.getName(), myString2);
        myString2.setPropertyGroupDefinition(propertyGroupDefinition);

        PropertyGroupDefinition propertyGroupDefinition2 = new PropertyGroupDefinition("myGroup2");
        propertyGroupDefinition2.setDisplayName(propertyGroupDefinition2.getName());
        propertyGroupDefinition2.setDescription("this is another example group");

        PropertyDefinitionSimple myString3 = new PropertyDefinitionSimple("myString3", "my third string", true,
            PropertySimpleType.STRING);
        myString3.setDisplayName((myString3.getName()));
        myString3.setSummary(true);
        propertyDefinitions.put(myString3.getName(), myString3);
        myString3.setPropertyGroupDefinition(propertyGroupDefinition2);

        PropertyDefinitionSimple enumExample = new PropertyDefinitionSimple("myEnum",
            "a grouped enum prop with <=5 items", false, PropertySimpleType.STRING);
        enumExample.setDisplayName(enumExample.getName());
        defaultConfiguration.put(new PropertySimple("myEnum", "Burlington"));
        ArrayList<PropertyDefinitionEnumeration> myEnums = new ArrayList<PropertyDefinitionEnumeration>();
        myEnums.add(new PropertyDefinitionEnumeration("Burlington", "Burlington"));
        myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden"));
        myEnums.add(new PropertyDefinitionEnumeration("Gloucester", "Gloucester"));
        enumExample.setEnumeratedValues(myEnums, false);
        propertyDefinitions.put(enumExample.getName(), enumExample);
        enumExample.setPropertyGroupDefinition(propertyGroupDefinition2);

        return configurationDefinition;
View Full Code Here

                pd.setDisplayName(MSG.view_admin_systemSettings_ActiveDriftServerPlugin_name());
                pd.setPropertyGroupDefinition(driftGroup);

                List<PropertyDefinitionEnumeration> options = new ArrayList<PropertyDefinitionEnumeration>();
                for (Map.Entry<String, String> entry : driftPlugins.entrySet()) {
                    options.add(new PropertyDefinitionEnumeration(entry.getValue(), entry.getKey()));
                }

                pd.setEnumeratedValues(options, false);
                break;
            /*
 
View Full Code Here

            definition.put(new PropertyDefinitionMap("MapProp", "Map Properties", true, new PropertyDefinitionSimple(
                "IntInMap", "Integer In Map", true, PropertySimpleType.INTEGER)));

            PropertyDefinitionSimple enumeratedString = new PropertyDefinitionSimple("ConnectionType", "My conn type",
                true, PropertySimpleType.STRING);
            enumeratedString.addEnumeratedValues(new PropertyDefinitionEnumeration("Local", "local"),
                new PropertyDefinitionEnumeration("JSR160", "jsr160"), new PropertyDefinitionEnumeration("JBoss",
                    "jboss"));
            enumeratedString.setAllowCustomEnumeratedValue(true);

            PropertyGroupDefinition basicGroup = new PropertyGroupDefinition("Basic Group");
            enumeratedString.setPropertyGroupDefinition(basicGroup);
View Full Code Here

            ConfigurationDefinition def = new ConfigurationDefinition(testDefName, "test data");

            PropertyDefinitionSimple prop = new PropertyDefinitionSimple("EnumeratedProperty", "", true,
                PropertySimpleType.STRING);
            prop.addEnumeratedValues(new PropertyDefinitionEnumeration("A", "a"), new PropertyDefinitionEnumeration(
                "B", "b"));

            def.put(prop);
            em.persist(def);

            List<ConfigurationDefinition> definitions = em.createQuery(
                "select e from ConfigurationDefinition e where e.name = :name").setParameter("name", testDefName)
                .getResultList();

            for (ConfigurationDefinition definition : definitions) {
                prettyPrintConfigurationDefinition(definition);
                PropertyDefinitionSimple propDef = definition.getPropertyDefinitionSimple("EnumeratedProperty");
                System.out.println("Before: " + propDef.getEnumeratedValues());

                PropertyDefinitionEnumeration enumVal = propDef.getEnumeratedValues().remove(0);
                propDef.getEnumeratedValues().add(enumVal);

                definition = em.merge(definition);
                System.out.println("After: "
                    + definition.getPropertyDefinitionSimple("EnumeratedProperty").getEnumeratedValues());
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.definition.PropertyDefinitionEnumeration

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.