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

jeaf.JEAFChecks.chk Maven / Gradle / Ivy

There is a newer version: 1.24.1
Show newest version
import uml;
import JMM;

extension java::Naming;
extension entity::ModelProperties; 
extension java::ActivityHelper;
extension java::GeneratorCommons;
extension java::OpenAPIFunctions;
extension functions::JEAFDeprecated;
extension functions::NamedElement;
extension functions::Class;
extension functions::Property;
extension functions::Enumeration;
extension functions::SoftLink;
extension functions::SystemProperties;


// Checks for stereotype JEAFComponent
context JEAFComponent if runChecks("JEAFComponent") && ignore() == false ERROR this.getErrorMessage("9132", {name}): layer != null;

// Checks for stereotype ServiceObject
context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9124", {"ServiceObject", name}): ownedAttribute.select(e|e.isPropertySuppressed() == false).forAll( a | a.type != null);
context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9125", {"ServiceObject", name}): ownedAttribute.select(e|e.isPropertySuppressed() == false).forAll( a | a.name.length > 0);
context ServiceObject if runChecks("ServiceObject") && ignore() == false && compositeDataType ERROR this.getErrorMessage("9123", {"ServiceObject", name}): this.superClass.size == 0;
context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9128", {"ServiceObject", name}): ownedOperation.forAll( e | e.hasReturnType() == true);
context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9129", {"ServiceObject", name}): ownedOperation.forAll( e | e.name.length > 0);
context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9127", {"ServiceObject", name}): ownedOperation.forAll( e | e.areAllInputParametersNamed() == true);
context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9130", {"ServiceObject", name}): ownedOperation.forAll( e | e.hasOnlySupportedParamaterTypes());
context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9160", {name}): this.isStereotypeApplied("POJO") == false;
context ServiceObject if runChecks("ServiceObject") && ignore() == false && compositeDataType ERROR this.getErrorMessage("9162", {this.fqn()}): compositeDataTypePublicFieldName.length > 0;
context Operation if owner.asNamedElement().runChecks("ServiceObject") && owner.isStereotypeApplied("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9170", {name, "operation", owner.asNamedElement().fqn()}): this.isValidIdentifierName();



context Property if isNavigable() && class != null && class.isStereotypeApplied("ServiceObject") && runChecks() && ignore() == false ERROR this.getErrorMessage("9135", {class.name, type.name}):	!isUnnamed();
context CompositeDataTypePublicField if ((NamedElement) owner).runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9157", {((NamedElement)owner).name + "." + name}): this.type.isStringType();
context ServiceObject if runChecks("ServiceObject") && ignore() == false WARNING this.getWarningMessage("9122", {"ServiceObject", name}): ownedComment.size  > 0;
context SoftLink if softLinkType.name == "CustomGenericType" && ((NamedElement) owner).runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9158", {((NamedElement)owner).name + "." + name}): getJavaGenericSoftLinkType().length > 0;
context SoftLink if ((NamedElement) owner).runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9164", {name, ((NamedElement)owner).name}): this.belongsToBidirectionalAssociation() == false;

context ServiceObject if runChecks("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9170", {name, "class", this.fqn()}): this.isValidIdentifierName();
context Property if owner.asNamedElement().runChecks("ServiceObject") && owner.isStereotypeApplied("ServiceObject") && ignore() == false ERROR this.getErrorMessage("9170", {name, "property", owner.asNamedElement().fqn()}): this.isValidIdentifierName();


// Checks for stereotype POJO
context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9124", {"POJO", name}): ownedAttribute.select(e|e.isPropertySuppressed() == false).forAll( a | a.type != null);
context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9125", {"POJO", name}): ownedAttribute.select(e|e.isPropertySuppressed() == false).forAll( a | a.name.length > 0);
context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9127", {"POJO", name}): ownedOperation.forAll( e | e.areAllInputParametersNamed() == true);
context POJO if runChecks("POJO") && ignore() == false && compositeDataType ERROR this.getErrorMessage("9123", {"POJO", name}): this.superClass.size == 0;
context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9128", {"POJO", name}): ownedOperation.forAll( e | e.hasReturnType() == true);
context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9129", {"POJO", name}): ownedOperation.forAll( e | e.name.length > 0);
context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9130", {"POJO", name}): ownedOperation.forAll( e | e.hasOnlySupportedParamaterTypes());
context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9160", {name}): this.isStereotypeApplied("ServiceObject") == false;
context POJO if runChecks("POJO") && ignore() == false && compositeDataType ERROR this.getErrorMessage("9162", {this.fqn()}): compositeDataTypePublicFieldName.length > 0;
context POJO if runChecks("POJO") && ignore() == false && (generateEqualsAndHashCode() || generateEqualsAndHashCodeForStandardClasses()) WARNING this.getWarningMessage("9163", {this.fqn()}): this.hasBidirectionalAssociations() == false || this.hasOnlyTransientBidirectionalAssociations();

