org.andromda.metafacades.emf.uml22.PackageFacadeLogic Maven / Gradle / Ivy
Show all versions of andromda-metafacades-emf-uml22 Show documentation
// license-header java merge-point
//
// Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
//
package org.andromda.metafacades.emf.uml22;
import java.util.Collection;
import java.util.List;
import org.andromda.core.metafacade.ModelValidationMessage;
import org.andromda.metafacades.uml.ClassifierFacade;
import org.andromda.metafacades.uml.ModelElementFacade;
import org.andromda.metafacades.uml.PackageFacade;
import org.apache.log4j.Logger;
import org.eclipse.uml2.uml.Package;
/**
*
* Used to group elements, and provides a namespace for the grouped
* elements. A package can have one or more profile applications to
* indicate which profiles have been applied. Because a profile is
* a package, it is possible to apply a profile not only to
* packages, but also to profiles. Package specializes
* TemplateableElement and PackageableElement specializes
* ParameterableElement to specify that a package can be used as a
* template and a PackageableElement as a template parameter.
*
* MetafacadeLogic for PackageFacade
*
* @see PackageFacade
*/
public abstract class PackageFacadeLogic
extends ModelElementFacadeLogicImpl
implements PackageFacade
{
/**
* The underlying UML object
* @see Package
*/
protected Package metaObject;
/** Create Metafacade implementation instance using the MetafacadeFactory from the context
* @param metaObjectIn
* @param context
*/
protected PackageFacadeLogic(Package metaObjectIn, String context)
{
super(metaObjectIn, getContext(context));
this.metaObject = metaObjectIn;
}
/**
* The logger instance.
*/
private static final Logger logger = Logger.getLogger(PackageFacadeLogic.class);
/**
* Gets the context for this metafacade logic instance.
* @param context String. Set to PackageFacade if null
* @return context String
*/
private static String getContext(String context)
{
if (context == null)
{
context = "org.andromda.metafacades.uml.PackageFacade";
}
return context;
}
/** Reset context only for non-root metafacades
* @param context
*/
@Override
public void resetMetafacadeContext(String context)
{
if (!this.contextRoot) // reset context only for non-root metafacades
{
context = getContext(context); // to have same value as in original constructor call
setMetafacadeContext (context);
}
}
/**
* @return boolean true always
* @see PackageFacade
*/
public boolean isPackageFacadeMetaType()
{
return true;
}
// --------------- attributes ---------------------
/**
* @see PackageFacade#getTablePrefix()
* @return String
*/
protected abstract String handleGetTablePrefix();
private String __tablePrefix1a;
private boolean __tablePrefix1aSet = false;
/**
*
* The Entity table prefix to be used for this package.
*
* @return (String)handleGetTablePrefix()
*/
public final String getTablePrefix()
{
String tablePrefix1a = this.__tablePrefix1a;
if (!this.__tablePrefix1aSet)
{
// tablePrefix has no pre constraints
tablePrefix1a = handleGetTablePrefix();
// tablePrefix has no post constraints
this.__tablePrefix1a = tablePrefix1a;
if (isMetafacadePropertyCachingEnabled())
{
this.__tablePrefix1aSet = true;
}
}
return tablePrefix1a;
}
// ---------------- business methods ----------------------
/**
* Method to be implemented in descendants
*
* Finds the model element with the given 'fullyQualifiedName', or
* returns null if one can't be found with that name.
*
* @param fullyQualifiedName
* @return ModelElementFacade
*/
protected abstract ModelElementFacade handleFindModelElement(String fullyQualifiedName);
/**
*
* Finds the model element with the given 'fullyQualifiedName', or
* returns null if one can't be found with that name.
*
* @param fullyQualifiedName String
*
* The fully qualified name of the model element to find.
*
* @return handleFindModelElement(fullyQualifiedName)
*/
public ModelElementFacade findModelElement(String fullyQualifiedName)
{
// findModelElement has no pre constraints
ModelElementFacade returnValue = handleFindModelElement(fullyQualifiedName);
// findModelElement has no post constraints
return returnValue;
}
// ------------- associations ------------------
/**
*
* @return (Collection)handleGetClasses()
*/
public final Collection getClasses()
{
Collection getClasses2r = null;
// packageFacade has no pre constraints
Collection result = handleGetClasses();
List shieldedResult = this.shieldedElements(result);
try
{
getClasses2r = (Collection)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
PackageFacadeLogic.logger.warn("incorrect metafacade cast for PackageFacadeLogic.getClasses Collection " + result + ": " + shieldedResult);
}
// packageFacade has no post constraints
return getClasses2r;
}
/**
* UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
* @return Collection
*/
protected abstract Collection handleGetClasses();
/**
*
* @return (Collection)handleGetSubPackages()
*/
public final Collection getSubPackages()
{
Collection getSubPackages3r = null;
// packageFacade has no pre constraints
Collection result = handleGetSubPackages();
List shieldedResult = this.shieldedElements(result);
try
{
getSubPackages3r = (Collection)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
PackageFacadeLogic.logger.warn("incorrect metafacade cast for PackageFacadeLogic.getSubPackages Collection " + result + ": " + shieldedResult);
}
// packageFacade has no post constraints
return getSubPackages3r;
}
/**
* UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
* @return Collection
*/
protected abstract Collection handleGetSubPackages();
/**
*
* Gets the root package for the model element.
*
* @return (Collection)handleGetModelElements()
*/
public final Collection getModelElements()
{
Collection getModelElements5r = null;
// rootPackage has no pre constraints
Collection result = handleGetModelElements();
List shieldedResult = this.shieldedElements(result);
try
{
getModelElements5r = (Collection)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
PackageFacadeLogic.logger.warn("incorrect metafacade cast for PackageFacadeLogic.getModelElements Collection " + result + ": " + shieldedResult);
}
// rootPackage has no post constraints
return getModelElements5r;
}
/**
* UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
* @return Collection
*/
protected abstract Collection handleGetModelElements();
/**
*
* @return (Collection)handleGetOwnedElements()
*/
public final Collection getOwnedElements()
{
Collection getOwnedElements6r = null;
// packageFacade has no pre constraints
Collection result = handleGetOwnedElements();
List shieldedResult = this.shieldedElements(result);
try
{
getOwnedElements6r = (Collection)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
PackageFacadeLogic.logger.warn("incorrect metafacade cast for PackageFacadeLogic.getOwnedElements Collection " + result + ": " + shieldedResult);
}
// packageFacade has no post constraints
return getOwnedElements6r;
}
/**
* UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
* @return Collection
*/
protected abstract Collection handleGetOwnedElements();
/**
* @param validationMessages Collection
* @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
*/
@Override
public void validateInvariants(Collection validationMessages)
{
super.validateInvariants(validationMessages);
}
}