All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.andromda.metafacades.uml14.FrontEndPackageLogic Maven / Gradle / Ivy

Go to download

The UML 1.4 metafacades. This is the set of UML 1.4 metafacades implementations. These implement the common UML metafacades.

The newest version!
// license-header java merge-point
//
// Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
//
package org.andromda.metafacades.uml14;

import java.util.Collection;
import java.util.List;
import org.andromda.core.metafacade.MetafacadeBase;
import org.andromda.core.metafacade.ModelValidationMessage;
import org.andromda.metafacades.uml.FrontEndAction;
import org.andromda.metafacades.uml.FrontEndController;
import org.andromda.metafacades.uml.FrontEndPackage;
import org.andromda.translation.ocl.validation.OCLCollections;
import org.andromda.translation.ocl.validation.OCLExpressions;
import org.andromda.translation.ocl.validation.OCLIntrospector;
import org.andromda.translation.ocl.validation.OCLResultEnsurer;
import org.apache.log4j.Logger;
import org.omg.uml.modelmanagement.UmlPackage;

/**
 * 

* Represents a package storing "front-end" components. *

* MetafacadeLogic for FrontEndPackage * * @see FrontEndPackage */ public abstract class FrontEndPackageLogic extends PackageFacadeLogicImpl implements FrontEndPackage { /** * The underlying UML object * @see Object */ protected Object metaObject; /** Create Metafacade implementation instance using the MetafacadeFactory from the context * @param metaObjectIn * @param context */ protected FrontEndPackageLogic(Object metaObjectIn, String context) { super((UmlPackage)metaObjectIn, getContext(context)); this.metaObject = metaObjectIn; } /** * The logger instance. */ private static final Logger logger = Logger.getLogger(FrontEndPackageLogic.class); /** * Gets the context for this metafacade logic instance. * @param context String. Set to FrontEndPackage if null * @return context String */ private static String getContext(String context) { if (context == null) { context = "org.andromda.metafacades.uml.FrontEndPackage"; } 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 FrontEndPackage */ public boolean isFrontEndPackageMetaType() { return true; } // ------------- associations ------------------ private List __getFrontEndControllers1r; private boolean __getFrontEndControllers1rSet = false; /** * * @return (List)handleGetFrontEndControllers() */ public final List getFrontEndControllers() { List getFrontEndControllers1r = this.__getFrontEndControllers1r; if (!this.__getFrontEndControllers1rSet) { // frontEndPackage has no pre constraints List result = handleGetFrontEndControllers(); List shieldedResult = this.shieldedElements(result); try { getFrontEndControllers1r = (List)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn FrontEndPackageLogic.logger.warn("incorrect metafacade cast for FrontEndPackageLogic.getFrontEndControllers List " + result + ": " + shieldedResult); } // frontEndPackage has no post constraints this.__getFrontEndControllers1r = getFrontEndControllers1r; if (isMetafacadePropertyCachingEnabled()) { this.__getFrontEndControllers1rSet = true; } } return getFrontEndControllers1r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return List */ protected abstract List handleGetFrontEndControllers(); private List __getFrontEndUseCases2r; private boolean __getFrontEndUseCases2rSet = false; /** * * @return (List)handleGetFrontEndUseCases() */ public final List getFrontEndUseCases() { List getFrontEndUseCases2r = this.__getFrontEndUseCases2r; if (!this.__getFrontEndUseCases2rSet) { // frontEndPackage has no pre constraints List result = handleGetFrontEndUseCases(); List shieldedResult = this.shieldedElements(result); try { getFrontEndUseCases2r = (List)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn FrontEndPackageLogic.logger.warn("incorrect metafacade cast for FrontEndPackageLogic.getFrontEndUseCases List " + result + ": " + shieldedResult); } // frontEndPackage has no post constraints this.__getFrontEndUseCases2r = getFrontEndUseCases2r; if (isMetafacadePropertyCachingEnabled()) { this.__getFrontEndUseCases2rSet = true; } } return getFrontEndUseCases2r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return List */ protected abstract List handleGetFrontEndUseCases(); /** *

Constraint: org::andromda::metafacades::uml::FrontEndPackage::no more than one controller per package

*

Error: In order to avoid possible naming collisions at most one controller per package is allowed. It is recommended to refactor your model.

*

OCL: context FrontEndPackage inv: frontEndControllers->size() < 2

*

Constraint: org::andromda::metafacades::uml::FrontEndPackage::no more than one usecase per package

*

Error: In order to avoid possible naming collisions at most one FrontEndUseCase per package is allowed. It is recommended to refactor your model.

*

OCL: context FrontEndPackage inv: frontEndUseCases->size() < 2

* @param validationMessages Collection * @see PackageFacadeLogicImpl#validateInvariants(Collection validationMessages) */ @Override public void validateInvariants(Collection validationMessages) { super.validateInvariants(validationMessages); try { final Object contextElement = this.THIS(); boolean constraintValid = OCLResultEnsurer.ensure(OCLExpressions.less(OCLCollections.size(OCLIntrospector.invoke(contextElement,"frontEndControllers")),2)); if (!constraintValid) { validationMessages.add( new ModelValidationMessage( (MetafacadeBase)contextElement , "org::andromda::metafacades::uml::FrontEndPackage::no more than one controller per package", "In order to avoid possible naming collisions at most one controller per package is allowed. It is recommended to refactor your model.")); } } catch (Throwable th) { Throwable cause = th.getCause(); int depth = 0; // Some throwables have infinite recursion while (cause != null && depth < 7) { th = cause; depth++; } logger.error("Error validating constraint 'org::andromda::metafacades::uml::FrontEndPackage::no more than one controller per package' ON " + this.THIS().toString() + ": " + th.getMessage(), th); } try { final Object contextElement = this.THIS(); boolean constraintValid = OCLResultEnsurer.ensure(OCLExpressions.less(OCLCollections.size(OCLIntrospector.invoke(contextElement,"frontEndUseCases")),2)); if (!constraintValid) { validationMessages.add( new ModelValidationMessage( (MetafacadeBase)contextElement , "org::andromda::metafacades::uml::FrontEndPackage::no more than one usecase per package", "In order to avoid possible naming collisions at most one FrontEndUseCase per package is allowed. It is recommended to refactor your model.")); } } catch (Throwable th) { Throwable cause = th.getCause(); int depth = 0; // Some throwables have infinite recursion while (cause != null && depth < 7) { th = cause; depth++; } logger.error("Error validating constraint 'org::andromda::metafacades::uml::FrontEndPackage::no more than one usecase per package' ON " + this.THIS().toString() + ": " + th.getMessage(), th); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy