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

org.openxma.dsl.dom.DomDslPostProcessor.ext Maven / Gradle / Ivy

import ecore;

extension org::openxma::dsl::common::extensions::LogUtil;

process(xtext::GeneratedMetamodel this) :
      addNullValue(ePackage, "DataBaseConstraintType")  ->
  	 addNullValue(ePackage, "CrudOperationType")  -> 
	((ecore::EClass)ePackage.getEClassifier("Dependant")).setAbstract(true) ->
	((ecore::EClass)ePackage.getEClassifier("PresentableFeature")).setAbstract(true) ->
	((ecore::EClass)ePackage.getEClassifier("DaoFeature")).setAbstract(true) ->
	((ecore::EClass)ePackage.getEClassifier("ComplexType")).setAbstract(true) ->
	((ecore::EClass)ePackage.getEClassifier("Delegatee")).setAbstract(true) ->
	((ecore::EClass)ePackage.getEClassifier("FeatureReference")).addReference("target",ePackage.getEClassifier("Attribute"),1) -> 
	((ecore::EClass)ePackage.getEClassifier("Operation")).addReference("delegate",ePackage.getEClassifier("DelegateOperation"),1) -> 
	((ecore::EClass)ePackage.getEClassifier("Entity")).addReference("repository",ePackage.getEClassifier("Dao"),1) -> 
	((ecore::EClass)ePackage.getEClassifier("Entity")).addReference("key",ePackage.getEClassifier("AttributeGroup"),1) -> 
	((ecore::EClass)ePackage.getEClassifier("Entity")).addReference("sortOrders",ePackage.getEClassifier("AttributeGroup"),-1) -> 
	((ecore::EClass)ePackage.getEClassifier("Entity")).addReference("identifier",ePackage.getEClassifier("Attribute"),1) -> 
	((ecore::EClass)ePackage.getEClassifier("Entity")).addReference("version",ePackage.getEClassifier("Attribute"),1) -> 
	((ecore::EClass)ePackage.getEClassifier("Entity")).addReference("requiredReferences",ePackage.getEClassifier("Attribute"),-1) -> 
	((ecore::EClass)ePackage.getEClassifier("Entity")).addReference("requiredAttributes",ePackage.getEClassifier("Attribute"),-1) -> 

	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReference("dataType",ePackage.getType(),1,true,true) -> 
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReference("oppositeReference",ePackage.getEClassifier("Attribute"),1) -> 
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReadonlyAttribute("dataTypeName",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("name").eType) -> 
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReference("resolvedAttributeList",ePackage.getEClassifier("Attribute"),-1) ->
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReadonlyAttribute("reference",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("version").eType) -> 
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReadonlyAttribute("readOnly",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("version").eType) -> 
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReadonlyAttribute("required",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("version").eType) -> 
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReadonlyAttribute("derived",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("version").eType) -> 
	((ecore::EClass)ePackage.getEClassifier("Attribute")).addReadonlyAttribute("transient",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("version").eType) -> 
	
	((ecore::EClass)ePackage.getEClassifier("AttributeGroup")).addReference("resolvedAttributeList",ePackage.getEClassifier("Attribute"),-1) ->
	((ecore::EClass)ePackage.getEClassifier("DataBaseConstraint")).addReference("resolvedAttributeList",ePackage.getEClassifier("Attribute"),-1) ->

	((ecore::EClass)ePackage.getEClassifier("ComplexType")).addReference("allAttributes",ePackage.getEClassifier("Attribute"),-1) -> 

	((ecore::EClass)ePackage.getEClassifier("ManyToOne")).addReadonlyAttribute("derived",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("version").eType) ->
	((ecore::EClass)ePackage.getEClassifier("ManyToMany")).addAttribute("inverse",((ecore::EClass)ePackage.getEClassifier("Attribute")).getEStructuralFeature("version").eType) ->

	((ecore::EClass)ePackage.getEClassifier("Dao")).addReference("primaryKeyColumn",ePackage.getEClassifier("Column"),1) ->
	((ecore::EClass)ePackage.getEClassifier("Dao")).addReference("naturalKeyColumns",ePackage.getEClassifier("Column"),-1) ->
	((ecore::EClass)ePackage.getEClassifier("Dao")).addReference("versionColumn",ePackage.getEClassifier("Column"),1) ->
	((ecore::EClass)ePackage.getEClassifier("Dao")).addReference("primaryKey",ePackage.getEClassifier("DataBaseConstraint"),1) ->
	((ecore::EClass)ePackage.getEClassifier("Dao")).addReference("naturalKey",ePackage.getEClassifier("DataBaseConstraint"),1) ->
	
	ePackage.getEClass("Attribute").addSuperType(((xtext::Grammar)eContainer).getEPackage("core").getEClass("IDocumentable")) -> 	 	
	ePackage.getEClass("AttributeGroup").addSuperType(((xtext::Grammar)eContainer).getEPackage("core").getEClass("IDocumentable")) -> 	 	
	ePackage.getEClass("DelegateOperation").addSuperType(((xtext::Grammar)eContainer).getEPackage("core").getEClass("IDocumentable")) -> 	 	
	ePackage.getEClass("Operation").addSuperType(((xtext::Grammar)eContainer).getEPackage("core").getEClass("IDocumentable")) -> 	 	
	ePackage.getEClass("QueryOperation").addSuperType(((xtext::Grammar)eContainer).getEPackage("core").getEClass("IDocumentable")) -> 	 	
	ePackage.getEClass("FeatureReference").addSuperType(((xtext::Grammar)eContainer).getEPackage("core").getEClass("IDocumentable")) -> 	 	
	ePackage.getEClass("Property").addSuperType(((xtext::Grammar)eContainer).getEPackage("core").getEClass("IDocumentable")) 	 	
;

ecore::EPackage getEPackage(xtext::Grammar container, String ePackageName):
  container.metamodelDeclarations.typeSelect(xtext::ReferencedMetamodel).ePackage.selectFirst(e|e.name==ePackageName) 
;

Void addSuperType(ecore::EClass eClass, ecore::EClass eSuperType):
  eClass.eSuperTypes.add(eSuperType)
;

ecore::EClass getEClass(EPackage ePackage,String eClassName):
 (ecore::EClass)ePackage.getEClassifier(eClassName)
;


Void addNullValue(EPackage p, String toEnum):
 doAddNullValue( (ecore::EEnum) p.getEClassifier(toEnum) )
;
 
Void doAddNullValue(EEnum e):
 JAVA org.openxma.dsl.common.DslPostProcessor.addNullValue(org.eclipse.emf.ecore.EEnum);
 
create ecore::EReference addReference(ecore::EClassifier classifier, String name, ecore::EClassifier type, int upperBound):
 addReference(classifier,name,type,upperBound,false,true);

create ecore::EReference addReference(ecore::EClassifier classifier, String name, ecore::EClassifier type, int upperBound,boolean changeable,boolean volatile):
 setName(name) ->
 setTransient(true) ->
 setVolatile(volatile) ->
 setDerived(volatile) ->
 setEType(type) ->
 setChangeable(changeable) ->
 setResolveProxies(false) ->
 setUpperBound(upperBound) ->
 ((ecore::EClass)classifier).eStructuralFeatures.add(this);
 
create ecore::EAttribute addReadonlyAttribute(ecore::EClassifier classifier, String name, ecore::EClassifier type):
 setName(name) ->
 setDerived(true) ->
 setTransient(true) ->
 setVolatile(true) ->
 setChangeable(false) ->
 setEType(type) ->
 ((ecore::EClass)classifier).eStructuralFeatures.add(this);
 
  
create ecore::EAttribute addAttribute(ecore::EClassifier classifier, String name, ecore::EClassifier type):
 setName(name) ->
 setEType(type) ->
 ((ecore::EClass)classifier).eStructuralFeatures.add(this);
 
 
 
ecore::EClassifier getType(ecore::EPackage p):
JAVA org.openxma.dsl.dom.DomDslPostProcessor.getType(org.eclipse.emf.ecore.EPackage);
  




© 2015 - 2024 Weber Informatics LLC | Privacy Policy