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

org.andromda.metafacades.emf.uml22.ServiceLogic Maven / Gradle / Ivy

Go to download

The Eclipse EMF UML2 v2.X metafacades. This is the set of EMF UML2 2.X metafacades implementations. These implement the common UML metafacades for .uml model files.

The newest version!
// 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.MetafacadeBase;
import org.andromda.core.metafacade.ModelValidationMessage;
import org.andromda.metafacades.uml.DependencyFacade;
import org.andromda.metafacades.uml.Destination;
import org.andromda.metafacades.uml.Role;
import org.andromda.metafacades.uml.Service;
import org.andromda.translation.ocl.validation.OCLCollections;
import org.andromda.translation.ocl.validation.OCLIntrospector;
import org.andromda.translation.ocl.validation.OCLResultEnsurer;
import org.apache.commons.collections.Predicate;
import org.apache.log4j.Logger;
import org.eclipse.uml2.uml.Classifier;

/**
 * 

* Represents a service. *

* MetafacadeLogic for Service * * @see Service */ public abstract class ServiceLogic extends ClassifierFacadeLogicImpl implements Service { /** * The underlying UML object * @see Object */ protected Object metaObject; /** Create Metafacade implementation instance using the MetafacadeFactory from the context * @param metaObjectIn * @param context */ protected ServiceLogic(Object metaObjectIn, String context) { super((Classifier)metaObjectIn, getContext(context)); this.metaObject = metaObjectIn; } /** * The logger instance. */ private static final Logger logger = Logger.getLogger(ServiceLogic.class); /** * Gets the context for this metafacade logic instance. * @param context String. Set to Service if null * @return context String */ private static String getContext(String context) { if (context == null) { context = "org.andromda.metafacades.uml.Service"; } 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 Service */ public boolean isServiceMetaType() { return true; } // ------------- associations ------------------ /** * * @return (Collection)handleGetServiceReferences() */ public final Collection getServiceReferences() { Collection getServiceReferences1r = null; // service has no pre constraints Collection result = handleGetServiceReferences(); List shieldedResult = this.shieldedElements(result); try { getServiceReferences1r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getServiceReferences Collection " + result + ": " + shieldedResult); } // service has no post constraints return getServiceReferences1r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetServiceReferences(); /** * * @return (Collection)handleGetEntityReferences() */ public final Collection getEntityReferences() { Collection getEntityReferences2r = null; // service has no pre constraints Collection result = handleGetEntityReferences(); List shieldedResult = this.shieldedElements(result); try { getEntityReferences2r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getEntityReferences Collection " + result + ": " + shieldedResult); } // service has no post constraints return getEntityReferences2r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetEntityReferences(); /** * * @return (Collection)handleGetRoles() */ public final Collection getRoles() { Collection getRoles3r = null; // service has no pre constraints Collection result = handleGetRoles(); List shieldedResult = this.shieldedElements(result); try { getRoles3r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getRoles Collection " + result + ": " + shieldedResult); } // service has no post constraints return getRoles3r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetRoles(); /** * * @return (Collection)handleGetAllRoles() */ public final Collection getAllRoles() { Collection getAllRoles4r = null; // service has no pre constraints Collection result = handleGetAllRoles(); List shieldedResult = this.shieldedElements(result); try { getAllRoles4r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getAllRoles Collection " + result + ": " + shieldedResult); } // service has no post constraints return getAllRoles4r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetAllRoles(); /** * * @return (Collection)handleGetAllServiceReferences() */ public final Collection getAllServiceReferences() { Collection getAllServiceReferences6r = null; // service has no pre constraints Collection result = handleGetAllServiceReferences(); List shieldedResult = this.shieldedElements(result); try { getAllServiceReferences6r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getAllServiceReferences Collection " + result + ": " + shieldedResult); } // service has no post constraints return getAllServiceReferences6r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetAllServiceReferences(); /** * * @return (Collection)handleGetMessagingDestinations() */ public final Collection getMessagingDestinations() { Collection getMessagingDestinations7r = null; // service has no pre constraints Collection result = handleGetMessagingDestinations(); List shieldedResult = this.shieldedElements(result); try { getMessagingDestinations7r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getMessagingDestinations Collection " + result + ": " + shieldedResult); } // service has no post constraints return getMessagingDestinations7r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetMessagingDestinations(); /** * * @return (Collection)handleGetAllEntityReferences() */ public final Collection getAllEntityReferences() { Collection getAllEntityReferences8r = null; // service has no pre constraints Collection result = handleGetAllEntityReferences(); List shieldedResult = this.shieldedElements(result); try { getAllEntityReferences8r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getAllEntityReferences Collection " + result + ": " + shieldedResult); } // service has no post constraints return getAllEntityReferences8r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetAllEntityReferences(); /** * * @return (Collection)handleGetAllMessagingDestinations() */ public final Collection getAllMessagingDestinations() { Collection getAllMessagingDestinations9r = null; // service has no pre constraints Collection result = handleGetAllMessagingDestinations(); List shieldedResult = this.shieldedElements(result); try { getAllMessagingDestinations9r = (Collection)shieldedResult; } catch (ClassCastException ex) { // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn ServiceLogic.logger.warn("incorrect metafacade cast for ServiceLogic.getAllMessagingDestinations Collection " + result + ": " + shieldedResult); } // service has no post constraints return getAllMessagingDestinations9r; } /** * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type * @return Collection */ protected abstract Collection handleGetAllMessagingDestinations(); /** *

Constraint: org::andromda::metafacades::uml::Service::a service can only generalize another service

*

Error: A service can only generalize another service.

*

OCL: context Service inv : generalization -> notEmpty() implies generalization.oclIsKindOf(Service)

*

Constraint: org::andromda::metafacades::uml::Service::services can only specialize other service

*

Error: A service can only specialize another service.

*

OCL: context ServiceFacade inv : specializations -> notEmpty() implies specializations -> forAll(oclIsKindOf(Service))

* @param validationMessages Collection * @see ClassifierFacadeLogicImpl#validateInvariants(Collection validationMessages) */ @Override public void validateInvariants(Collection validationMessages) { super.validateInvariants(validationMessages); try { final Object contextElement = this.THIS(); boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"generalization")))).booleanValue()?OCLIntrospector.invoke(contextElement,"generalization") instanceof Service:true)); if (!constraintValid) { validationMessages.add( new ModelValidationMessage( (MetafacadeBase)contextElement , "org::andromda::metafacades::uml::Service::a service can only generalize another service", "A service can only generalize another service.")); } } 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::Service::a service can only generalize another service' ON " + this.THIS().toString() + ": " + th.getMessage(), th); } try { final Object contextElement = this.THIS(); boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"specializations")))).booleanValue()?OCLCollections.forAll(OCLIntrospector.invoke(contextElement,"specializations"),new Predicate(){public boolean evaluate(Object object){return Boolean.valueOf(String.valueOf(object instanceof Service)).booleanValue();}}):true)); if (!constraintValid) { validationMessages.add( new ModelValidationMessage( (MetafacadeBase)contextElement , "org::andromda::metafacades::uml::Service::services can only specialize other service", "A service can only specialize another service.")); } } 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::Service::services can only specialize other service' ON " + this.THIS().toString() + ": " + th.getMessage(), th); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy