/** * Retrieve property definitions for properties that are not in a group. The list is sorted by property definition * order index, then by name. * * <p/>DO NOT use this for updating the collection, as the updates will not be persisted! * * <p/> * * @return the set of properties that are not in a group * * @see #getPropertyDefinitions() */ @NotNull public List<PropertyDefinition> getNonGroupedProperties() { List<PropertyDefinition> propertyDefinitions = new ArrayList<PropertyDefinition>(); for (PropertyDefinition propertyDefinition : this.propertyDefinitions.values()) { if (propertyDefinition.getPropertyGroupDefinition() == null) { propertyDefinitions.add(propertyDefinition); } } Collections.sort(propertyDefinitions, new PropertyDefinitionComparator()); return propertyDefinitions; }
/** * Goes through the properties of this definition and builds a list of the groups that contain its properties. The * list is sorted by group order index, then by name. * * <p/>NOTE: updates of the result List will not be reflected in the database! * * @return all groups holding properties in this definition */ @NotNull public List<PropertyGroupDefinition> getGroupDefinitions() { Set<PropertyGroupDefinition> groupSet = new HashSet<PropertyGroupDefinition>(); for (PropertyDefinition propertyDefinition : getPropertyDefinitions().values()) { if (propertyDefinition.getPropertyGroupDefinition() != null) { groupSet.add(propertyDefinition.getPropertyGroupDefinition()); } } List<PropertyGroupDefinition> groups = new ArrayList<PropertyGroupDefinition>(groupSet.size()); for (PropertyGroupDefinition group : groupSet) { groups.add(group); } Collections.sort(groups, new GroupComparator()); return groups; }
/** * Retrieve property definitions for properties in a group with the provided name. The list is sorted by property * definition order index, then by name. * * <p/>NOTE: updates of the result List will not be reflected in the database! * * @param groupName the name of the group * * @return the set of properties in a group with the provided name */ @NotNull public List<PropertyDefinition> getPropertiesInGroup(String groupName) { List<PropertyDefinition> propertyDefinitions = new ArrayList<PropertyDefinition>(); for (PropertyDefinition propertyDefinition : this.propertyDefinitions.values()) { PropertyGroupDefinition group = propertyDefinition.getPropertyGroupDefinition(); if ((group != null) && group.getName().equals(groupName)) { propertyDefinitions.add(propertyDefinition); } } Collections.sort(propertyDefinitions, new PropertyDefinitionComparator()); return propertyDefinitions; }
existingProperty.setReadOnly(newProperty.isReadOnly()); existingProperty.setSummary(newProperty.isSummary()); existingProperty.setPropertyGroupDefinition(newProperty.getPropertyGroupDefinition());