com.finalist.mmbase.uml
Class MMBaseHelper

java.lang.Object
  extended by org.andromda.core.uml14.UMLDefaultHelper
      extended by org.andromda.core.uml14.UMLStaticHelper
          extended by org.andromda.core.simpleuml.SimpleOOHelper
              extended by com.finalist.mmbase.uml.MMBaseHelper
All Implemented Interfaces:
org.andromda.core.common.ScriptHelper
Direct Known Subclasses:
MMBasePackageHelper

public class MMBaseHelper
extends org.andromda.core.simpleuml.SimpleOOHelper

Helper class to get access to the UML model.

Version:
$Revision: 1.13 $, $Date: 2005/07/12 10:31:41 $
Author:
Rudie Ekkelenkamp - Finalist IT Group

Field Summary
 
Fields inherited from class org.andromda.core.uml14.UMLDefaultHelper
model, typeMappings
 
Constructor Summary
MMBaseHelper()
           
 
Method Summary
 boolean checkModelElementVisibility(java.lang.Object modelElement, java.lang.String visibility)
          Function to test visibility on a ModelElement.
 java.util.Collection getAllAttributes(java.lang.Object object)
          Get a list of all attributes in the class and interface.
 java.util.Collection getAllAttributes(java.lang.Object object, java.lang.String clazz, java.lang.String interfazes, java.lang.String generalizations, java.lang.String visibilitiy)
          Returns a Collection of MMBaseInterfaceVO with all attributes related to a class: Class attributes, Interface attributes..
 java.util.Collection getAllGeneralizations(java.lang.Object object, int level)
          Get a list of all Classifier objects (superclasses) for a given Classifier object.
 java.util.Collection getAllRelationAttributes(java.lang.String relationName, java.lang.String clazz, java.lang.String interfazes, java.lang.String generalizations, java.lang.String visibilitiy)
           
 MMBaseAssociationHelper getAssociationHelper()
          Give access to the association helper.
 java.lang.String getAttributeDocumentation(java.lang.Object object)
          Get documentation set on an attribute.
 java.lang.String getAttributeName(java.lang.Object object)
          Get the name of an attribute
 boolean getAttributeRequired(java.lang.Object object)
          Get the type of an attribute.
 boolean getAttributeStereoType(java.lang.Object object)
          Get if attribute is required
 java.lang.String getAttributeType(java.lang.Object object)
          Get the type of an attribute.
static java.util.Collection getBasicBuilders()
          Get a list with the names of the basic builders needed by MMBase.
static java.util.Collection getBasicRelationBuilders()
          Get a list with the names of the basic relation builders needed by MMBase.
 java.util.Collection getClassAttributes(java.lang.Object object, java.lang.String visibilitiy)
          Returns a Collection of MMBaseInterfaceVO with all attributes of the specified class
 java.lang.String getClassSubTitle(java.lang.Object object)
          Returns the tagged value of title on a class
 java.lang.String getClassTitle(java.lang.Object object)
          Returns the tagged value of title on a class in XML format
static java.lang.String getDate()
          Get the current date.
 java.lang.String getDependencyName(java.lang.Object object)
          Returns the name of a dependency element
 java.lang.String getDependencyStereoType(java.lang.Object modelElement)
          Determine the stereotype that is set on a dependency.
 MMBaseDocumentationHelper getDocumentationHelper()
          Give acces to the Documentation helper
 java.util.Collection getGeneralizationAttributes(java.lang.Object object, java.lang.String visibilitiy)
          Returns a Collection of MMBaseInterfaceVO with all attributes of the interfaces the class implements This has to be implemented.
 java.lang.String getGeneralizationName(java.lang.Object object)
          Returns the name of the super class
 java.util.Collection getInterfaceAttributes(java.lang.Object object, java.lang.String visibilitiy)
          Returns a Collection of MMBaseInterfaceVO with all attributes of the interfaces the class implements problem: unexpected class cast exceptions on certain relation classes...
 java.lang.String getIsPosrelSpecialization(java.lang.String relationName)
          Function to determin if relation is a specialization of posrel
 java.lang.String getJavaDoc(java.lang.Object value)
          Get the javadoc from a model element and strip all paragraphs.
static java.lang.String getMMBaseDatabaseSize(java.lang.String type)
          Map the type on a database size.
static java.lang.String getMMBaseDatabaseType(java.lang.String type)
          Map a type to a MMBase Database type.
static java.lang.String getMMBaseGuiSize(java.lang.String type)
          Map the type on a database size.
static java.lang.String getMMBaseGuiType(java.lang.String type)
          Map the type to a GUI type