context POJO if runChecks("POJO") && ignore() == false && templateBinding.isEmpty == false ERROR this.getErrorMessage("9167", {owner.asNamedElement().fqn() + "." + name}): templateBinding.first().parameterSubstitution.isEmpty == false && templateBinding.first().parameterSubstitution.first().actual != null;
context POJO if runChecks("POJO") && ignore() == false && templateBinding.isEmpty == false ERROR this.getErrorMessage("9168", {this.fqn()}): templateBinding.size > 1;

context Property if isNavigable() && class != null && class.isStereotypeApplied("POJO") && runChecks() && ignore() == false ERROR this.getErrorMessage("9135", {class.name, type.name}):	!isUnnamed();
context CompositeDataTypePublicField if ((NamedElement) owner).runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9157", {((NamedElement)owner).name + "." + name}): this.type.isStringType();
context POJO if runChecks("POJO") && ignore() == false WARNING this.getWarningMessage("9122", {"POJO", name}): ownedComment.size  > 0;
context SoftLink if softLinkType.name == "CustomGenericType" && ((NamedElement) owner).runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9158", {((NamedElement)owner).name + "." + name}): getJavaGenericSoftLinkType().length > 0;
context SoftLink if ((NamedElement) owner).runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9164", {name, ((NamedElement)owner).name}): this.belongsToBidirectionalAssociation() == false;

context POJO if runChecks("POJO") && ignore() == false ERROR this.getErrorMessage("9170", {name, "class", this.fqn()}): this.isValidIdentifierName();
context Property if owner.asNamedElement().runChecks("POJO") && owner.isStereotypeApplied("POJO") && ignore() == false  ERROR this.getErrorMessage("9170", {name, "property", owner.asNamedElement().fqn()}): this.isValidIdentifierName();
context Operation if owner.asNamedElement().runChecks("POJO") && owner.isStereotypeApplied("POJO") && ignore() == false ERROR this.getErrorMessage("9170", {name, "operation", owner.asNamedElement().fqn()}): this.isValidIdentifierName();


// Checks for stereotype DomainObject
context DomainObject if runChecks("DomainObject") && ignore() == false ERROR this.getErrorMessage("9124", {"DomainObject", name}): ownedAttribute.select(e|e.isPropertySuppressed() == false).forAll( a | a.type != null);
context DomainObject if runChecks("DomainObject") && ignore() == false ERROR this.getErrorMessage("9125", {"DomainObject", name}): ownedAttribute.select(e|e.isPropertySuppressed() == false).forAll( a | a.name.length > 0);
context DomainObject if runChecks("DomainObject") && ignore() == false ERROR this.getErrorMessage("9128", {"DomainObject", name}): ownedOperation.forAll( e | e.hasReturnType() == true);
context DomainObject if runChecks("DomainObject") && ignore() == false ERROR this.getErrorMessage("9129", {"DomainObject", name}): ownedOperation.forAll( e | e.name.length > 0);
context DomainObject if runChecks("DomainObject") && ignore() == false ERROR this.getErrorMessage("9127", {"DomainObject", name}): ownedOperation.forAll( e | e.areAllInputParametersNamed() == true);
context DomainObject if runChecks("DomainObject") && ignore() == false ERROR this.getErrorMessage("9130", {"DomainObject", name}): ownedOperation.forAll( e | e.hasOnlySupportedParamaterTypes());
context Property if isNavigable() && class != null && class.isStereotypeApplied("DomainObject") && runChecks() && ignore() == false ERROR this.getErrorMessage("9135", {class.name, type.name}):	!isUnnamed();

context DomainObject if runChecks("DomainObject") && ignore() == false WARNING this.getWarningMessage("9122", {"DomainObject", name}): ownedComment.size  > 0;

context DomainObject if runChecks("DomainObject") && ignore() == false ERROR this.getErrorMessage("9170", {name, "class", this.fqn()}): this.isValidIdentifierName();
context Property if owner.asNamedElement().runChecks("DomainObject") && owner.isStereotypeApplied("DomainObject") && ignore() == false ERROR this.getErrorMessage("9170", {name, "property", owner.asNamedElement().fqn()}): this.isValidIdentifierName();
context Operation if owner.asNamedElement().runChecks("DomainObject") && owner.isStereotypeApplied("DomainObject") && ignore() == false ERROR this.getErrorMessage("9170", {name, "operation", owner.asNamedElement().fqn()}): this.isValidIdentifierName();


// Checks for stereotype JEAFService
context JEAFService if runChecks("JEAFService") && ignore() == false ERROR this.getErrorMessage("9126", {name}): ownedOperation.forAll( e | e.isSupportedReturnType() == true);
context JEAFService if runChecks("JEAFService") && ignore() == false ERROR this.getErrorMessage("9127", {"JEAFService", name}): ownedOperation.forAll( e | e.areAllInputParametersNamed() == true);
context JEAFService if runChecks("JEAFService") && ignore() == false ERROR this.getErrorMessage("9130", {"JEAFService", name}): ownedOperation.forAll( e | e.hasOnlySupportedParamaterTypes());
context JEAFService if runChecks("JEAFService") && ignore() == false WARNING this.getWarningMessage("9122", {"JEAFService", name}): ownedComment.size  > 0;
context JEAFService if runChecks("JEAFService") && ignore() == false ERROR this.getErrorMessage("9170", {name, "interface", this.fqn()}): this.isValidIdentifierName();
context Operation if owner.asNamedElement().runChecks("JEAFService") && owner.isStereotypeApplied("JEAFService") && ignore() == false ERROR this.getErrorMessage("9170", {name, "operation", owner.asNamedElement().fqn()}): this.isValidIdentifierName();


// Checks for stereotype JEAFEnumeration
context JEAFEnumeration if runChecks("JEAFEnumeration") && ignore() == false WARNING this.getWarningMessage("9122", {"JEAFEnumeration", name}): ownedComment.size  > 0;
context JEAFEnumeration if runChecks("JEAFEnumeration") && ignore() == false ERROR this.getErrorMessage("9170", {name, "enumeration", this.fqn()}): this.isValidIdentifierName();
context Property if owner.asNamedElement().runChecks("JEAFEnumeration") && owner.isStereotypeApplied("JEAFEnumeration") && ignore() == false ERROR this.getErrorMessage("9170", {name, "property", owner.asNamedElement().fqn()}): this.isValidIdentifierName();

context EnumerationLiteral if runChecks("JEAFEnumeration") && ignore() == false ERROR this.getErrorMessage("9169", {this.getMissingMandatorySlots(), name, owner.asNamedElement().name}): this.getMissingMandatorySlots().length == 0;
context EnumerationLiteral if runChecks("JEAFEnumeration") && owner.isStereotypeApplied("JEAFEnumeration") && ignore() == false ERROR this.getErrorMessage("9170", {name, "literal", this.fqn()}): this.isValidIdentifierName();


// Checks for stereotype QueryObject
context QueryObject if runChecks("QueryObject") && ignore() == false WARNING this.getWarningMessage("9122", {"QueryObject", name}): ownedComment.size  > 0;


// Checks for stereotype JEAFActivity
context JEAFActivity if runChecks("JEAFActivity") && ignore() == false ERROR this.getWarningMessage("9131", {name, this.getReturnParameterCount().toString()}): this.getReturnParameterCount()  == 1;

// Checks for stereotype Ignore
context Ignore if runChecks() WARNING this.getWarningMessage("9152", {name}): false;

// Checks for stereotype JEAFDeprecation
context JEAFDeprecated if this.asNamedElement().runChecks() && ignore() == false WARNING this.asNamedElement().getWarningMessage("9161", {owner.asNamedElement().fqn() + "." + this.asNamedElement().name}): this.asNamedElement().isDeprecationComplete();

context JEAFDeprecated if this.asNamedElement().runChecks() && ignore() == false && (this.getSuccessorName() != null && this.getSuccessorName().length > 0) ERROR this.asNamedElement().getErrorMessage("9173", {this.asNamedElement().fqn()}): this.isProperty();
context JEAFDeprecated if this.asNamedElement().runChecks() && ignore() == false && this.generateBackwardCompatibility() ERROR this.asNamedElement().getErrorMessage("9173", {this.asNamedElement().fqn()}): this.isProperty();
context JEAFDeprecated if this.asNamedElement().runChecks() && ignore() == false && this.generateBackwardCompatibility() && this.getSuccessorName().length > 0 && (this.owner.isPOJO() || this.owner.isServiceObject()) ERROR this.asNamedElement().getErrorMessage("9174", {this.getSuccessorName(),  owner.asNamedElement().fqn(), this.owner.getAllAttributesFromHierarchy().name.toString(", ")}): this.owner.getAllAttributesFromHierarchy().name.contains(this.getSuccessorName());
context JEAFDeprecated if this.asNamedElement().runChecks() && ignore() == false && this.generateBackwardCompatibility() ERROR this.asNamedElement().getErrorMessage("9175", {this.asNamedElement().name,  owner.asNamedElement().fqn()}): this.getSuccessorName() != null && this.getSuccessorName().trim().length > 0;

context Model if generateNotNullAnnotationForSingleValuedProperties() ERROR this.getErrorMessage("9176", {"NotNull", "notNullAnnotationNameForSingleValuedProperties"}): notNullAnnotationNameForSingleValuedProperties().length > 0;
context Model if generateNotEmptyAnnotationForMultiValuedProperties() ERROR this.getErrorMessage("9176", {"NotEmpty", "notEmptyAnnotationNameForMultiValuedProperties"}): notNullAnnotationNameForSingleValuedProperties().length > 0;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy