public class UserSpecificProperties
The UserSpecificProperties class is a storage of property values which override values in custom properties of model items. The value of a property is overridden if a user checks the appropriate checkbox. This is a thread-safe singleton.
Type Params | Return Type | Name and description |
---|---|---|
|
public long |
getTotalNumberOfUnsavedProperties() It is used for analytics and returns the number of properties marked as locally stored in the current workspace. |
|
public java.lang.String |
getUserSpecificValue(Project project, ModelItem modelItem, java.lang.String name) Gets the overridden value of the property identified by the project, model item, and name. |
|
public static UserSpecificProperties |
instance() |
|
public static boolean |
isApplicableFor(ModelItem modelItem) This is the common way to check if the model item supports property value overriding. |
|
public void |
modelItemDeleted(ModelItemDeletionMessage deletionMessage) |
|
public void |
projectRemoved(ProjectRemovedMessage deletionMessage) |
|
public void |
removeUserSpecificValue(Project project, ModelItem modelItem, java.lang.String name) Removes the overridden value from the storage. |
|
public void |
saveCurrentStateToConfig() Saves the current values of the overridden properties of all supported model items. |
|
public void |
sayPropertyIsPresent(Project project, ModelItem modelItem, java.lang.String name, java.lang.String defaultValue) The obsolete values (of model items which are not present in the workspace any more) must be removed. |
|
public void |
setOverridenPropertyValuesConfig(OverridenPropertyValuesConfig overridenPropertyValuesConfig, java.util.List<Project> projectList) Sets the config object of the property value storage, then loads the values from the storage as the current values. |
|
public void |
setUserSpecificValue(Project project, ModelItem modelItem, java.lang.String name, java.lang.String value) Adds or replaces the overridden value of the property identified by the project, model item, and name. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
It is used for analytics and returns the number of properties marked as locally stored in the current workspace.
Gets the overridden value of the property identified by the project, model item, and name.
project
- the parent project of the model itemmodelItem
- the owner of the propertyname
- the property nameThis is the common way to check if the model item supports property value overriding.
modelItem
- the model item to check.Removes the overridden value from the storage. The value is identified by the project, modelItem, and name.
project
- the parent project of the model itemmodelItem
- the owner of the propertyname
- the property nameSaves the current values of the overridden properties of all supported model items. The config object the values are saved to has been set by the @setOverridenPropertyValuesConfig<Project> method.
The obsolete values (of model items which are not present in the workspace any more) must be removed. So, we need to know, which properties in each workspace project are marked as locally stored to remove the others. Walking through the whole navigator tree and through all properties takes a lot of time. Each supported model item uses a specific class XmlBeansUserSpecificTestPropertyHolder. The class adds the code which enumerates locally stored properties calling this method.
The optimization is based on the idea that unsupported model items do not enumerate their own properties to store values locally and do not have any check for support. We can say that they are already marked with a specific code of a specific class at compile time.
project
- the parent of the model item which is the property ownermodelItem
- the property ownername
- the property namedefaultValue
- the value from the project fileSets the config object of the property value storage, then loads the values from the storage as the current values.
overridenPropertyValuesConfig
- the config object to load values from.Adds or replaces the overridden value of the property identified by the project, model item, and name.
project
- the parent project of the model itemmodelItem
- the owner of the propertyname
- the property name