com.ibm.xtools.uml.rt.core
Class PropertyManager

java.lang.Object
  extended by com.ibm.xtools.uml.rt.core.PropertyManager

public class PropertyManager
extends java.lang.Object

Helper class for working with an element's property sets.

Author:
azito

Constructor Summary
PropertyManager(Element element)
          Creates a PropertyManager for this element.
 
Method Summary
 void applyDefaults(java.lang.String language, java.lang.String type, java.lang.String group)
          Restores the given property set (language, type, group) to its default values for this element.
 void changeValue(java.lang.String language, java.lang.String type, java.lang.String group, java.lang.String property, java.lang.Object newValue)
          Changes the value of the property in the given group for the given type to the new value.
 java.lang.String getActiveLanguage()
           
 java.lang.Package getDefaultModel()
          Gets the default model for this element.
 java.lang.String[] getGroupNames(java.lang.String language, java.lang.String type)
          Returns the names of the groups that apply to the given element type in the language.
 java.lang.String[] getLanguages()
          Returns the names of the languages of all the property set profiles that are available to this element.
 java.util.List<org.eclipse.uml2.uml.Property> getProperties(java.lang.String language, java.lang.String type, java.lang.String group)
          Returns a list of the properties for the given type in the given group.
 java.lang.String[] getTypeNames(java.lang.String language)
          Returns a list of all the type names that have property sets in the given language.
 java.lang.String[] getTypeNamesForElement(java.lang.String language)
          Gets all the type names that apply to this element in the given language.
 java.lang.Object getValue(java.lang.String language, java.lang.String type, java.lang.String group, java.lang.String property)
          Returns the value of the given property in the given group for this element.
 boolean isOverridden(java.lang.String language, java.lang.String type, java.lang.String group)
          Returns whether or not the properties in the given type/group combination have been overridden by this element.
 void setDefaultModel(URI newDefaultModelURI)
          Sets the default model of this element to the root package found at the given URI.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyManager

public PropertyManager(Element element)
Creates a PropertyManager for this element.

Parameters:
element -
Method Detail

getActiveLanguage

public java.lang.String getActiveLanguage()
Returns:
active language set for this element

isOverridden

public boolean isOverridden(java.lang.String language,
                            java.lang.String type,
                            java.lang.String group)
Returns whether or not the properties in the given type/group combination have been overridden by this element.

Parameters:
language - the name of the language
type - the name of the type
group - the name of the group
Returns:
true if the group has been overridden, false otherwise

getGroupNames

public java.lang.String[] getGroupNames(java.lang.String language,
                                        java.lang.String type)
Returns the names of the groups that apply to the given element type in the language. If no groups apply, returns an empty array.

Parameters:
language - the name of the language
type - the name of the element type
Returns:
the names of the groups

getDefaultModel

public java.lang.Package getDefaultModel()
Gets the default model for this element.

Returns:
the default model, or null if this element has no default model

setDefaultModel

public void setDefaultModel(URI newDefaultModelURI)
Sets the default model of this element to the root package found at the given URI.

Parameters:
newDefaultModelURI - the URI of the default model, or null to clear the default model

getValue

public java.lang.Object getValue(java.lang.String language,
                                 java.lang.String type,
                                 java.lang.String group,
                                 java.lang.String property)
Returns the value of the given property in the given group for this element. Returns null if the group or property do not exist, or if a value for the property cannot be found.

Parameters:
language - the name of the language
type - the name of the type
group - the name of the group
property - the name of the property (not the display name)
Returns:
the property value (Boolean for boolean properties, String for string, text or enumerated properties, Integer for integer properties)

changeValue

public void changeValue(java.lang.String language,
                        java.lang.String type,
                        java.lang.String group,
                        java.lang.String property,
                        java.lang.Object newValue)
Changes the value of the property in the given group for the given type to the new value. For string, text and enumerated types, the new value should be a String; for integer or boolean types, it should be an Integer or Boolean.

Parameters:
language - the name of the language
type - the name of the type
group - the name of the group
property - the name of the property
newValue - the new value for the property

getLanguages

public java.lang.String[] getLanguages()
Returns the names of the languages of all the property set profiles that are available to this element.

Returns:
the names of the languages

applyDefaults

public void applyDefaults(java.lang.String language,
                          java.lang.String type,
                          java.lang.String group)
Restores the given property set (language, type, group) to its default values for this element.

Parameters:
language - the name of the language
type - the name of the type
group - the name of the group

getProperties

public java.util.List<org.eclipse.uml2.uml.Property> getProperties(java.lang.String language,
                                                                   java.lang.String type,
                                                                   java.lang.String group)
Returns a list of the properties for the given type in the given group. If a group for the type/group combination doesn't exist, returns an empty list.

Parameters:
type - the name of the type
group - the group name
Returns:
the list of properties.

getTypeNames

public java.lang.String[] getTypeNames(java.lang.String language)
Returns a list of all the type names that have property sets in the given language. If there are no types, returns an empty array.

Parameters:
language - the name of the language
Returns:
the names of the element types

getTypeNamesForElement

public java.lang.String[] getTypeNamesForElement(java.lang.String language)
Gets all the type names that apply to this element in the given language.

Parameters:
language - the name of the language
Returns:
an array of type names