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

functions.Class.ext Maven / Gradle / Ivy

There is a newer version: 1.24.1
Show newest version
extension functions::TypeChecks;
extension functions::Property;
extension functions::POJO;
extension functions::ServiceObject;
extension java::GeneratorCommons;
extension java::OpenAPIFunctions;

cached boolean isClass(uml::Element element):
	if element != null
    then element.isInstanceOf("org.eclipse.uml2.uml.Class")
    else false;

cached uml::Class asClass(uml::Element element):
    (uml::Class) element;
    
cached boolean hasDerivedProperties(uml::Class class):
    !class.getDerivedProperties().isEmpty;
    
cached List[uml::Property] getDerivedProperties(uml::Class class):
    class.ownedAttribute.select(e|e.isDerived == true);
    
cached boolean hasBidirectionalAssociations(uml::Class class):
    class.getBidirectionalProperties().isEmpty == false;
    
cached List[uml::Property] getBidirectionalProperties(uml::Class class):
    class.ownedAttribute.select(e|e.isPropertySuppressed() == false && e.belongsToBidirectionalAssociation());
    
cached boolean hasOnlyTransientBidirectionalAssociations(uml::Class class):
    class.getBidirectionalProperties().select(e|e.belongsToTransientBidirectionalAssociation() == false).isEmpty == true;
    
cached boolean hasTemplateParameter(uml::Class class):
    class.ownedTemplateSignature.ownedParameter.isEmpty == false;
    
cached boolean generateOfOperationForClass(uml::Class class):
    generateOfOperation() && (class.generateOfOperationForServiceObject() || class.generateOfOperationForPOJO() || generateOfOperationForOpenAPIDataType());
    
cached List[uml::Property] getAllAttributesForOfOperation(uml::Class class):
    if class.useOnlyRequiredPropertiesForOfMethod()
    then class.getAllPropertiesFromHierarchy().select(e|e.isPropertySuppressed() == false && e.belongsToTransientBidirectionalBackReference() == false && e.isStatic == false && e.isRequiredProperty())
    else class.getAllPropertiesFromHierarchy().select(e|e.isPropertySuppressed() == false && e.belongsToTransientBidirectionalBackReference() == false && e.isStatic == false);
    //class.getAllAttributes().select(e|e.isPropertySuppressed() == false);
    
private boolean useOnlyRequiredPropertiesForOfMethod(uml::Class class):
    if class.getOfMethodType() == null || class.getOfMethodType() == "REQUIRED_PROPERTIES" || class.getOfMethodType() == "DEFAULT"
    then true
    else false;


private String getOfMethodType(uml::Class class):
    if class.isPOJO()
    then class.asPOJO().ofMethod.name
    else 
        if class.isServiceObject()
        then class.asServiceObject().ofMethod.name;
        
cached List[uml::Property] getAllPropertiesFromHierarchy(uml::Class class):
  JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getAllAttributesFromHierarchy(org.eclipse.uml2.uml.Element);   
        
cached boolean suppressSubtypesMapping(uml::Class class):
  if class.isStereotypeApplied("POJO")
  then ((JMM::POJO) class).suppressSubtypesMapping
  else 
        if class.isStereotypeApplied("ServiceObject")
        then ((JMM::ServiceObject) class).suppressSubtypesMapping
        else false;
 
       




© 2015 - 2024 Weber Informatics LLC | Privacy Policy