static java.lang.String getNormalizedMMBaseType(java.lang.String type)
          Return the type in lowercase and remove any package names.
 java.lang.String getOperationType(java.lang.Object object)
          Returns the name of a model element fully qualified by the name of the package that contains it.
 java.util.Collection getOptions(java.lang.Object o)
           
 java.util.HashMap getProfile()
          Give access to the UML Profile constants
 MMBaseRelationHelper getRelationHelper()
          Give access to the relation helper.
 java.util.Collection getSortedModelClassifiers()
          Same as getModelElements, but now the model elements are sorted by name.
 java.util.Collection getSortedRelationElements()
          Get all model elements with the Relation stereotype.
 java.util.Collection getStereotypeNames(java.lang.Object modelElement)
          This method is needed to trigger code generation for the whole model, since nog stereotype is set on the model itself.
 java.lang.String getVersion(java.lang.Object object)
          Funcrion to obtain the varsion for a builder class.
protected  boolean isOptionList(java.lang.String name)
          Checks if the ModelElement with the specified name is indeed an OptionList *
 boolean isPackage(java.lang.Object modelElement)
          Checks if the ModelElement is a UML Package.
 boolean isSystemAttribute(java.lang.Object attribute)
          Function to test the 'system' flaf on an MMBaseAttributeVo instance.
static java.lang.String javaDocToText(java.lang.Object value)
          Convert javadoc text to plaint text.
static java.util.Collection sortValuesByKeys(java.util.HashMap map)
          Sort a HashMap based on it's keys and return a Collection with the values
static java.lang.String toClassName(java.lang.String packageName, java.lang.String className)
          Determine the fully qualified class name.
static java.lang.String toLowerCase(java.lang.String arg)
          Convert to Lowercase
static java.lang.String toUpperCase(java.lang.String arg)
          Convert to Uppercase
 
Methods inherited from class org.andromda.core.simpleuml.SimpleOOHelper
convertToType, findAttributeJDBCType, findAttributeSQLFieldLength, findAttributeSQLType, findClassById, findFullyQualifiedName, findPackageName, formatHTMLStringAsParagraphs, getAssociationData, getAttributesAsList, getComponentInterfaceName, getEjbRefViewType, getHomeInterfaceName, getModel, getModelElements, getOperationCall, getOperationParameterNames, getOperationSignature, getOperationTypedParameterList, getPrimaryKeyAttribute, getStereotype
 
Methods inherited from class org.andromda.core.uml14.UMLStaticHelper
findTagValue, findTagValue, findTagValue, getAbstractions, getAssociationEnds, getAttributes, getDependencies, getFullyQualifiedName, getGeneralization, getOperations, getTaggedValues
 
Methods inherited from class org.andromda.core.uml14.UMLDefaultHelper
getName, getPackageName, setModel, setTypeMappings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.andromda.core.common.ScriptHelper
getName, getPackageName, setModel, setTypeMappings
 

Constructor Detail

MMBaseHelper

public MMBaseHelper()
Method Detail

getAssociationHelper

public MMBaseAssociationHelper getAssociationHelper()
Give access to the association helper.

Returns:
an MMbase association helper

getRelationHelper

public MMBaseRelationHelper getRelationHelper()
Give access to the relation helper.

Returns:
an MMBase relation helper

getProfile

public java.util.HashMap getProfile()
Give access to the UML Profile constants

Returns:
a HasHamp with all constants of this UML profile.

getDocumentationHelper

public MMBaseDocumentationHelper getDocumentationHelper()
Give acces to the Documentation helper

Returns:
a MMBaseDocumentationHelper instance

getStereotypeNames

public java.util.Collection getStereotypeNames(java.lang.Object modelElement)
This method is needed to trigger code generation for the whole model, since nog stereotype is set on the model itself.

Specified by:
getStereotypeNames in interface org.andromda.core.common.ScriptHelper
Overrides:
getStereotypeNames in class org.andromda.core.uml14.UMLDefaultHelper
Parameters:
modelElement - the model element
Returns:
A collection with all stereotypes on the modelElement.
See Also:
ScriptHelper.getStereotypeNames(java.lang.Object)

getDependencyStereoType

public java.lang.String getDependencyStereoType(java.lang.Object modelElement)
Determine the stereotype that is set on a dependency.

Parameters:
modelElement - the model element
Returns:
Empty string if no stereotype has been set. Otherwise the name of the stereotype.

getDependencyName

public java.lang.String getDependencyName(java.lang.Object object)
Returns the name of a dependency element

Parameters:
object - model element
Returns:
fully qualifed name

getDate

public static final java.lang.String getDate()
Get the current date.

Returns:
String with the current date.

toLowerCase

public static final java.lang.String toLowerCase(java.lang.String arg)
Convert to Lowercase

Parameters:
arg - the argument
Returns:
String converted to lowercase.

toUpperCase

public static final java.lang.String toUpperCase(java.lang.String arg)
Convert to Uppercase

Parameters:
arg - the argument
Returns:
String converted to uppercase.

toClassName

public static final java.lang.String toClassName(java.lang.String packageName,
                                                 java.lang.String className)
Determine the fully qualified class name.

Parameters:
packageName - package name
className - class name
Returns:
fully qualified class name.

getOperationType

public java.lang.String getOperationType(java.lang.Object object)
Returns the name of a model element fully qualified by the name of the package that contains it.

Parameters:
object - model element
Returns:
fully qualifed name

getClassAttributes

public java.util.Collection getClassAttributes(java.lang.Object object,
                                               java.lang.String visibilitiy)
Returns a Collection of MMBaseInterfaceVO with all attributes of the specified class

Parameters:
object - model element
visibilitiy - the visibility
Returns:
fully qualifed name

getAllGeneralizations

public java.util.Collection getAllGeneralizations(java.lang.Object object,
                                                  int level)
Get a list of all Classifier objects (superclasses) for a given Classifier object. This will allow you to get to

Parameters:
object - Classifier
level - Restrict the recursion level.
Returns:
Collection of Classifiers this classefier extends.

getGeneralizationName

public java.lang.String getGeneralizationName(java.lang.Object object)
Returns the name of the super class

Parameters:
object - model element
Returns:
class name

getGeneralizationAttributes

public java.util.Collection getGeneralizationAttributes(java.lang.Object object,
                                                        java.lang.String visibilitiy)
Returns a Collection of MMBaseInterfaceVO with all attributes of the interfaces the class implements This has to be implemented. We get a class cast exception for model.getCore().getAChildGeneralization().getGeneralization(element).iterator();

Parameters:
object - model element
visibilitiy - the visibility
Returns:
fully qualifed name

getInterfaceAttributes

public java.util.Collection getInterfaceAttributes(java.lang.Object object,
                                                   java.lang.String visibilitiy)
Returns a Collection of MMBaseInterfaceVO with all attributes of the interfaces the class implements problem: unexpected class cast exceptions on certain relation classes...

Parameters:
object - model element
visibilitiy - the visibility
Returns:
fully qualifed name

getAllAttributes

public java.util.Collection getAllAttributes(java.lang.Object object,
                                             java.lang.String clazz,
                                             java.lang.String interfazes,
                                             java.lang.String generalizations,
                                             java.lang.String visibilitiy)
Returns a Collection of MMBaseInterfaceVO with all attributes related to a class: Class attributes, Interface attributes..

Parameters:
object - model element
clazz - should the attributes of the class itself also be included? Default is true.
interfazes - should the attributes of the interface also be included? Default is false.
generalizations - should the attributes of super classes also be included? The default is true.
visibilitiy - specify the visiblity of the attributes that should be collected. If null, all attributes are returned. Other valueas are: public, private and protected.
Returns:
fully qualifed name

getAllAttributes

public java.util.Collection getAllAttributes(java.lang.Object object)
Get a list of all attributes in the class and interface.

Parameters:
object - the object
Returns:
Collection of MMBaseAttributeVo objects.

getAllRelationAttributes

public java.util.Collection getAllRelationAttributes(java.lang.String relationName,
                                                     java.lang.String clazz,
                                                     java.lang.String interfazes,
                                                     java.lang.String generalizations,
                                                     java.lang.String visibilitiy)
Parameters:
relationName - Name of the relation for which all attributes should be returned.
clazz - do we want the class attributes? true or false.
interfazes - do we want the interface attributes? true or false.
generalizations - do we want the generatlization attributes? true or false.
visibilitiy - threshold for the visibility. private will get all attributes.
Returns:
Collection of MMBaseAttributeVo objects.

getSortedModelClassifiers

public java.util.Collection getSortedModelClassifiers()
Same as getModelElements, but now the model elements are sorted by name.

Returns:
Collection with sorted model elements of the type Classifer.

getSortedRelationElements

public java.util.Collection getSortedRelationElements()
Get all model elements with the Relation stereotype.

Returns:
Collection with sorted model elements.

getAttributeName

public java.lang.String getAttributeName(java.lang.Object object)
Get the name of an attribute

Parameters:
object - the object
Returns:
Attribute name.

getAttributeType

public java.lang.String getAttributeType(java.lang.Object object)
Get the type of an attribute.

Parameters:
object - the object
Returns:
Attribute type.

getAttributeRequired

public boolean getAttributeRequired(java.lang.Object object)
Get the type of an attribute.

Parameters:
object - the object
Returns:
Attribute type.

getAttributeStereoType

public boolean getAttributeStereoType(java.lang.Object object)
Get if attribute is required

Parameters:
object - the object
Returns:
true if attribute is required.

getAttributeDocumentation

public java.lang.String getAttributeDocumentation(java.lang.Object object)
Get documentation set on an attribute.

Parameters:
object - the object
Returns:
Doucmentation.

getJavaDoc

public java.lang.String getJavaDoc(java.lang.Object value)
Get the javadoc from a model element and strip all paragraphs. First check if there is a tagged value with the name javadoc. Next check the javadoc model element.

Parameters:
value - UML Model element
Returns:
String with the javadoc tag.

javaDocToText

public static final java.lang.String javaDocToText(java.lang.Object value)
Convert javadoc text to plaint text.

Parameters:
value - object with HTML formatting. Can be a String or a Tagged value.
Returns:
String withous P tags.

getNormalizedMMBaseType

public static java.lang.String getNormalizedMMBaseType(java.lang.String type)
Return the type in lowercase and remove any package names.

Parameters:
type - the type
Returns:
normalized mmbase type.

getMMBaseDatabaseType

public static java.lang.String getMMBaseDatabaseType(java.lang.String type)
Map a type to a MMBase Database type.

Parameters:
type - the type
Returns:
Database type as a string.

getMMBaseGuiType

public static java.lang.String getMMBaseGuiType(java.lang.String type)
Map the type to a GUI type

Parameters:
type - the type
Returns:
gui type

getMMBaseDatabaseSize

public static final java.lang.String getMMBaseDatabaseSize(java.lang.String type)
Map the type on a database size.

Parameters:
type - the type
Returns:
database size as a String

getMMBaseGuiSize

public static final java.lang.String getMMBaseGuiSize(java.lang.String type)
Map the type on a database size.

Parameters:
type - the type
Returns:
database size as a String

isPackage

public boolean isPackage(java.lang.Object modelElement)
Checks if the ModelElement is a UML Package.

Parameters:
modelElement - The name of the ModelElement.
Returns:
A boolean that specifies if the ModelElement is a package.

isOptionList

protected boolean isOptionList(java.lang.String name)
Checks if the ModelElement with the specified name is indeed an OptionList *

Parameters:
name - The name of the ModelElement.
Returns:
A boolean that specifies if the ModelElement is an OptionList.

getOptions

public java.util.Collection getOptions(java.lang.Object o)
Parameters:
o - UMLModelElement object with the stereotype "OptionList" containing information about the list.
Returns:
A collection of MMBaseOptionVo's cotaining the options.

sortValuesByKeys

public static java.util.Collection sortValuesByKeys(java.util.HashMap map)
Sort a HashMap based on it's keys and return a Collection with the values

Parameters:
map - Hashamp with String object pairs that has to be sorted.
Returns:
Collection of sorted objects based on the keys in the HashMap.

getBasicRelationBuilders

public static java.util.Collection getBasicRelationBuilders()
Get a list with the names of the basic relation builders needed by MMBase.

Returns:
list of Strings with the relation builder names.

getBasicBuilders

public static java.util.Collection getBasicBuilders()
Get a list with the names of the basic builders needed by MMBase.

Returns:
list of Strings with the builder names.

getClassTitle

public java.lang.String getClassTitle(java.lang.Object object)
Returns the tagged value of title on a class in XML format

Parameters:
object - model element
Returns:
value of the title tagged value, or null if not set.

getClassSubTitle

public java.lang.String getClassSubTitle(java.lang.Object object)
Returns the tagged value of title on a class

Parameters:
object - model element
Returns:
value of the title tagged value, or null if not set.

isSystemAttribute

public boolean isSystemAttribute(java.lang.Object attribute)
Function to test the 'system' flaf on an MMBaseAttributeVo instance.

Parameters:
attribute - must be instance of MMBaseAttributeVo

checkModelElementVisibility

public boolean checkModelElementVisibility(java.lang.Object modelElement,
                                           java.lang.String visibility)
Function to test visibility on a ModelElement.

Parameters:
modelElement - is the object to be checked
visibility - is the level of visibility it can be checked on [private|protected|package|public]
Returns:
true or false;

getVersion

public java.lang.String getVersion(java.lang.Object object)
Funcrion to obtain the varsion for a builder class. If a tagged value 'version' has been set on the class, and the value is a valid number, this will be returned, otherwise it will return 0;

Parameters:
object - is a ModelElement that will be tested for the tagged value
Returns:
String containing number

getIsPosrelSpecialization

public java.lang.String getIsPosrelSpecialization(java.lang.String relationName)
Function to determin if relation is a specialization of posrel

Parameters:
relationName - the name of a relation type
Returns:
String containing 'true' if given relation is posrel specialization, otherwise 'false'


Copyright © 2003-2006 mmapps. All Rights Reserved.