-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
7,940 additions
and
145 deletions.
There are no files selected for viewing
Binary file not shown.
390 changes: 313 additions & 77 deletions
390
migdb.generator/xtend-gen/migdb/generator/Generator.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
library builder_app; | ||
modeltype APP uses "http://www.collectionspro.eu/jam/mm/app"; | ||
|
||
/******************************************** | ||
* CLASS HELPERS * | ||
********************************************/ | ||
|
||
helper addPrimitiveClass(_name : String, _primitiveType : PrimitiveType) : APP::operations::AddPrimitiveClass { | ||
return object APP::operations::AddPrimitiveClass { | ||
name := _name; | ||
primitiveType := _primitiveType; | ||
} | ||
} | ||
|
||
helper addEmbeddedClass(_name : String) : APP::operations::AddEmbeddedClass { | ||
return object APP::operations::AddEmbeddedClass { | ||
name := _name; | ||
} | ||
} | ||
|
||
helper addClass(_name : String, _isAbstract : Boolean, _inheritanceType : InheritanceType) : APP::operations::AddClass { | ||
return object APP::operations::AddClass { | ||
name := _name; | ||
isAbstract := _isAbstract; | ||
inheritanceType := _inheritanceType; | ||
} | ||
} | ||
|
||
helper renameEntiry(_name : String, _newName : String) : APP::operations::RenameEntity { | ||
return object APP::operations::RenameEntity { | ||
name := _name; | ||
newName := _newName; | ||
} | ||
} | ||
|
||
helper removeEntiry(_name : String) : APP::operations::RemoveEntity { | ||
return object APP::operations::RemoveEntity { | ||
name := _name; | ||
} | ||
} | ||
|
||
/******************************************** | ||
* PROPERTY HELPERS * | ||
********************************************/ | ||
|
||
helper addProperty(_owningClassName : String, _name : String, _type : String) : APP::operations::AddProperty { | ||
return object APP::operations::AddProperty { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
type := _type; | ||
} | ||
} | ||
|
||
helper renameProperty(_owningClassName : String, _name : String, _newName : String) : APP::operations::RenameProperty { | ||
return object APP::operations::RenameProperty { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
newName := _newName; | ||
} | ||
} | ||
|
||
helper removeProperty(_owningClassName : String, _name : String) : APP::operations::RemoveProperty { | ||
return object APP::operations::RemoveProperty { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
} | ||
} | ||
|
||
/******************************************** | ||
* SET HELPERS * | ||
********************************************/ | ||
|
||
helper setOpposite(_firstClassName : String, _firstPropertyName : String, _secondClassName : String, _secondPropertyName : String, _isOpposite : Boolean) : APP::operations::SetOpposite { | ||
return object APP::operations::SetOpposite { | ||
firstClassName := _firstClassName; | ||
firstPropertyName := _firstPropertyName; | ||
secondClassName := _secondClassName; | ||
secondPropertyName := _secondPropertyName; | ||
isOpposite := _isOpposite; | ||
} | ||
} | ||
|
||
helper setAbstract(_name : String, _isAbstract : Boolean) : APP::operations::SetAbstract { | ||
return object APP::operations::SetAbstract { | ||
name := _name; | ||
isAbstract := _isAbstract; | ||
} | ||
} | ||
|
||
helper setParent(_name : String, _parentName : String, _properties : OrderedSet(String)) : APP::operations::SetParent { | ||
return object APP::operations::SetParent { | ||
name := _name; | ||
parentName := _parentName; | ||
properties := _properties; | ||
} | ||
} | ||
|
||
helper setType(_owningClassName : String, _name : String, _type : String) : APP::operations::SetType { | ||
return object APP::operations::SetType { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
type := _type; | ||
} | ||
} | ||
|
||
helper setBoundries(_owningClassName : String, _name : String, _lowerBound : Integer, _upperBound : Integer) : APP::operations::SetBoundries { | ||
return object APP::operations::SetBoundries { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
lowerBound := _lowerBound; | ||
upperBound := _upperBound; | ||
} | ||
} | ||
|
||
helper setOrdered(_owningClassName : String, _name : String, _isOrdered : Boolean) : APP::operations::SetOrdered { | ||
return object APP::operations::SetOrdered { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
isOrdered := _isOrdered; | ||
} | ||
} | ||
|
||
helper setUnique(_owningClassName : String, _name : String, _isUnique : Boolean) : APP::operations::SetUnique { | ||
return object APP::operations::SetUnique { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
isUnique := _isUnique; | ||
} | ||
} | ||
|
||
/******************************************** | ||
* COMPLEX HELPERS * | ||
********************************************/ | ||
|
||
|
||
helper copyProperty(_name : String, _targetClassName : String, _type : APP::operations::MergeType) : APP::operations::CopyProperty { | ||
return object APP::operations::CopyProperty { | ||
name := _name; | ||
targetClassName := _targetClassName; | ||
type := _type; | ||
} | ||
} | ||
|
||
helper moveProperty(_owningClassName : String, _name : String, _targetClassName : String, _type : APP::operations::MergeType) : APP::operations::MoveProperty { | ||
return object APP::operations::MoveProperty { | ||
owningClassName := _owningClassName; | ||
name := _name; | ||
targetClassName := _targetClassName; | ||
type := _type; | ||
} | ||
} | ||
|
||
helper extractClass(_sourceClassName : String, _extractPropertiesNames : OrderedSet(String), _extractClassName : String) : APP::operations::ExtractClass { | ||
return object APP::operations::ExtractClass { | ||
sourceClassName := _sourceClassName; | ||
extractPropertiesNames := _extractPropertiesNames; | ||
extractClassName := _extractClassName; | ||
} | ||
} | ||
|
||
/******************************************** | ||
* BUILD MODEL * | ||
********************************************/ | ||
helper _embeddedClass(_name : String, _properties : OrderedSet(Property)) : EmbeddedClass { | ||
return object EmbeddedClass{ | ||
properties := _properties; | ||
name := _name; | ||
}; | ||
} | ||
|
||
helper _property(_name : String, _type : Entity, _lowerBound : Integer, _upperBound : Integer) : Property { | ||
return object Property { | ||
name := _name; | ||
type := _type; | ||
lowerBound := _lowerBound; | ||
upperBound := _upperBound; | ||
} | ||
} | ||
|
||
helper _property(_name : String, _type : Entity) : Property { | ||
return object Property { | ||
name := _name; | ||
type := _type; | ||
} | ||
} | ||
|
||
helper _property(_name : String, _type : Entity, _isID : Boolean) : Property { | ||
return object Property { | ||
name := _name; | ||
type := _type; | ||
isID := _isID; | ||
} | ||
} | ||
|
||
helper _class(_name : String, _properties : OrderedSet(Property)) : Class { | ||
return object Class { | ||
name := _name; | ||
properties := _properties; | ||
} | ||
} | ||
|
||
helper _class(_name : String, _parent : Class, _properties : OrderedSet(Property)) : Class { | ||
return object Class { | ||
name := _name; | ||
properties := _properties; | ||
parent := _parent; | ||
} | ||
} | ||
|
||
helper _primitiveClass(_name : String, _primitiveType : PrimitiveType) : PrimitiveClass { | ||
return object PrimitiveClass { | ||
name := _name; | ||
primitiveType := _primitiveType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
modeltype RDB uses "http://www.collectionspro.eu/jam/mm/rdb"; | ||
library builder_rdb; | ||
|
||
helper addSchema(_name : String) : RDB::operations::AddSchema { | ||
return object RDB::operations::AddSchema { | ||
name := _name; | ||
} | ||
} | ||
|
||
helper addSequence(_owningSchemaName : String, _name : String, _startValue : Integer) : RDB::operations::AddSequence { | ||
return object RDB::operations::AddSequence { | ||
owningSchemaName :=_owningSchemaName ; | ||
name := _name; | ||
startValue := _startValue; | ||
|
||
} | ||
} | ||
|
||
/******************************************** | ||
* BUILD MODEL * | ||
********************************************/ | ||
|
||
helper _table(_name : String, _columns : OrderedSet(Column), _constraints : OrderedSet(TableConstraint) ) : Table { | ||
return object Table { | ||
name := _name; | ||
columns := _columns; | ||
constraints := _constraints; | ||
} | ||
} | ||
|
||
helper _index(_name : String, _columns : OrderedSet(Column)) : Index { | ||
return object Index { | ||
name := _name; | ||
columns := _columns; | ||
} | ||
} | ||
|
||
helper _primaryKey(_name : String, _underlineIndex : Index) : PrimaryKey { | ||
return object PrimaryKey { | ||
name := _name; | ||
underlyingIndex := _underlineIndex; | ||
} | ||
} | ||
|
||
helper _foreignKey(_name : String, _table : Table, _constrainedColumn : Column) : ForeignKey { | ||
return object ForeignKey { | ||
name := _name; | ||
targetTable := _table; | ||
constrainedColumn := _constrainedColumn; | ||
} | ||
} | ||
|
||
helper _column(_name : String, _type : PrimitiveType) : Column { | ||
return object Column { | ||
name := _name; | ||
type := _type; | ||
} | ||
} | ||
|
||
helper _sequence(_name : String, _startValue : Integer) : RDB::Sequence { | ||
return object RDB::Sequence { | ||
name := _name; | ||
startValue := _startValue; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import builder_app; | ||
modeltype APP uses "http://www.collectionspro.eu/jam/mm/app"; | ||
transformation secondAPP(out inoutModel : APP); | ||
|
||
|
||
main() { | ||
log("TEST_APP_1: valid"); | ||
var integer : APP::PrimitiveClass := _primitiveClass("Integer", PrimitiveType::int); | ||
var string : APP::PrimitiveClass := _primitiveClass("String", PrimitiveType::char); | ||
var country : APP::Class := _class("Country", OrderedSet{ _property("id",integer,true), _property("name", string)}); | ||
var party : APP::Class := _class("Party", OrderedSet{ _property("id",integer,true),_property("street", string),_property("city", string), _property("zip", string), _property("country", country)}); | ||
|
||
var model : APP::ModelRoot := object ModelRoot { | ||
modelGenerations += object ModelGeneration { | ||
isMissing := false; | ||
classes += Set{integer,string,country,party, | ||
_class("LegalPerson", party, OrderedSet{_property("regNo", integer), _property("bisName", string)}), | ||
_class("NaturalPerson",party, OrderedSet{_property("name", string), _property("surname", string)}) | ||
}; | ||
}; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import builder_app; | ||
modeltype APP uses "http://www.collectionspro.eu/jam/mm/app"; | ||
transformation secondAPP(out inoutModel : APP); | ||
|
||
|
||
main() { | ||
log("TEST_APP_2 - invalid : Class name"); | ||
var integer : APP::PrimitiveClass := _primitiveClass("Integer", PrimitiveType::int); | ||
var string : APP::PrimitiveClass := _primitiveClass("String", PrimitiveType::char); | ||
var country : APP::Class := _class("Country", OrderedSet{ _property("id",integer,true), _property("name", string)}); | ||
var party : APP::Class := _class("Party", OrderedSet{ _property("id",integer,true),_property("street", string),_property("city", string), _property("zip", string), _property("country", country)}); | ||
|
||
var model : APP::ModelRoot := object ModelRoot { | ||
modelGenerations += object ModelGeneration { | ||
isMissing := false; | ||
classes += Set{integer,string,country,party, party.deepclone()![APP::Class], | ||
_class("LegalPerson", party, OrderedSet{_property("regNo", integer), _property("bisName", string)}), | ||
_class("NaturalPerson",party, OrderedSet{_property("name", string), _property("surname", string)}) | ||
}; | ||
}; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import builder_app; | ||
modeltype APP uses "http://www.collectionspro.eu/jam/mm/app"; | ||
transformation secondAPP(out inoutModel : APP); | ||
|
||
main() { | ||
log("TEST_APP_3 - invalid : Property name"); | ||
var integer : APP::PrimitiveClass := _primitiveClass("Integer", PrimitiveType::int); | ||
var string : APP::PrimitiveClass := _primitiveClass("String", PrimitiveType::char); | ||
var country : APP::Class := _class("Country", OrderedSet{ _property("id",integer,true), _property("name", string), _property("name", integer)}); | ||
var party : APP::Class := _class("Party", OrderedSet{ _property("id",integer,true),_property("street", string),_property("city", string), _property("zip", string), _property("country", country)}); | ||
|
||
var model : APP::ModelRoot := object ModelRoot { | ||
modelGenerations += object ModelGeneration { | ||
isMissing := false; | ||
classes += Set{integer,string,country,party, | ||
_class("LegalPerson", party, OrderedSet{_property("regNo", integer), _property("bisName", string)}), | ||
_class("NaturalPerson",party, OrderedSet{_property("name", string), _property("surname", string)}) | ||
}; | ||
}; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import builder_app; | ||
modeltype APP uses "http://www.collectionspro.eu/jam/mm/app"; | ||
transformation secondAPP(out inoutModel : APP); | ||
|
||
main() { | ||
log("TEST_APP_4 - invalid : Cycled hierarchy"); | ||
var integer : APP::PrimitiveClass := _primitiveClass("Integer", PrimitiveType::int); | ||
var string : APP::PrimitiveClass := _primitiveClass("String", PrimitiveType::char); | ||
var country : APP::Class := _class("Country", OrderedSet{ _property("id",integer,true), _property("name", string)}); | ||
country.parent := country; | ||
var party : APP::Class := _class("Party", OrderedSet{ _property("id",integer,true),_property("street", string),_property("city", string), _property("zip", string), _property("country", country)}); | ||
|
||
var model : APP::ModelRoot := object ModelRoot { | ||
modelGenerations += object ModelGeneration { | ||
isMissing := false; | ||
classes += Set{integer,string,country,party, | ||
_class("LegalPerson", party, OrderedSet{_property("regNo", integer), _property("bisName", string)}), | ||
_class("NaturalPerson",party, OrderedSet{_property("name", string), _property("surname", string)}) | ||
}; | ||
}; | ||
}; | ||
|
||
} |
Oops, something went wrong.