org.argouml.kernel
Class ProfileConfiguration

java.lang.Object
  extended by org.argouml.kernel.AbstractProjectMember
      extended by org.argouml.kernel.ProfileConfiguration
All Implemented Interfaces:
ProjectMember

public class ProfileConfiguration
extends AbstractProjectMember

This class captures represents the unique access point for the configurability allowed by the use of profiles.


Field Summary
static java.lang.String EXTENSION
          The extension used in serialization and returned by getType()
static ConfigurationKey KEY_DEFAULT_STEREOTYPE_VIEW
          The configuration key for the default stereotype view.
 
Constructor Summary
ProfileConfiguration(Project project)
          The default constructor for this class.
ProfileConfiguration(Project project, java.util.Collection<Profile> configuredProfiles)
          The constructor for pre-defined profile configurations, such as when a project is read from a saved file.
 
Method Summary
 void activateDefaultTypeStrategy(Profile profile)
          Updates the current strategy to the strategy provided by the passed profile.
 void activateFormatingStrategy(Profile profile)
          Updates the current strategy to the strategy provided by the passed profile.
 void addProfile(Profile p)
          Deprecated. for 0.29.2, because since UML2 a profile must be applied to a model
 void addProfile(Profile p, java.lang.Object m)
          Applies a new profile to this configuration and to the given model (or other profile, which could be later a collection).
 java.util.Collection findAllStereotypesForModelElement(java.lang.Object modelElement)
           
 java.util.Collection findByMetaType(java.lang.Object metaType)
          Find all the model elements in the configured Profiles of the given meta type.
 java.lang.Object findStereotypeForObject(java.lang.String name, java.lang.Object element)
          Find a stereotype with the given name which is applicable to the given element.
 java.lang.Object findType(java.lang.String name)
          Search for the given type in all of the profile models.
static java.lang.Object findTypeInModel(java.lang.String s, java.lang.Object model)
          Finds a type in a model by name FIXME: duplicated from the method with the same name in org.argouml.profile.internal.ModelUtils.
 DefaultTypeStrategy getDefaultTypeStrategy()
           
 FigNodeStrategy getFigNodeStrategy()
           
 FormatingStrategy getFormatingStrategy()
           
 java.util.List<Profile> getProfiles()
           
 java.lang.String getType()
          Used by "argo.tee".
 void removeProfile(Profile p)
          Deprecated. for 0.29.2, because since UML2 a profile must be unapplied from a model
 void removeProfile(Profile p, java.lang.Object m)
          Removes the passed profile from the configuration and unapplies it from the given model (or other profile, which could be later a collection).
 java.lang.String repair()
          Objects of this class are always consistent, there's no need to repair them.
 java.lang.String toString()
           
 
Methods inherited from class org.argouml.kernel.AbstractProjectMember
getUniqueDiagramName, getZipFileExtension, getZipName, makeUniqueName, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXTENSION

public static final java.lang.String EXTENSION
The extension used in serialization and returned by getType()

See Also:
Constant Field Values

KEY_DEFAULT_STEREOTYPE_VIEW

public static final ConfigurationKey KEY_DEFAULT_STEREOTYPE_VIEW
The configuration key for the default stereotype view.

Constructor Detail

ProfileConfiguration

public ProfileConfiguration(Project project)
The default constructor for this class. Sets the default profiles as given by ProfileManager as the profiles of the project.

Parameters:
project - the project that contains this configuration

ProfileConfiguration

public ProfileConfiguration(Project project,
                            java.util.Collection<Profile> configuredProfiles)
The constructor for pre-defined profile configurations, such as when a project is read from a saved file.

Parameters:
project - the project that contains this configuration
configuredProfiles - the Profiles that will be the project profiles
Method Detail

getFormatingStrategy

public FormatingStrategy getFormatingStrategy()
Returns:
the current formating strategy

getDefaultTypeStrategy

public DefaultTypeStrategy getDefaultTypeStrategy()
Returns:
the current default type strategy

activateDefaultTypeStrategy

public void activateDefaultTypeStrategy(Profile profile)
Updates the current strategy to the strategy provided by the passed profile. The profile should have been previously registered.

Parameters:
profile - the profile providing the current default type strategy

activateFormatingStrategy

public void activateFormatingStrategy(Profile profile)
Updates the current strategy to the strategy provided by the passed profile. The profile should have been previously registered.

Parameters:
profile - the profile providing the current formating strategy

getProfiles

public java.util.List<Profile> getProfiles()
Returns:
the list of applied profiles

addProfile

@Deprecated
public void addProfile(Profile p)
Deprecated. for 0.29.2, because since UML2 a profile must be applied to a model

Applies a new profile to this configuration.

Parameters:
p - the profile to be applied

addProfile

public void addProfile(Profile p,
                       java.lang.Object m)
Applies a new profile to this configuration and to the given model (or other profile, which could be later a collection).

Parameters:
p - the profile to be applied
m - the model (or profile) to which the profile will be applied

removeProfile

@Deprecated
public void removeProfile(Profile p)
Deprecated. for 0.29.2, because since UML2 a profile must be unapplied from a model

Removes the passed profile from this configuration.

Parameters:
p - the profile to be applied

removeProfile

public void removeProfile(Profile p,
                          java.lang.Object m)
Removes the passed profile from the configuration and unapplies it from the given model (or other profile, which could be later a collection).

Parameters:
p - the profile to be removed/unapplied
m - the model (or profile) to which the profile will be unapplied

getFigNodeStrategy

public FigNodeStrategy getFigNodeStrategy()
Returns:
the current FigNodeStrategy

getType

public java.lang.String getType()
Description copied from class: AbstractProjectMember
Used by "argo.tee".

Specified by:
getType in interface ProjectMember
Specified by:
getType in class AbstractProjectMember
Returns:
the extension for this project member
See Also:
AbstractProjectMember.getType()

repair

public java.lang.String repair()
Objects of this class are always consistent, there's no need to repair them.

Returns:
the empty string.
See Also:
ProjectMember.repair()

toString

public java.lang.String toString()
Overrides:
toString in class AbstractProjectMember
Returns:
the "Profile Configuration" string
See Also:
Object.toString()

findStereotypeForObject

public java.lang.Object findStereotypeForObject(java.lang.String name,
                                                java.lang.Object element)
Find a stereotype with the given name which is applicable to the given element.

Parameters:
name - name of stereotype to look for
element - model element to which the stereotype must be applicable
Returns:
the stereotype or null if none found

findType

public java.lang.Object findType(java.lang.String name)
Search for the given type in all of the profile models.

Parameters:
name - name of type to be found
Returns:
the type or null

findTypeInModel

public static java.lang.Object findTypeInModel(java.lang.String s,
                                               java.lang.Object model)
Finds a type in a model by name FIXME: duplicated from the method with the same name in org.argouml.profile.internal.ModelUtils.

Parameters:
s - the type name
model - the model
Returns:
the type or null if the type has not been found.

findByMetaType

public java.util.Collection findByMetaType(java.lang.Object metaType)
Find all the model elements in the configured Profiles of the given meta type.

Parameters:
metaType - the meta type of the model elements to find
Returns:
a Collection containing the model elements that are of the given meta type

findAllStereotypesForModelElement

public java.util.Collection findAllStereotypesForModelElement(java.lang.Object modelElement)
Parameters:
modelElement - ModelElement for which find possible stereotypes
Returns:
collection of stereotypes which are valid for the given model element.


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook