Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Mollik2018-02-23 09:56:08 -0500
committerRalf Mollik2018-02-23 09:56:08 -0500
commit7717719edd87469f9074c8c3a14861f622578e9c (patch)
tree99c2204076a05d97a723ac8bd33e466178fd5ec5
parent896f9189beed30d7ab180e4ffbdfedc059d315f9 (diff)
downloadorg.eclipse.osbp.utils-7717719edd87469f9074c8c3a14861f622578e9c.tar.gz
org.eclipse.osbp.utils-7717719edd87469f9074c8c3a14861f622578e9c.tar.xz
org.eclipse.osbp.utils-7717719edd87469f9074c8c3a14861f622578e9c.zip
catch up with dev
-rw-r--r--.gitignore40
-rw-r--r--.settings/org.eclipse.core.resources.prefs2
-rw-r--r--.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--jenkins.build.config.xml3
-rw-r--r--org.eclipse.osbp.utils.feature/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.eclipse.osbp.utils.feature/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--org.eclipse.osbp.utils.feature/.settings/org.eclipse.xtend.core.Xtend.prefs10
-rw-r--r--org.eclipse.osbp.utils.feature/feature.xml3
-rw-r--r--org.eclipse.osbp.utils/.classpath9
-rw-r--r--org.eclipse.osbp.utils/.settings/com.vaadin.integration.eclipse.prefs3
-rw-r--r--org.eclipse.osbp.utils/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.eclipse.osbp.utils/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.osbp.utils/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--org.eclipse.osbp.utils/.settings/org.eclipse.pde.core.prefs3
-rw-r--r--org.eclipse.osbp.utils/.settings/org.eclipse.xtend.core.Xtend.prefs13
-rw-r--r--org.eclipse.osbp.utils/META-INF/MANIFEST.MF27
-rw-r--r--org.eclipse.osbp.utils/pom.xml10
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/Activator.java3
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend47
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/SystemInformation.java14
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend232
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/.gitignore6
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/annotation/CommonUtils.java3
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java164
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java338
25 files changed, 475 insertions, 473 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d39d2f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,40 @@
+**/bin/
+**/target/
+**/VAADIN/gwt-unitCache/
+**/VAADIN/widgetsets/
+**._trace
+**.log.properties
+**git.properties
+**/target/
+**/.metadata/
+
+**/emf-gen/**/.gitignore
+**/src-gen/**/.gitignore
+**/git.properties
+**/*.java._trace
+**/*.log
+**/*.log.properties
+
+**/bin/
+**/build/
+*.class
+*.ctrl
+**/Debug/
+.DS_Store
+*.ear
+*.war
+
+**/*.actionbin
+**/*.blipbin
+**/*.chartbin
+**/*.cubebin
+**/*.datatypebin
+**/*.dtobin
+**/*.entitybin
+**/*.servicebin
+**/*.tablebin
+**/*.uibin
+**/*.uisemanticbin
+**/*.xtendbin
+**/*.xtextbin
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml
index 095bde4..0ffdd04 100644
--- a/jenkins.build.config.xml
+++ b/jenkins.build.config.xml
@@ -17,9 +17,8 @@
<jenkins.build.dependencies>
<jenkins.build.dependency>org.eclipse.osbp.dsl</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.ecview.addons</jenkins.build.dependency>
- <jenkins.build.dependency>org.eclipse.osbp.eventbroker</jenkins.build.dependency>
- <jenkins.build.dependency>org.eclipse.osbp.persistence</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.preferences</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.ui.api</jenkins.build.dependency>
+ <jenkins.build.dependency>org.eclipse.osbp.xtext.oxtype</jenkins.build.dependency>
</jenkins.build.dependencies>
</jenkins>
diff --git a/org.eclipse.osbp.utils.feature/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.utils.feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.eclipse.osbp.utils.feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.utils.feature/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.utils.feature/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/org.eclipse.osbp.utils.feature/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/org.eclipse.osbp.utils.feature/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.utils.feature/.settings/org.eclipse.xtend.core.Xtend.prefs
new file mode 100644
index 0000000..f6a7c78
--- /dev/null
+++ b/org.eclipse.osbp.utils.feature/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,10 @@
+//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend
+BuilderConfiguration.is_project_specific=true
+eclipse.preferences.version=1
+is_project_specific=true
+outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
+outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
+outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.utils.feature/feature.xml b/org.eclipse.osbp.utils.feature/feature.xml
index ffe6b41..43acdb9 100644
--- a/org.eclipse.osbp.utils.feature/feature.xml
+++ b/org.eclipse.osbp.utils.feature/feature.xml
@@ -14,7 +14,8 @@
id="org.eclipse.osbp.utils.feature"
label="%featureName"
version="0.9.0.qualifier"
- provider-name="%providerName">
+ provider-name="%providerName"
+ plugin="org.eclipse.osbp.utils">
<description>
%description
diff --git a/org.eclipse.osbp.utils/.classpath b/org.eclipse.osbp.utils/.classpath
new file mode 100644
index 0000000..12b082f
--- /dev/null
+++ b/org.eclipse.osbp.utils/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="src" path="test/"/>
+ <classpathentry kind="src" path="xtend-gen/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.osbp.utils/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.utils/.settings/com.vaadin.integration.eclipse.prefs
new file mode 100644
index 0000000..724dece
--- /dev/null
+++ b/org.eclipse.osbp.utils/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,3 @@
+com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"]
+com.vaadin.integration.eclipse.previousCompileAction=widgetset
+eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.utils/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.utils/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.eclipse.osbp.utils/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.utils/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.utils/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8e3baab
--- /dev/null
+++ b/org.eclipse.osbp.utils/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
diff --git a/org.eclipse.osbp.utils/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.utils/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/org.eclipse.osbp.utils/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/org.eclipse.osbp.utils/.settings/org.eclipse.pde.core.prefs b/org.eclipse.osbp.utils/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..f29e940
--- /dev/null
+++ b/org.eclipse.osbp.utils/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.eclipse.osbp.utils/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.utils/.settings/org.eclipse.xtend.core.Xtend.prefs
new file mode 100644
index 0000000..bac9b82
--- /dev/null
+++ b/org.eclipse.osbp.utils/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,13 @@
+//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend
+BuilderConfiguration.is_project_specific=true
+eclipse.preferences.version=1
+is_project_specific=true
+outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
+outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
+outlet.DEFAULT_OUTPUT.sourceFolder.iban4j.org-src.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.jfairy.org-resources.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.jfairy.org-src.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.utils/META-INF/MANIFEST.MF b/org.eclipse.osbp.utils/META-INF/MANIFEST.MF
index aff8bce..449acfb 100644
--- a/org.eclipse.osbp.utils/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.utils/META-INF/MANIFEST.MF
@@ -4,37 +4,34 @@ Bundle-Name: org.eclipse.osbp.utils
Bundle-SymbolicName: org.eclipse.osbp.utils;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Activator: org.eclipse.osbp.utils.Activator
-Import-Package: com.google.gwt.json.client;version="7.3.7",
- javax.inject,
+Import-Package: javax.inject,
javax.servlet;version="2.6.0",
org.apache.log4j;version="1.2.15",
org.eclipse.osbp.ui.api.datamart;version="0.9.0",
org.osgi.service.event;version="1.3.0"
Bundle-ActivationPolicy: lazy
Require-Bundle: org.slf4j.api;bundle-version="1.7.2",
- com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.7.6,7.8.0)",
org.apache.commons.codec,
org.apache.commons.lang;bundle-version="2.6.0",
org.apache.commons.lang3;bundle-version="3.1.0",
org.eclipse.core.runtime;bundle-version="3.9.0",
- org.eclipse.xtend.lib;bundle-version="[2.7.3,2.8.0)",
- org.eclipse.xtext;bundle-version="[2.7.3,2.8.0)",
- org.eclipse.xtext.common.types;bundle-version="[2.7.3,2.8.0)",
+ org.eclipse.xtend.lib;bundle-version="[2.11.0,2.12.0)",
+ org.eclipse.xtext;bundle-version="[2.11.0,2.12.0)",
+ org.eclipse.xtext.common.types;bundle-version="[2.11.0,2.12.0)",
org.eclipse.emf.ecore.xcore,
- org.eclipse.xtext.xbase.lib;bundle-version="[2.7.3,2.8.0)",
+ org.eclipse.xtext.xbase.lib;bundle-version="[2.11.0,2.12.0)",
org.junit;bundle-version="4.11.0",
org.joda.convert;bundle-version="1.7.0",
org.joda.money;bundle-version="0.10.0",
joda-time;bundle-version="2.7.0",
- org.eclipse.osbp.preferences;bundle-version="[0.9.0,0.10.0)",
- org.eclipse.osbp.eventbroker;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.gitinfo;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.dsl.datatype.lib;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.dsl.dto.xtext;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.dsl.entity.xtext;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.ecview.dsl;bundle-version="[0.9.0,0.10.0)",
- org.eclipse.osbp.persistence;bundle-version="[0.9.0,0.10.0)",
- org.eclipse.osbp.dsl.dto.lib;bundle-version="0.9.0"
+ org.eclipse.osbp.xtext.oxtype;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.preferences;bundle-version="[0.9.0,0.10.0)"
Bundle-ClassPath: .
Export-Package: org.eclipse.osbp.utils;version="0.9.0",
org.eclipse.osbp.utils.annotation;version="0.9.0",
@@ -44,13 +41,7 @@ Export-Package: org.eclipse.osbp.utils;version="0.9.0",
org.eclipse.osbp.utils.currency;version="0.9.0",
org.eclipse.osbp.utils.currency.test;version="0.9.0",
org.eclipse.osbp.utils.entityhelper;version="0.9.0",
- org.eclipse.osbp.utils.entitymock;version="0.9.0",
- org.eclipse.osbp.utils.fillertext;version="0.9.0",
- org.eclipse.osbp.utils.fillertext.provider;version="0.9.0",
- org.eclipse.osbp.utils.fillertext.test;version="0.9.0",
- org.eclipse.osbp.utils.session;version="0.9.0",
- org.eclipse.osbp.utils.theme;version="0.9.0",
- org.eclipse.osbp.utils.xtext;version="0.9.0"
+ org.eclipse.osbp.utils.session;version="0.9.0"
Bundle-Vendor: Eclipse OSBP
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Service-Component: OSGI-INF/eobjectloader.xml
diff --git a/org.eclipse.osbp.utils/pom.xml b/org.eclipse.osbp.utils/pom.xml
index d05f218..c3184d0 100644
--- a/org.eclipse.osbp.utils/pom.xml
+++ b/org.eclipse.osbp.utils/pom.xml
@@ -20,5 +20,13 @@
</parent>
<artifactId>org.eclipse.osbp.utils</artifactId>
<packaging>eclipse-plugin</packaging>
-
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.osbp.ui.api</groupId>
+ <artifactId>org.eclipse.osbp.ui.api</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <type>eclipse-plugin</type>
+ </dependency>
+ </dependencies>
+
</project>
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/Activator.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/Activator.java
index 61b427d..003974a 100644
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/Activator.java
+++ b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/Activator.java
@@ -16,8 +16,6 @@ import org.eclipse.osbp.gitinfo.Loginfo;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.eclipse.osbp.preferences.ProductConfiguration;
-
public class Activator implements BundleActivator {
private static BundleContext context;
@@ -34,7 +32,6 @@ public class Activator implements BundleActivator {
Loginfo li = new Loginfo();
li.print( Activator.class.getCanonicalName(), Activator.class.getClassLoader());
Activator.context = bundleContext;
- ProductConfiguration.getLanguages();
}
/*
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend
index bf5deb2..1ec22ff 100644
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend
+++ b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend
@@ -26,8 +26,8 @@ import org.eclipse.osbp.dsl.semantic.common.types.LTypedPackage
import org.eclipse.osbp.dsl.semantic.dto.util.NamingConventionsUtil
import org.eclipse.osbp.dsl.semantic.entity.OSBPEntityPackage
import org.eclipse.emf.ecore.EObject
-import org.eclipse.osbp.dsl.semantic.common.types.LPackage
import org.eclipse.osbp.dsl.semantic.entity.LBean
+import org.eclipse.emf.ecore.resource.ResourceSet
class EntityUtils {
@@ -39,7 +39,7 @@ class EntityUtils {
val objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, searchName)
if (objectDescs.iterator.hasNext) {
val eobjectDesc = objectDescs.iterator.next
- if (resourceSet != null) {
+ if (resourceSet !== null) {
//var dto = resourceSet.getEObject(eobjectDesc.EObjectURI, true) as LDto
return eobjectDesc.name.toString
@@ -51,6 +51,26 @@ class EntityUtils {
return null
}
+ def static LDto getDtoForEntity(JvmType type) {
+ return getDtoForEntity(type.qualifiedName, type.eResource.resourceSet)
+ }
+
+ def static LDto getDtoForEntity(String qualifiedEntityName, ResourceSet resourceSet) {
+ try {
+ var searchName = qualifiedEntityName.getQualifiedDtoNameForQualifiedEntityName;
+ val objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, searchName)
+ if (objectDescs.iterator.hasNext) {
+ val eobjectDesc = objectDescs.iterator.next
+ if (resourceSet !== null) {
+ return resourceSet.getEObject(eobjectDesc.EObjectURI, true) as LDto
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace
+ }
+ return null
+ }
+
/**
* get the full qualified dto name for a LEnum
* <br>
@@ -58,7 +78,7 @@ class EntityUtils {
*/
def static String getDtoFQNForLEnum(LEnum lenum) {
var container = lenum as EObject
- while ((container != null) && !(container instanceof LTypedPackage)) {
+ while ((container !== null) && !(container instanceof LTypedPackage)) {
container = container.eContainer
}
return applyDtoPackageNameFromEntityPackageNameForEnum(
@@ -98,7 +118,7 @@ class EntityUtils {
}
/**
- * get the full qualified dto name for a LEntity!
+ * get the full qualified dto name for a full qualified entity name!
* <br>
* <b>The DTO for an LEntity <u>always</u> ends with the postfix <code>Dto</code>!</b>
*/
@@ -106,6 +126,15 @@ class EntityUtils {
return NamingConventionsUtil.toDtoQualifiedName(qualifiedEntityName);
}
+ /**
+ * get the full qualified dto name for a full qualified entity name!
+ * <br>
+ * <b>The DTO for an LEntity <u>always</u> ends with the postfix <code>Dto</code>!</b>
+ */
+ public def static String getQualifiedEntityNameForQualifiedDtoName(String qualifiedDtoName) {
+ return NamingConventionsUtil.toFqnEntityName(qualifiedDtoName);
+ }
+
private final static String DTOS_PACKAGE_TOKEN = ".dtos."
/**
@@ -139,15 +168,15 @@ class EntityUtils {
val objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, qualifiedDtoName)
if (objectDescs.iterator.hasNext) {
val eobjectDesc = objectDescs.iterator.next
- if (resourceSet != null) {
+ if (resourceSet !== null) {
var dto = resourceSet.getEObject(eobjectDesc.EObjectURI, true) as LDto
- if (dto != null && dto.wrappedType != null) {
+ if (dto !== null && dto.wrappedType !== null) {
if (dto.wrappedType.eIsProxy) {
val entityDescs = ServiceListener.getEObjectDescriptions(OSBPEntityPackage.Literals.LENTITY,
qualifiedDtoName.replace(".dtos.", ".entities.").replace("Dto", ""))
if (entityDescs.iterator.hasNext) {
val entityObjectDesc = entityDescs.iterator.next
- if (resourceSet != null) {
+ if (resourceSet !== null) {
entity = resourceSet.getEObject(entityObjectDesc.EObjectURI, true) as LEntity
}
}
@@ -166,7 +195,7 @@ class EntityUtils {
def static LEntity getEntityFromDto(LDto dto) {
var LEntity entity = null
- if (dto != null && dto.wrappedType != null) {
+ if (dto !== null && dto.wrappedType !== null) {
if (dto.wrappedType.eIsProxy) {
throw new IllegalStateException
} else {
@@ -184,7 +213,7 @@ class EntityUtils {
val objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, qualifiedDtoName)
if (objectDescs.iterator.hasNext) {
val eobjectDesc = objectDescs.iterator.next
- if (resourceSet != null) {
+ if (resourceSet !== null) {
return resourceSet.getEObject(eobjectDesc.EObjectURI, true) as LDto
}
}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/SystemInformation.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/SystemInformation.java
index 7a74c7d..3a6c7c6 100644
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/SystemInformation.java
+++ b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/SystemInformation.java
@@ -13,18 +13,22 @@
package org.eclipse.osbp.utils.common;
public class SystemInformation {
-
- private static String OS = System.getProperty("os.name").toLowerCase();
+
+ private static String operatingSystem = System.getProperty("os.name").toLowerCase();
+
+ private SystemInformation() {
+ }
public static boolean isWindowsOS() {
- return (OS.indexOf("win") >= 0);
+ return operatingSystem.indexOf("win") >= 0;
}
public static boolean isMacOS() {
- return (OS.indexOf("mac") >= 0);
+ return operatingSystem.indexOf("mac") >= 0;
}
public static boolean isUnixOS() {
- return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
+ return operatingSystem.indexOf("nix") >= 0 || operatingSystem.indexOf("nux") >= 0
+ || operatingSystem.indexOf("aix") >= 0;
}
} \ No newline at end of file
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend
index 37257c6..7c8491c 100644
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend
+++ b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend
@@ -12,41 +12,46 @@
*
*
* This copyright notice shows up in the generated Java code
- *
+ *
*/
-
+
package org.eclipse.osbp.utils.entityhelper
import com.google.inject.Inject
import java.util.Date
import org.eclipse.emf.ecore.resource.ResourceSet
+import org.eclipse.osbp.dsl.entity.xtext.extensions.ModelExtensions
import org.eclipse.osbp.dsl.semantic.common.types.LDataType
+import org.eclipse.osbp.dsl.semantic.common.types.LEnum
+import org.eclipse.osbp.dsl.semantic.common.types.LPackage
import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute
import org.eclipse.osbp.ecview.dsl.extensions.TypeHelper
+import org.eclipse.osbp.ui.api.datamart.IDataMart.EType
import org.eclipse.xtext.common.types.JvmEnumerationType
import org.eclipse.xtext.common.types.JvmType
import org.eclipse.xtext.common.types.access.IJvmTypeProvider
-import org.eclipse.osbp.ui.api.datamart.IDataMart.EType
public class DataType {
-
- @Inject
- @Extension
- private TypeHelper typeHelper;
-
- @Inject
- IJvmTypeProvider.Factory typeProviderFactory
-
- def public LDataType getLDataType(LEntityAttribute attributeRef) {
- var type = attributeRef.type
- var lDataType = null as LDataType
- if (type instanceof LDataType) {
- lDataType = type as LDataType
- }
- return lDataType
- }
-
- def public JvmType getJvmType(LEntityAttribute attributeRef) {
+
+ @Inject
+ @Extension
+ private TypeHelper typeHelper;
+
+ @Inject ModelExtensions entityExtensions
+
+ @Inject
+ IJvmTypeProvider.Factory typeProviderFactory
+
+ def public LDataType getLDataType(LEntityAttribute attributeRef) {
+ var type = attributeRef.type
+ var lDataType = null as LDataType
+ if (type instanceof LDataType) {
+ lDataType = type as LDataType
+ }
+ return lDataType
+ }
+
+ def public JvmType getJvmType(LEntityAttribute attributeRef) {
var type = attributeRef.type
var lDataType = null as LDataType
var ltype = null as JvmType
@@ -61,12 +66,16 @@ public class DataType {
} else {
var jvmTypeReference = lDataType.jvmTypeReference
ltype = jvmTypeReference.type
- if (ltype != null) {
+ if (ltype !== null) {
return ltype;
}
}
+ } else if (type instanceof LEnum) {
+ var LPackage pkg = type.eContainer as LPackage
+ val typeProvider = getTypeProvider(attributeRef.eResource.resourceSet)
+ return typeProvider.findTypeByName(pkg.name + "." + type.name)
}
- var typeJvm = attributeRef.typeJvm
+ var typeJvm = entityExtensions.toTypeReference(attributeRef)
var typeJvmType = typeJvm.type
return typeJvmType
}
@@ -75,102 +84,113 @@ public class DataType {
typeProviderFactory.findOrCreateTypeProvider(rs)
}
- def public EType getBasicType(String typeIdentifier) {
- if (typeIdentifier != null){
- var identifier = typeIdentifier
- if (typeIdentifier.startsWith("java.lang.")) {
- identifier = typeIdentifier.substring("java.lang.".length).toLowerCase
- }
- switch (identifier) {
- /**
- * Date, String, int, boolean, Time
- */
- case "boolean": return EType.BOOLEAN
- case "byte": return EType.BYTE
- case "short": return EType.SHORT
- case "int": return EType.INTEGER
- case "integer": return EType.INTEGER
- case "long": return EType.LONG
- case "double": return EType.DOUBLE
- case "float": return EType.FLOAT
- case "BigDecimal": return EType.DOUBLE
- case "java.math.BigDecimal": return EType.DOUBLE
- case "string": return EType.STRING
- case "java.util.Date": return EType.DATE
- }
- }
- return EType.none
- }
-
-
- def public EType getBasicType(JvmType type) {
- if (type.boolean) {
- return EType.BOOLEAN
+ def public EType getBasicType(String typeIdentifier) {
+ if (typeIdentifier !== null) {
+ var identifier = typeIdentifier
+ if (typeIdentifier.startsWith("java.lang.")) {
+ identifier = typeIdentifier.substring("java.lang.".length).toLowerCase
+ }
+ switch (identifier) {
+ /**
+ * Date, String, int, boolean, Time
+ */
+ case "boolean": return EType.BOOLEAN
+ case "byte": return EType.BYTE
+ case "short": return EType.SHORT
+ case "int": return EType.INTEGER
+ case "integer": return EType.INTEGER
+ case "long": return EType.LONG
+ case "double": return EType.DOUBLE
+ case "float": return EType.FLOAT
+ case "BigDecimal": return EType.DOUBLE
+ case "java.math.BigDecimal": return EType.DOUBLE
+ case "string": return EType.STRING
+ case "java.util.Date": return EType.DATE
+ }
}
- else if (type.numberWithDigits) {
+ return EType.NONE
+ }
+
+ def public EType getBasicType(JvmType type) {
+ if (type.boolean) {
+ return EType.BOOLEAN
+ } else if (type.numberWithDigits) {
val retcode = getBasicType(type.identifier)
- if (retcode != EType.none) {
+ if (retcode !== EType.NONE) {
return retcode
}
return EType.DOUBLE
- }
- else if (type.numberWithoutDigits) {
+ } else if (type.numberWithoutDigits) {
val retcode = getBasicType(type.identifier)
- if (retcode != EType.none) {
+ if (retcode !== EType.NONE) {
return retcode
}
return EType.INTEGER
- }
- else if (type.string) {
+ } else if (type.string) {
return EType.STRING
- }
- else if (type.date) {
+ } else if (type.date) {
return EType.DATE
- }
- else if (type instanceof JvmEnumerationType) {
- return EType.LENUM;
- }
- return getBasicType(type.identifier)
- }
+ } else if (type instanceof JvmEnumerationType) {
+ return EType.LENUM;
+ }
+ return getBasicType(type.identifier)
+ }
- def public EType getBasicType(LEntityAttribute attribute) {
- var lDataType = getLDataType(attribute)
- if (lDataType != null) {
- if (lDataType.date) {
- return EType.DATE
- }
- if ("blobMapping".equals(lDataType.name)) {
- return EType.BLOPMAPPING
- }
- }
- return getBasicType(getJvmType(attribute))
- }
+ def public EType getBasicType(LEntityAttribute attribute) {
+ var lDataType = getLDataType(attribute)
+ if (lDataType !== null) {
+ if (lDataType.date) {
+ return EType.DATE
+ }
+ // data type is defined as Blob
+ if (!lDataType.properties.isNullOrEmpty) {
+ if (lDataType.properties.exists[it.key.toLowerCase.equals("blob")]){
+ return EType.BLOPMAPPING
+ }
+ }
+ // Otherwise entity attribute is defined as Blob
+ if (!attribute.properties.isNullOrEmpty) {
+ if (lDataType.properties.exists[it.key.toLowerCase.equals("blob")]){
+ return EType.BLOPMAPPING
+ }
+ }
+ if ("blobMapping".equalsIgnoreCase(lDataType.name)) {
+ return EType.BLOPMAPPING
+ }
+
+ }
+ return getBasicType(getJvmType(attribute))
+ }
+
+ def public EType getBasicType(Class<?> typeClass) {
+ return getBasicType(typeClass.canonicalName)
+ }
- def public EType getBasicType(Class<?> typeClass) {
- return getBasicType(typeClass.canonicalName)
- }
+ def public boolean canBeCastFrom(LEntityAttribute targetAttribute, Class<?> sourceClass) {
+ return canBeCastFrom(targetAttribute, getBasicType(sourceClass))
+ }
- def public boolean canBeCastFrom(LEntityAttribute targetAttribute, Class<?> sourceClass) {
- return canBeCastFrom(targetAttribute, getBasicType(sourceClass))
- }
+ def public boolean canBeCastFrom(LEntityAttribute targetAttribute, EType sourceType) {
+ var targetType = getBasicType(targetAttribute)
- def public boolean canBeCastFrom(LEntityAttribute targetAttribute, EType sourceType) {
- var targetType = getBasicType(targetAttribute)
-
- switch (targetType) {
- case BOOLEAN: return (sourceType == EType.BOOLEAN)
- case BYTE: return (sourceType == EType.BYTE)
- case DATE: return (sourceType == EType.DATE)
- case FLOAT: return (sourceType == EType.FLOAT || sourceType == EType.LONG || sourceType == EType.INTEGER || sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
- case DOUBLE: return (sourceType == EType.FLOAT || sourceType == EType.DOUBLE || sourceType == EType.LONG || sourceType == EType.INTEGER || sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
- case SHORT: return (sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
- case INTEGER: return (sourceType == EType.INTEGER || sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
- case LONG: return (sourceType == EType.LONG || sourceType == EType.INTEGER || sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
- case STRING: return true
- case TIME: return (sourceType == EType.TIME)
- case LENUM: return (sourceType == EType.INTEGER || sourceType == EType.BOOLEAN)
- case none: return false
- }
- return false
- }
+ switch (targetType) {
+ case BOOLEAN: return (sourceType == EType.BOOLEAN)
+ case BYTE: return (sourceType == EType.BYTE)
+ case DATE: return (sourceType == EType.DATE)
+ case FLOAT: return (sourceType == EType.FLOAT || sourceType == EType.LONG || sourceType == EType.INTEGER ||
+ sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
+ case DOUBLE: return (sourceType == EType.FLOAT || sourceType == EType.DOUBLE || sourceType == EType.LONG ||
+ sourceType == EType.INTEGER || sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
+ case SHORT: return (sourceType == EType.SHORT || sourceType == EType.BOOLEAN)
+ case INTEGER: return (sourceType == EType.INTEGER || sourceType == EType.SHORT ||
+ sourceType == EType.BOOLEAN)
+ case LONG: return (sourceType == EType.LONG || sourceType == EType.INTEGER || sourceType == EType.SHORT ||
+ sourceType == EType.BOOLEAN)
+ case STRING: return true
+ case TIME: return (sourceType == EType.TIME)
+ case LENUM: return (sourceType == EType.INTEGER || sourceType == EType.BOOLEAN)
+ case NONE: return false
+ }
+ return false
+ }
}
diff --git a/org.eclipse.osbp.utils/xtend-gen/.gitignore b/org.eclipse.osbp.utils/xtend-gen/.gitignore
new file mode 100644
index 0000000..2dee463
--- /dev/null
+++ b/org.eclipse.osbp.utils/xtend-gen/.gitignore
@@ -0,0 +1,6 @@
+/.CommonUtils.xtendbin
+/.DataType.xtendbin
+/.EntityUtils.xtendbin
+/.GeneratorConstants.xtendbin
+/.GenericFormatter.xtendbin
+/.PathConstants.xtendbin
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/annotation/CommonUtils.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/annotation/CommonUtils.java
index f0ee58b..e2582b3 100644
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/annotation/CommonUtils.java
+++ b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/annotation/CommonUtils.java
@@ -113,8 +113,7 @@ public class CommonUtils {
op.setSimpleName(name);
value.setOperation(op);
final JvmEnumerationLiteral literal = this.typesFactory.createJvmEnumerationLiteral();
- String _name = enumxx.name();
- literal.setSimpleName(_name);
+ literal.setSimpleName(enumxx.name());
EList<JvmEnumerationLiteral> _values = value.getValues();
_values.add(literal);
}
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java
index 19920b1..c745a54 100644
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java
+++ b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java
@@ -14,11 +14,7 @@
*/
package org.eclipse.osbp.utils.common;
-import com.google.common.base.Objects;
-import java.util.Iterator;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.osbp.dsl.semantic.common.types.LEnum;
import org.eclipse.osbp.dsl.semantic.common.types.LType;
@@ -32,7 +28,6 @@ import org.eclipse.osbp.dsl.semantic.entity.OSBPEntityPackage;
import org.eclipse.osbp.utils.common.ServiceListener;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.common.types.JvmType;
-import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.xbase.lib.Exceptions;
@@ -41,19 +36,41 @@ public class EntityUtils {
public static String getQualifiedDtoNameForEntity(final JvmType type) {
try {
String qualifiedEntityName = type.getQualifiedName();
- Resource _eResource = type.eResource();
- ResourceSet resourceSet = _eResource.getResourceSet();
+ ResourceSet resourceSet = type.eResource().getResourceSet();
String searchName = EntityUtils.getQualifiedDtoNameForQualifiedEntityName(qualifiedEntityName);
final Iterable<IEObjectDescription> objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, searchName);
- Iterator<IEObjectDescription> _iterator = objectDescs.iterator();
- boolean _hasNext = _iterator.hasNext();
+ boolean _hasNext = objectDescs.iterator().hasNext();
if (_hasNext) {
- Iterator<IEObjectDescription> _iterator_1 = objectDescs.iterator();
- final IEObjectDescription eobjectDesc = _iterator_1.next();
- boolean _notEquals = (!Objects.equal(resourceSet, null));
- if (_notEquals) {
- QualifiedName _name = eobjectDesc.getName();
- return _name.toString();
+ final IEObjectDescription eobjectDesc = objectDescs.iterator().next();
+ if ((resourceSet != null)) {
+ return eobjectDesc.getName().toString();
+ }
+ }
+ } catch (final Throwable _t) {
+ if (_t instanceof Exception) {
+ final Exception e = (Exception)_t;
+ e.printStackTrace();
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ return null;
+ }
+
+ public static LDto getDtoForEntity(final JvmType type) {
+ return EntityUtils.getDtoForEntity(type.getQualifiedName(), type.eResource().getResourceSet());
+ }
+
+ public static LDto getDtoForEntity(final String qualifiedEntityName, final ResourceSet resourceSet) {
+ try {
+ String searchName = EntityUtils.getQualifiedDtoNameForQualifiedEntityName(qualifiedEntityName);
+ final Iterable<IEObjectDescription> objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, searchName);
+ boolean _hasNext = objectDescs.iterator().hasNext();
+ if (_hasNext) {
+ final IEObjectDescription eobjectDesc = objectDescs.iterator().next();
+ if ((resourceSet != null)) {
+ EObject _eObject = resourceSet.getEObject(eobjectDesc.getEObjectURI(), true);
+ return ((LDto) _eObject);
}
}
} catch (final Throwable _t) {
@@ -74,16 +91,15 @@ public class EntityUtils {
*/
public static String getDtoFQNForLEnum(final LEnum lenum) {
EObject container = ((EObject) lenum);
- while (((!Objects.equal(container, null)) && (!(container instanceof LTypedPackage)))) {
- EObject _eContainer = container.eContainer();
- container = _eContainer;
+ while (((container != null) && (!(container instanceof LTypedPackage)))) {
+ container = container.eContainer();
}
StringConcatenation _builder = new StringConcatenation();
String _name = ((LTypedPackage) container).getName();
- _builder.append(_name, "");
+ _builder.append(_name);
_builder.append(".");
String _name_1 = lenum.getName();
- _builder.append(_name_1, "");
+ _builder.append(_name_1);
return EntityUtils.applyDtoPackageNameFromEntityPackageNameForEnum(_builder.toString());
}
@@ -93,8 +109,7 @@ public class EntityUtils {
* <b>The DTO for an LBean <u>always</u> ends with the postfix <code>Dto</code>!</b>
*/
public static String getDtoFQNForLBean(final LBean bean) {
- String _fQNForLBean = EntityUtils.getFQNForLBean(bean);
- return EntityUtils.getQualifiedDtoNameForQualifiedEntityName(_fQNForLBean);
+ return EntityUtils.getQualifiedDtoNameForQualifiedEntityName(EntityUtils.getFQNForLBean(bean));
}
/**
@@ -103,8 +118,7 @@ public class EntityUtils {
* <b>The DTO for an LEntity <u>always</u> ends with the postfix <code>Dto</code>!</b>
*/
public static String getDtoFQNForLEntity(final LEntity entity) {
- String _fQNForLEntity = EntityUtils.getFQNForLEntity(entity);
- return EntityUtils.getQualifiedDtoNameForQualifiedEntityName(_fQNForLEntity);
+ return EntityUtils.getQualifiedDtoNameForQualifiedEntityName(EntityUtils.getFQNForLEntity(entity));
}
/**
@@ -114,10 +128,10 @@ public class EntityUtils {
StringConcatenation _builder = new StringConcatenation();
EObject _eContainer = entity.eContainer();
String _name = ((LTypedPackage) _eContainer).getName();
- _builder.append(_name, "");
+ _builder.append(_name);
_builder.append(".");
String _name_1 = entity.getName();
- _builder.append(_name_1, "");
+ _builder.append(_name_1);
return _builder.toString();
}
@@ -128,15 +142,15 @@ public class EntityUtils {
StringConcatenation _builder = new StringConcatenation();
EObject _eContainer = bean.eContainer();
String _name = ((LTypedPackage) _eContainer).getName();
- _builder.append(_name, "");
+ _builder.append(_name);
_builder.append(".");
String _name_1 = bean.getName();
- _builder.append(_name_1, "");
+ _builder.append(_name_1);
return _builder.toString();
}
/**
- * get the full qualified dto name for a LEntity!
+ * get the full qualified dto name for a full qualified entity name!
* <br>
* <b>The DTO for an LEntity <u>always</u> ends with the postfix <code>Dto</code>!</b>
*/
@@ -144,6 +158,15 @@ public class EntityUtils {
return NamingConventionsUtil.toDtoQualifiedName(qualifiedEntityName);
}
+ /**
+ * get the full qualified dto name for a full qualified entity name!
+ * <br>
+ * <b>The DTO for an LEntity <u>always</u> ends with the postfix <code>Dto</code>!</b>
+ */
+ public static String getQualifiedEntityNameForQualifiedDtoName(final String qualifiedDtoName) {
+ return NamingConventionsUtil.toFqnEntityName(qualifiedDtoName);
+ }
+
private final static String DTOS_PACKAGE_TOKEN = ".dtos.";
/**
@@ -172,50 +195,30 @@ public class EntityUtils {
LEntity entity = null;
try {
String qualifiedDtoName = type.getQualifiedName();
- Resource _eResource = type.eResource();
- ResourceSet resourceSet = _eResource.getResourceSet();
+ ResourceSet resourceSet = type.eResource().getResourceSet();
final Iterable<IEObjectDescription> objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, qualifiedDtoName);
- Iterator<IEObjectDescription> _iterator = objectDescs.iterator();
- boolean _hasNext = _iterator.hasNext();
+ boolean _hasNext = objectDescs.iterator().hasNext();
if (_hasNext) {
- Iterator<IEObjectDescription> _iterator_1 = objectDescs.iterator();
- final IEObjectDescription eobjectDesc = _iterator_1.next();
- boolean _notEquals = (!Objects.equal(resourceSet, null));
- if (_notEquals) {
- URI _eObjectURI = eobjectDesc.getEObjectURI();
- EObject _eObject = resourceSet.getEObject(_eObjectURI, true);
+ final IEObjectDescription eobjectDesc = objectDescs.iterator().next();
+ if ((resourceSet != null)) {
+ EObject _eObject = resourceSet.getEObject(eobjectDesc.getEObjectURI(), true);
LDto dto = ((LDto) _eObject);
- boolean _and = false;
- boolean _notEquals_1 = (!Objects.equal(dto, null));
- if (!_notEquals_1) {
- _and = false;
- } else {
- LType _wrappedType = dto.getWrappedType();
- boolean _notEquals_2 = (!Objects.equal(_wrappedType, null));
- _and = _notEquals_2;
- }
- if (_and) {
- LType _wrappedType_1 = dto.getWrappedType();
- boolean _eIsProxy = _wrappedType_1.eIsProxy();
+ if (((dto != null) && (dto.getWrappedType() != null))) {
+ boolean _eIsProxy = dto.getWrappedType().eIsProxy();
if (_eIsProxy) {
- String _replace = qualifiedDtoName.replace(".dtos.", ".entities.");
- String _replace_1 = _replace.replace("Dto", "");
- final Iterable<IEObjectDescription> entityDescs = ServiceListener.getEObjectDescriptions(OSBPEntityPackage.Literals.LENTITY, _replace_1);
- Iterator<IEObjectDescription> _iterator_2 = entityDescs.iterator();
- boolean _hasNext_1 = _iterator_2.hasNext();
+ final Iterable<IEObjectDescription> entityDescs = ServiceListener.getEObjectDescriptions(OSBPEntityPackage.Literals.LENTITY,
+ qualifiedDtoName.replace(".dtos.", ".entities.").replace("Dto", ""));
+ boolean _hasNext_1 = entityDescs.iterator().hasNext();
if (_hasNext_1) {
- Iterator<IEObjectDescription> _iterator_3 = entityDescs.iterator();
- final IEObjectDescription entityObjectDesc = _iterator_3.next();
- boolean _notEquals_3 = (!Objects.equal(resourceSet, null));
- if (_notEquals_3) {
- URI _eObjectURI_1 = entityObjectDesc.getEObjectURI();
- EObject _eObject_1 = resourceSet.getEObject(_eObjectURI_1, true);
+ final IEObjectDescription entityObjectDesc = entityDescs.iterator().next();
+ if ((resourceSet != null)) {
+ EObject _eObject_1 = resourceSet.getEObject(entityObjectDesc.getEObjectURI(), true);
entity = ((LEntity) _eObject_1);
}
}
} else {
- LType _wrappedType_2 = dto.getWrappedType();
- entity = ((LEntity) _wrappedType_2);
+ LType _wrappedType = dto.getWrappedType();
+ entity = ((LEntity) _wrappedType);
}
}
}
@@ -232,23 +235,13 @@ public class EntityUtils {
public static LEntity getEntityFromDto(final LDto dto) {
LEntity entity = null;
- boolean _and = false;
- boolean _notEquals = (!Objects.equal(dto, null));
- if (!_notEquals) {
- _and = false;
- } else {
- LType _wrappedType = dto.getWrappedType();
- boolean _notEquals_1 = (!Objects.equal(_wrappedType, null));
- _and = _notEquals_1;
- }
- if (_and) {
- LType _wrappedType_1 = dto.getWrappedType();
- boolean _eIsProxy = _wrappedType_1.eIsProxy();
+ if (((dto != null) && (dto.getWrappedType() != null))) {
+ boolean _eIsProxy = dto.getWrappedType().eIsProxy();
if (_eIsProxy) {
throw new IllegalStateException();
} else {
- LType _wrappedType_2 = dto.getWrappedType();
- entity = ((LEntity) _wrappedType_2);
+ LType _wrappedType = dto.getWrappedType();
+ entity = ((LEntity) _wrappedType);
}
}
return entity;
@@ -257,18 +250,13 @@ public class EntityUtils {
public static LDto getDto(final JvmType type) {
try {
String qualifiedDtoName = type.getQualifiedName();
- Resource _eResource = type.eResource();
- ResourceSet resourceSet = _eResource.getResourceSet();
+ ResourceSet resourceSet = type.eResource().getResourceSet();
final Iterable<IEObjectDescription> objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, qualifiedDtoName);
- Iterator<IEObjectDescription> _iterator = objectDescs.iterator();
- boolean _hasNext = _iterator.hasNext();
+ boolean _hasNext = objectDescs.iterator().hasNext();
if (_hasNext) {
- Iterator<IEObjectDescription> _iterator_1 = objectDescs.iterator();
- final IEObjectDescription eobjectDesc = _iterator_1.next();
- boolean _notEquals = (!Objects.equal(resourceSet, null));
- if (_notEquals) {
- URI _eObjectURI = eobjectDesc.getEObjectURI();
- EObject _eObject = resourceSet.getEObject(_eObjectURI, true);
+ final IEObjectDescription eobjectDesc = objectDescs.iterator().next();
+ if ((resourceSet != null)) {
+ EObject _eObject = resourceSet.getEObject(eobjectDesc.getEObjectURI(), true);
return ((LDto) _eObject);
}
}
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java
index 06dfb50..661f0c0 100644
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java
+++ b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java
@@ -17,9 +17,13 @@ package org.eclipse.osbp.utils.entityhelper;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import java.util.Date;
-import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.osbp.dsl.entity.xtext.extensions.ModelExtensions;
import org.eclipse.osbp.dsl.semantic.common.types.LDataType;
+import org.eclipse.osbp.dsl.semantic.common.types.LEnum;
+import org.eclipse.osbp.dsl.semantic.common.types.LKeyAndValue;
+import org.eclipse.osbp.dsl.semantic.common.types.LPackage;
import org.eclipse.osbp.dsl.semantic.common.types.LScalarType;
import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute;
import org.eclipse.osbp.ecview.dsl.extensions.TypeHelper;
@@ -29,6 +33,8 @@ import org.eclipse.xtext.common.types.JvmType;
import org.eclipse.xtext.common.types.JvmTypeReference;
import org.eclipse.xtext.common.types.access.IJvmTypeProvider;
import org.eclipse.xtext.xbase.lib.Extension;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
@SuppressWarnings("all")
public class DataType {
@@ -37,6 +43,9 @@ public class DataType {
private TypeHelper typeHelper;
@Inject
+ private ModelExtensions entityExtensions;
+
+ @Inject
private IJvmTypeProvider.Factory typeProviderFactory;
public LDataType getLDataType(final LEntityAttribute attributeRef) {
@@ -56,30 +65,34 @@ public class DataType {
lDataType = ((LDataType) type);
boolean _isDate = lDataType.isDate();
if (_isDate) {
- Resource _eResource = attributeRef.eResource();
- ResourceSet _resourceSet = _eResource.getResourceSet();
- final IJvmTypeProvider typeProvider = this.getTypeProvider(_resourceSet);
- String _name = Date.class.getName();
- return typeProvider.findTypeByName(_name);
+ final IJvmTypeProvider typeProvider = this.getTypeProvider(attributeRef.eResource().getResourceSet());
+ return typeProvider.findTypeByName(Date.class.getName());
} else {
boolean _isAsBlob = lDataType.isAsBlob();
if (_isAsBlob) {
- Resource _eResource_1 = attributeRef.eResource();
- ResourceSet _resourceSet_1 = _eResource_1.getResourceSet();
- final IJvmTypeProvider typeProvider_1 = this.getTypeProvider(_resourceSet_1);
+ final IJvmTypeProvider typeProvider_1 = this.getTypeProvider(attributeRef.eResource().getResourceSet());
return typeProvider_1.findTypeByName("byte[]");
} else {
JvmTypeReference jvmTypeReference = lDataType.getJvmTypeReference();
- JvmType _type = jvmTypeReference.getType();
- ltype = _type;
- boolean _notEquals = (!Objects.equal(ltype, null));
- if (_notEquals) {
+ ltype = jvmTypeReference.getType();
+ if ((ltype != null)) {
return ltype;
}
}
}
+ } else {
+ if ((type instanceof LEnum)) {
+ EObject _eContainer = ((LEnum)type).eContainer();
+ LPackage pkg = ((LPackage) _eContainer);
+ final IJvmTypeProvider typeProvider_2 = this.getTypeProvider(attributeRef.eResource().getResourceSet());
+ String _name = pkg.getName();
+ String _plus = (_name + ".");
+ String _name_1 = ((LEnum)type).getName();
+ String _plus_1 = (_plus + _name_1);
+ return typeProvider_2.findTypeByName(_plus_1);
+ }
}
- JvmTypeReference typeJvm = attributeRef.getTypeJvm();
+ JvmTypeReference typeJvm = this.entityExtensions.toTypeReference(attributeRef);
JvmType typeJvmType = typeJvm.getType();
return typeJvmType;
}
@@ -89,91 +102,42 @@ public class DataType {
}
public IDataMart.EType getBasicType(final String typeIdentifier) {
- boolean _notEquals = (!Objects.equal(typeIdentifier, null));
- if (_notEquals) {
+ if ((typeIdentifier != null)) {
String identifier = typeIdentifier;
boolean _startsWith = typeIdentifier.startsWith("java.lang.");
if (_startsWith) {
- int _length = "java.lang.".length();
- String _substring = typeIdentifier.substring(_length);
- String _lowerCase = _substring.toLowerCase();
- identifier = _lowerCase;
+ identifier = typeIdentifier.substring("java.lang.".length()).toLowerCase();
}
- boolean _matched = false;
- if (!_matched) {
- if (Objects.equal(identifier, "boolean")) {
- _matched=true;
- return IDataMart.EType.BOOLEAN;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "byte")) {
- _matched=true;
- return IDataMart.EType.BYTE;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "short")) {
- _matched=true;
- return IDataMart.EType.SHORT;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "int")) {
- _matched=true;
- return IDataMart.EType.INTEGER;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "integer")) {
- _matched=true;
- return IDataMart.EType.INTEGER;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "long")) {
- _matched=true;
- return IDataMart.EType.LONG;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "double")) {
- _matched=true;
- return IDataMart.EType.DOUBLE;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "float")) {
- _matched=true;
- return IDataMart.EType.FLOAT;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "BigDecimal")) {
- _matched=true;
- return IDataMart.EType.DOUBLE;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "java.math.BigDecimal")) {
- _matched=true;
- return IDataMart.EType.DOUBLE;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "string")) {
- _matched=true;
- return IDataMart.EType.STRING;
- }
- }
- if (!_matched) {
- if (Objects.equal(identifier, "java.util.Date")) {
- _matched=true;
- return IDataMart.EType.DATE;
+ if (identifier != null) {
+ switch (identifier) {
+ case "boolean":
+ return IDataMart.EType.BOOLEAN;
+ case "byte":
+ return IDataMart.EType.BYTE;
+ case "short":
+ return IDataMart.EType.SHORT;
+ case "int":
+ return IDataMart.EType.INTEGER;
+ case "integer":
+ return IDataMart.EType.INTEGER;
+ case "long":
+ return IDataMart.EType.LONG;
+ case "double":
+ return IDataMart.EType.DOUBLE;
+ case "float":
+ return IDataMart.EType.FLOAT;
+ case "BigDecimal":
+ return IDataMart.EType.DOUBLE;
+ case "java.math.BigDecimal":
+ return IDataMart.EType.DOUBLE;
+ case "string":
+ return IDataMart.EType.STRING;
+ case "java.util.Date":
+ return IDataMart.EType.DATE;
}
}
}
- return IDataMart.EType.none;
+ return IDataMart.EType.NONE;
}
public IDataMart.EType getBasicType(final JvmType type) {
@@ -183,20 +147,16 @@ public class DataType {
} else {
boolean _isNumberWithDigits = this.typeHelper.isNumberWithDigits(type);
if (_isNumberWithDigits) {
- String _identifier = type.getIdentifier();
- final IDataMart.EType retcode = this.getBasicType(_identifier);
- boolean _notEquals = (!Objects.equal(retcode, IDataMart.EType.none));
- if (_notEquals) {
+ final IDataMart.EType retcode = this.getBasicType(type.getIdentifier());
+ if ((retcode != IDataMart.EType.NONE)) {
return retcode;
}
return IDataMart.EType.DOUBLE;
} else {
boolean _isNumberWithoutDigits = this.typeHelper.isNumberWithoutDigits(type);
if (_isNumberWithoutDigits) {
- String _identifier_1 = type.getIdentifier();
- final IDataMart.EType retcode_1 = this.getBasicType(_identifier_1);
- boolean _notEquals_1 = (!Objects.equal(retcode_1, IDataMart.EType.none));
- if (_notEquals_1) {
+ final IDataMart.EType retcode_1 = this.getBasicType(type.getIdentifier());
+ if ((retcode_1 != IDataMart.EType.NONE)) {
return retcode_1;
}
return IDataMart.EType.INTEGER;
@@ -217,36 +177,52 @@ public class DataType {
}
}
}
- String _identifier_2 = type.getIdentifier();
- return this.getBasicType(_identifier_2);
+ return this.getBasicType(type.getIdentifier());
}
public IDataMart.EType getBasicType(final LEntityAttribute attribute) {
LDataType lDataType = this.getLDataType(attribute);
- boolean _notEquals = (!Objects.equal(lDataType, null));
- if (_notEquals) {
+ if ((lDataType != null)) {
boolean _isDate = lDataType.isDate();
if (_isDate) {
return IDataMart.EType.DATE;
}
- String _name = lDataType.getName();
- boolean _equals = "blobMapping".equals(_name);
- if (_equals) {
+ boolean _isNullOrEmpty = IterableExtensions.isNullOrEmpty(lDataType.getProperties());
+ boolean _not = (!_isNullOrEmpty);
+ if (_not) {
+ final Function1<LKeyAndValue, Boolean> _function = (LKeyAndValue it) -> {
+ return Boolean.valueOf(it.getKey().toLowerCase().equals("blob"));
+ };
+ boolean _exists = IterableExtensions.<LKeyAndValue>exists(lDataType.getProperties(), _function);
+ if (_exists) {
+ return IDataMart.EType.BLOPMAPPING;
+ }
+ }
+ boolean _isNullOrEmpty_1 = IterableExtensions.isNullOrEmpty(attribute.getProperties());
+ boolean _not_1 = (!_isNullOrEmpty_1);
+ if (_not_1) {
+ final Function1<LKeyAndValue, Boolean> _function_1 = (LKeyAndValue it) -> {
+ return Boolean.valueOf(it.getKey().toLowerCase().equals("blob"));
+ };
+ boolean _exists_1 = IterableExtensions.<LKeyAndValue>exists(lDataType.getProperties(), _function_1);
+ if (_exists_1) {
+ return IDataMart.EType.BLOPMAPPING;
+ }
+ }
+ boolean _equalsIgnoreCase = "blobMapping".equalsIgnoreCase(lDataType.getName());
+ if (_equalsIgnoreCase) {
return IDataMart.EType.BLOPMAPPING;
}
}
- JvmType _jvmType = this.getJvmType(attribute);
- return this.getBasicType(_jvmType);
+ return this.getBasicType(this.getJvmType(attribute));
}
public IDataMart.EType getBasicType(final Class<?> typeClass) {
- String _canonicalName = typeClass.getCanonicalName();
- return this.getBasicType(_canonicalName);
+ return this.getBasicType(typeClass.getCanonicalName());
}
public boolean canBeCastFrom(final LEntityAttribute targetAttribute, final Class<?> sourceClass) {
- IDataMart.EType _basicType = this.getBasicType(sourceClass);
- return this.canBeCastFrom(targetAttribute, _basicType);
+ return this.canBeCastFrom(targetAttribute, this.getBasicType(sourceClass));
}
public boolean canBeCastFrom(final LEntityAttribute targetAttribute, final IDataMart.EType sourceType) {
@@ -260,140 +236,26 @@ public class DataType {
case DATE:
return Objects.equal(sourceType, IDataMart.EType.DATE);
case FLOAT:
- boolean _or = false;
- boolean _or_1 = false;
- boolean _or_2 = false;
- boolean _or_3 = false;
- boolean _equals = Objects.equal(sourceType, IDataMart.EType.FLOAT);
- if (_equals) {
- _or_3 = true;
- } else {
- boolean _equals_1 = Objects.equal(sourceType, IDataMart.EType.LONG);
- _or_3 = _equals_1;
- }
- if (_or_3) {
- _or_2 = true;
- } else {
- boolean _equals_2 = Objects.equal(sourceType, IDataMart.EType.INTEGER);
- _or_2 = _equals_2;
- }
- if (_or_2) {
- _or_1 = true;
- } else {
- boolean _equals_3 = Objects.equal(sourceType, IDataMart.EType.SHORT);
- _or_1 = _equals_3;
- }
- if (_or_1) {
- _or = true;
- } else {
- boolean _equals_4 = Objects.equal(sourceType, IDataMart.EType.BOOLEAN);
- _or = _equals_4;
- }
- return _or;
+ return ((((Objects.equal(sourceType, IDataMart.EType.FLOAT) || Objects.equal(sourceType, IDataMart.EType.LONG)) || Objects.equal(sourceType, IDataMart.EType.INTEGER)) ||
+ Objects.equal(sourceType, IDataMart.EType.SHORT)) || Objects.equal(sourceType, IDataMart.EType.BOOLEAN));
case DOUBLE:
- boolean _or_4 = false;
- boolean _or_5 = false;
- boolean _or_6 = false;
- boolean _or_7 = false;
- boolean _or_8 = false;
- boolean _equals_5 = Objects.equal(sourceType, IDataMart.EType.FLOAT);
- if (_equals_5) {
- _or_8 = true;
- } else {
- boolean _equals_6 = Objects.equal(sourceType, IDataMart.EType.DOUBLE);
- _or_8 = _equals_6;
- }
- if (_or_8) {
- _or_7 = true;
- } else {
- boolean _equals_7 = Objects.equal(sourceType, IDataMart.EType.LONG);
- _or_7 = _equals_7;
- }
- if (_or_7) {
- _or_6 = true;
- } else {
- boolean _equals_8 = Objects.equal(sourceType, IDataMart.EType.INTEGER);
- _or_6 = _equals_8;
- }
- if (_or_6) {
- _or_5 = true;
- } else {
- boolean _equals_9 = Objects.equal(sourceType, IDataMart.EType.SHORT);
- _or_5 = _equals_9;
- }
- if (_or_5) {
- _or_4 = true;
- } else {
- boolean _equals_10 = Objects.equal(sourceType, IDataMart.EType.BOOLEAN);
- _or_4 = _equals_10;
- }
- return _or_4;
+ return (((((Objects.equal(sourceType, IDataMart.EType.FLOAT) || Objects.equal(sourceType, IDataMart.EType.DOUBLE)) || Objects.equal(sourceType, IDataMart.EType.LONG)) ||
+ Objects.equal(sourceType, IDataMart.EType.INTEGER)) || Objects.equal(sourceType, IDataMart.EType.SHORT)) || Objects.equal(sourceType, IDataMart.EType.BOOLEAN));
case SHORT:
- boolean _or_9 = false;
- boolean _equals_11 = Objects.equal(sourceType, IDataMart.EType.SHORT);
- if (_equals_11) {
- _or_9 = true;
- } else {
- boolean _equals_12 = Objects.equal(sourceType, IDataMart.EType.BOOLEAN);
- _or_9 = _equals_12;
- }
- return _or_9;
+ return (Objects.equal(sourceType, IDataMart.EType.SHORT) || Objects.equal(sourceType, IDataMart.EType.BOOLEAN));
case INTEGER:
- boolean _or_10 = false;
- boolean _or_11 = false;
- boolean _equals_13 = Objects.equal(sourceType, IDataMart.EType.INTEGER);
- if (_equals_13) {
- _or_11 = true;
- } else {
- boolean _equals_14 = Objects.equal(sourceType, IDataMart.EType.SHORT);
- _or_11 = _equals_14;
- }
- if (_or_11) {
- _or_10 = true;
- } else {
- boolean _equals_15 = Objects.equal(sourceType, IDataMart.EType.BOOLEAN);
- _or_10 = _equals_15;
- }
- return _or_10;
+ return ((Objects.equal(sourceType, IDataMart.EType.INTEGER) || Objects.equal(sourceType, IDataMart.EType.SHORT)) ||
+ Objects.equal(sourceType, IDataMart.EType.BOOLEAN));
case LONG:
- boolean _or_12 = false;
- boolean _or_13 = false;
- boolean _or_14 = false;
- boolean _equals_16 = Objects.equal(sourceType, IDataMart.EType.LONG);
- if (_equals_16) {
- _or_14 = true;
- } else {
- boolean _equals_17 = Objects.equal(sourceType, IDataMart.EType.INTEGER);
- _or_14 = _equals_17;
- }
- if (_or_14) {
- _or_13 = true;
- } else {
- boolean _equals_18 = Objects.equal(sourceType, IDataMart.EType.SHORT);
- _or_13 = _equals_18;
- }
- if (_or_13) {
- _or_12 = true;
- } else {
- boolean _equals_19 = Objects.equal(sourceType, IDataMart.EType.BOOLEAN);
- _or_12 = _equals_19;
- }
- return _or_12;
+ return (((Objects.equal(sourceType, IDataMart.EType.LONG) || Objects.equal(sourceType, IDataMart.EType.INTEGER)) || Objects.equal(sourceType, IDataMart.EType.SHORT)) ||
+ Objects.equal(sourceType, IDataMart.EType.BOOLEAN));
case STRING:
return true;
case TIME:
return Objects.equal(sourceType, IDataMart.EType.TIME);
case LENUM:
- boolean _or_15 = false;
- boolean _equals_20 = Objects.equal(sourceType, IDataMart.EType.INTEGER);
- if (_equals_20) {
- _or_15 = true;
- } else {
- boolean _equals_21 = Objects.equal(sourceType, IDataMart.EType.BOOLEAN);
- _or_15 = _equals_21;
- }
- return _or_15;
- case none:
+ return (Objects.equal(sourceType, IDataMart.EType.INTEGER) || Objects.equal(sourceType, IDataMart.EType.BOOLEAN));
+ case NONE:
return false;
default:
break;

Back to the top