diff --git a/.gitignore b/.gitignore index f4b878a..43f836d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ tmp/ # EMF src-gen/ +#Xtend +xtend-gen/ + # Maven target/ .polyglot.build.properties diff --git a/bundles/edu.kit.ipd.sdq.metamodels.families/.classpath b/bundles/edu.kit.ipd.sdq.metamodels.families/.classpath index 19e7b34..e3e8234 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.families/.classpath +++ b/bundles/edu.kit.ipd.sdq.metamodels.families/.classpath @@ -1,6 +1,8 @@ + + diff --git a/bundles/edu.kit.ipd.sdq.metamodels.families/.project b/bundles/edu.kit.ipd.sdq.metamodels.families/.project index e92f502..9409fe9 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.families/.project +++ b/bundles/edu.kit.ipd.sdq.metamodels.families/.project @@ -5,6 +5,11 @@ + + org.eclipse.xtext.ui.shared.xtextBuilder + + + org.eclipse.jdt.core.javabuilder @@ -25,5 +30,6 @@ org.eclipse.sirius.nature.modelingproject org.eclipse.jdt.core.javanature org.eclipse.pde.PluginNature + org.eclipse.xtext.ui.shared.xtextNature diff --git a/bundles/edu.kit.ipd.sdq.metamodels.families/META-INF/MANIFEST.MF b/bundles/edu.kit.ipd.sdq.metamodels.families/META-INF/MANIFEST.MF index 20abaa5..2e7e46b 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.families/META-INF/MANIFEST.MF +++ b/bundles/edu.kit.ipd.sdq.metamodels.families/META-INF/MANIFEST.MF @@ -11,6 +11,11 @@ Export-Package: edu.kit.ipd.sdq.metamodels.families, edu.kit.ipd.sdq.metamodels.families.impl, edu.kit.ipd.sdq.metamodels.families.util Require-Bundle: org.eclipse.core.runtime, - org.eclipse.emf.ecore;visibility:=reexport + org.eclipse.emf.ecore;visibility:=reexport, + edu.kit.ipd.sdq.activextendannotations, + com.google.guava, + org.eclipse.xtext.xbase.lib, + org.eclipse.xtend.lib, + org.eclipse.xtend.lib.macro Bundle-ActivationPolicy: lazy Automatic-Module-Name: edu.kit.ipd.sdq.metamodels.families diff --git a/bundles/edu.kit.ipd.sdq.metamodels.families/build.properties b/bundles/edu.kit.ipd.sdq.metamodels.families/build.properties index e981b6a..657a66f 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.families/build.properties +++ b/bundles/edu.kit.ipd.sdq.metamodels.families/build.properties @@ -6,5 +6,7 @@ bin.includes = .,\ plugin.xml,\ plugin.properties jars.compile.order = . -source.. = src-gen/ +source.. = src-gen/,\ + src/,\ + xtend-gen/ output.. = target/classes/ diff --git a/bundles/edu.kit.ipd.sdq.metamodels.families/src/edu/kit/ipd/sdq/metamodels/families/FamiliesUtil.xtend b/bundles/edu.kit.ipd.sdq.metamodels.families/src/edu/kit/ipd/sdq/metamodels/families/FamiliesUtil.xtend new file mode 100644 index 0000000..fedebf0 --- /dev/null +++ b/bundles/edu.kit.ipd.sdq.metamodels.families/src/edu/kit/ipd/sdq/metamodels/families/FamiliesUtil.xtend @@ -0,0 +1,72 @@ +package edu.kit.ipd.sdq.metamodels.families + +import edu.kit.ipd.sdq.activextendannotations.Utility +import java.util.ArrayList + +@Utility +class FamiliesUtil { + /** + * Returns whether the member is a child in its family. + * + * @param member the family member, must not be null + */ + def static boolean isChild(Member member) { + return (member.familySon ?: member.familyDaughter) !== null + } + + /** + * Returns the family of a members. Returns null if it has no family. + * + * @param member the member to return the family for, must not be null + */ + def static Family getFamily(Member member) { + return member.familyFather ?: member.familyMother ?: member.familySon ?: member.familyDaughter + } + + /** + * Returns the members of a family, consisting of father, mother, sons and daughters. + * + * @param family the family to return the members for, must not be null + */ + def static Iterable getMembers(Family family) { + val members = new ArrayList + if (family.father !== null) { + members += family.father + } + if (family.mother !== null) { + members += family.mother + } + members += family.sons + members += family.daughters + return members + } + + /** + * Returns the register of the family of a member. + * + * @param member the member to return the containing register for, must not be null and must + * have a containing family + * @see #getFamily(Member) + * @see #getRegister(Family) + */ + def static FamilyRegister getRegister(Member member) { + return member.family.register + } + + /** Returns the {@linkplain FamilyRegister} in which the family is contained. + * + * @param family the family to obtain the FamilyRegister from, must not be null + * @return family.eContainer as {@linkplain FamilyRegister}, if it actually is one + * @throws UnsupportedOperationException if the container is not a {@linkplain FamilyRegister} + */ + def static FamilyRegister getRegister(Family family) { + val container = family.eContainer + if (container instanceof FamilyRegister) { + return container + } else { + throw new UnsupportedOperationException( + "Cannot retrieve register of a family if it is not its direct container") + } + } + +} diff --git a/bundles/edu.kit.ipd.sdq.metamodels.insurance/.classpath b/bundles/edu.kit.ipd.sdq.metamodels.insurance/.classpath index 19e7b34..e3e8234 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.insurance/.classpath +++ b/bundles/edu.kit.ipd.sdq.metamodels.insurance/.classpath @@ -1,6 +1,8 @@ + + diff --git a/bundles/edu.kit.ipd.sdq.metamodels.insurance/.project b/bundles/edu.kit.ipd.sdq.metamodels.insurance/.project index 9919170..5e76214 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.insurance/.project +++ b/bundles/edu.kit.ipd.sdq.metamodels.insurance/.project @@ -5,6 +5,11 @@ + + org.eclipse.xtext.ui.shared.xtextBuilder + + + org.eclipse.jdt.core.javabuilder @@ -25,5 +30,6 @@ org.eclipse.sirius.nature.modelingproject org.eclipse.jdt.core.javanature org.eclipse.pde.PluginNature + org.eclipse.xtext.ui.shared.xtextNature diff --git a/bundles/edu.kit.ipd.sdq.metamodels.insurance/META-INF/MANIFEST.MF b/bundles/edu.kit.ipd.sdq.metamodels.insurance/META-INF/MANIFEST.MF index b8bde34..c369175 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.insurance/META-INF/MANIFEST.MF +++ b/bundles/edu.kit.ipd.sdq.metamodels.insurance/META-INF/MANIFEST.MF @@ -12,5 +12,10 @@ Export-Package: edu.kit.ipd.sdq.metamodels.insurance, edu.kit.ipd.sdq.metamodels.insurance.impl, edu.kit.ipd.sdq.metamodels.insurance.util Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport, - org.eclipse.core.runtime + org.eclipse.core.runtime, + edu.kit.ipd.sdq.activextendannotations, + com.google.guava, + org.eclipse.xtext.xbase.lib, + org.eclipse.xtend.lib, + org.eclipse.xtend.lib.macro Bundle-ActivationPolicy: lazy diff --git a/bundles/edu.kit.ipd.sdq.metamodels.insurance/build.properties b/bundles/edu.kit.ipd.sdq.metamodels.insurance/build.properties index e981b6a..657a66f 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.insurance/build.properties +++ b/bundles/edu.kit.ipd.sdq.metamodels.insurance/build.properties @@ -6,5 +6,7 @@ bin.includes = .,\ plugin.xml,\ plugin.properties jars.compile.order = . -source.. = src-gen/ +source.. = src-gen/,\ + src/,\ + xtend-gen/ output.. = target/classes/ diff --git a/bundles/edu.kit.ipd.sdq.metamodels.insurance/src/edu/kit/ipd/sdq/metamodels/insurance/InsuranceUtil.xtend b/bundles/edu.kit.ipd.sdq.metamodels.insurance/src/edu/kit/ipd/sdq/metamodels/insurance/InsuranceUtil.xtend new file mode 100644 index 0000000..b2c8bc8 --- /dev/null +++ b/bundles/edu.kit.ipd.sdq.metamodels.insurance/src/edu/kit/ipd/sdq/metamodels/insurance/InsuranceUtil.xtend @@ -0,0 +1,23 @@ +package edu.kit.ipd.sdq.metamodels.insurance + +import edu.kit.ipd.sdq.activextendannotations.Utility + +@Utility +class InsuranceUtil { + /** Returns the {@linkplain InsuranceDatabase} in which the client is contained. + * + * @param client the client to obtain the {@linkplain InsuranceDatabase} from, must not be null + * @return client.eContainer as InsuranceDatabase, if it actually is one + * @throws UnsupportedOperationException if the container is not a {@linkplain InsuranceDatabase} + */ + def static InsuranceDatabase getInsuranceDatabase(InsuranceClient client) { + val container = client.eContainer + + if (container instanceof InsuranceDatabase) { + return container + } + throw new UnsupportedOperationException( + "Cannot retrieve database of an insurance client if it is not its direct container") + } + +} diff --git a/bundles/edu.kit.ipd.sdq.metamodels.persons/.classpath b/bundles/edu.kit.ipd.sdq.metamodels.persons/.classpath index 19e7b34..e3e8234 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.persons/.classpath +++ b/bundles/edu.kit.ipd.sdq.metamodels.persons/.classpath @@ -1,6 +1,8 @@ + + diff --git a/bundles/edu.kit.ipd.sdq.metamodels.persons/.project b/bundles/edu.kit.ipd.sdq.metamodels.persons/.project index 4bfbf9e..a80c386 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.persons/.project +++ b/bundles/edu.kit.ipd.sdq.metamodels.persons/.project @@ -5,6 +5,11 @@ + + org.eclipse.xtext.ui.shared.xtextBuilder + + + org.eclipse.jdt.core.javabuilder @@ -25,5 +30,6 @@ org.eclipse.sirius.nature.modelingproject org.eclipse.jdt.core.javanature org.eclipse.pde.PluginNature + org.eclipse.xtext.ui.shared.xtextNature diff --git a/bundles/edu.kit.ipd.sdq.metamodels.persons/META-INF/MANIFEST.MF b/bundles/edu.kit.ipd.sdq.metamodels.persons/META-INF/MANIFEST.MF index 3d4859d..7f09943 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.persons/META-INF/MANIFEST.MF +++ b/bundles/edu.kit.ipd.sdq.metamodels.persons/META-INF/MANIFEST.MF @@ -11,6 +11,11 @@ Export-Package: edu.kit.ipd.sdq.metamodels.persons, edu.kit.ipd.sdq.metamodels.persons.impl, edu.kit.ipd.sdq.metamodels.persons.util Require-Bundle: org.eclipse.core.runtime, - org.eclipse.emf.ecore;visibility:=reexport + org.eclipse.emf.ecore;visibility:=reexport, + edu.kit.ipd.sdq.activextendannotations, + com.google.guava, + org.eclipse.xtext.xbase.lib, + org.eclipse.xtend.lib, + org.eclipse.xtend.lib.macro Bundle-ActivationPolicy: lazy Automatic-Module-Name: edu.kit.ipd.sdq.metamodels.persons diff --git a/bundles/edu.kit.ipd.sdq.metamodels.persons/build.properties b/bundles/edu.kit.ipd.sdq.metamodels.persons/build.properties index e981b6a..657a66f 100644 --- a/bundles/edu.kit.ipd.sdq.metamodels.persons/build.properties +++ b/bundles/edu.kit.ipd.sdq.metamodels.persons/build.properties @@ -6,5 +6,7 @@ bin.includes = .,\ plugin.xml,\ plugin.properties jars.compile.order = . -source.. = src-gen/ +source.. = src-gen/,\ + src/,\ + xtend-gen/ output.. = target/classes/ diff --git a/bundles/edu.kit.ipd.sdq.metamodels.persons/src/edu/kit/ipd/sdq/metamodels/persons/PersonsUtil.xtend b/bundles/edu.kit.ipd.sdq.metamodels.persons/src/edu/kit/ipd/sdq/metamodels/persons/PersonsUtil.xtend new file mode 100644 index 0000000..97431a9 --- /dev/null +++ b/bundles/edu.kit.ipd.sdq.metamodels.persons/src/edu/kit/ipd/sdq/metamodels/persons/PersonsUtil.xtend @@ -0,0 +1,23 @@ +package edu.kit.ipd.sdq.metamodels.persons + +import edu.kit.ipd.sdq.activextendannotations.Utility + +@Utility +class PersonsUtil { + /** Returns the {@linkplain PersonRegister} in which the person is contained. + * + * @param person the person to obtain the {@linkplain PersonRegister} from, must not be null + * @return person.eContainer as PersonRegister, if it actually is one + * @throws UnsupportedOperationException if the container is not a {@linkplain PersonRegister} + */ + def static PersonRegister getPersonRegister(Person person) { + val container = person.eContainer + + if (container instanceof PersonRegister) { + return container + } + throw new UnsupportedOperationException( + "Cannot retrieve register of a person if it is not its direct container") + } + +} diff --git a/releng/edu.kit.ipd.sdq.metamodels.demo.parent/pom.xml b/releng/edu.kit.ipd.sdq.metamodels.demo.parent/pom.xml index ea60b22..4274b73 100644 --- a/releng/edu.kit.ipd.sdq.metamodels.demo.parent/pom.xml +++ b/releng/edu.kit.ipd.sdq.metamodels.demo.parent/pom.xml @@ -23,6 +23,11 @@ p2 http://download.eclipse.org/releases/2021-12 + + XAnnotations + p2 + https://kit-sdq.github.io/updatesite/release/xannotations/1.5.0/ +