pl.edu.agh.cast.model
Class ModelUtil

java.lang.Object
  extended by pl.edu.agh.cast.model.ModelUtil

public class ModelUtil
extends Object

The ModeluUtil class is a helper for accessing data retrieved from extension points defined by 'Base' plug-in.

Author:
AGH CAST Team

Constructor Summary
ModelUtil()
          The default constructor.
ModelUtil(IModelPluginRegistryProvider provider)
          Constructor which allows to set custom IModelPluginRegistryProvider instance.
 
Method Summary
 Map<String,Map<String,String>> getAttributeMap(Collection<IDataSet> dataSets)
          Constructs map which allows quick look-up of model extension ID for given pair of type name and attribute name.
 String getAttributeName(String modelExtensionId, String typeName, String attributeId)
          Returns the localized name of the attribute with given id defined in the type with given type name of the model with given model extension ID.
static String getColumnDefaultValue(String modelId, String columnName)
          Returns the default value of the column with given name defined in model with given id.
 ModelColumn getColumnInfo(org.eclipse.core.runtime.IConfigurationElement column)
          Returns ModelColumn constructed of given configuration element (extension) describing it.
 IDataLoader getDataLoader(String modelExtensionId)
          Returns the data loader for model with given extension identifier.
 ModelColumn[] getModelColumns(String modelExtensionId)
          Delegated method.
 org.eclipse.core.runtime.IConfigurationElement getModelConfiguration(String modelExtensionId)
          Returns the model configuration for model with given extension identifier.
 List<ModelInfo> getModelInfos()
          Delegated method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelUtil

public ModelUtil()
The default constructor. Creates a new instance of DefaultModelPluginRegistryProvider.


ModelUtil

public ModelUtil(IModelPluginRegistryProvider provider)
Constructor which allows to set custom IModelPluginRegistryProvider instance. If null is passed, the DefaultModelPluginRegistryProvider is used. This constructor should be used in tests.

Parameters:
provider - custom provider instance
Method Detail

getModelConfiguration

public org.eclipse.core.runtime.IConfigurationElement getModelConfiguration(String modelExtensionId)
Returns the model configuration for model with given extension identifier.

Parameters:
modelExtensionId - the id of the model extension
Returns:
the model configuration

getDataLoader

public IDataLoader getDataLoader(String modelExtensionId)
                          throws org.eclipse.core.runtime.CoreException
Returns the data loader for model with given extension identifier.

Parameters:
modelExtensionId - the id of the model extension
Returns:
The data loader for given model
Throws:
org.eclipse.core.runtime.CoreException

getAttributeName

public String getAttributeName(String modelExtensionId,
                               String typeName,
                               String attributeId)
Returns the localized name of the attribute with given id defined in the type with given type name of the model with given model extension ID.

Parameters:
modelExtensionId - The ID of the model of the type which defines the attribute
typeName - The name of the type which defines the attribute
attributeId - The ID of the attribute
Returns:
The human readable name of the attribute.

getColumnInfo

public ModelColumn getColumnInfo(org.eclipse.core.runtime.IConfigurationElement column)
Returns ModelColumn constructed of given configuration element (extension) describing it.

Parameters:
column - The configuration element describing the model column
Returns:
Model column description as defined in the extension.

getAttributeMap

public Map<String,Map<String,String>> getAttributeMap(Collection<IDataSet> dataSets)
Constructs map which allows quick look-up of model extension ID for given pair of type name and attribute name. The map contains only these model extension IDs which are referenced by data sets given as method parameter.

Parameters:
dataSets - The list of data sets.
Returns:
Second order map - for given type name and attribute name returns the model extension ID.

getColumnDefaultValue

public static String getColumnDefaultValue(String modelId,
                                           String columnName)
Returns the default value of the column with given name defined in model with given id.

Parameters:
modelId - The id of the model
columnName - The name of the column
Returns:
The default value of the column

getModelInfos

public List<ModelInfo> getModelInfos()
                              throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IModelPluginRegistryProvider.getModelInfos()

getModelColumns

public ModelColumn[] getModelColumns(String modelExtensionId)
Delegated method.

See Also:
IModelPluginRegistryProvider.getModelColumns(java.lang.String)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.