Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend')
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend41
1 files changed, 31 insertions, 10 deletions
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 f0286f9..80b5444 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
@@ -3,9 +3,11 @@
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
+ * are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
@@ -32,12 +34,14 @@ import org.eclipse.xtext.common.types.JvmType
import org.eclipse.xtext.common.types.access.IJvmTypeProvider
import org.eclipse.osbp.dsl.semantic.common.types.LAttribute
import org.eclipse.xtext.common.types.JvmTypeReference
+import org.eclipse.osbp.dsl.semantic.common.types.LDateType
+import org.eclipse.osbp.runtime.common.layouting.IPropertyConstants
public class DataType {
@Inject
@Extension
- private TypeHelper typeHelper;
+ TypeHelper typeHelper
@Inject ModelExtensions entityExtensions
@@ -148,25 +152,41 @@ public class DataType {
var lDataType = getLDataType(attribute)
if (lDataType !== null) {
if (lDataType.date) {
- return EType.DATE
+ if (lDataType.dateType.equals(LDateType.TIMESTAMP)){
+ return EType.TIMESTAMP
+ } else if (lDataType.dateType.equals(LDateType.DATE)){
+ return EType.DATE
+ } else {
+ return EType.DATE
+ }
}
- // data type is defined as Blob
if (!lDataType.properties.isNullOrEmpty) {
- if (lDataType.properties.exists[it.key.toLowerCase.equals("blob")]){
+ // data type is defined as Blob
+ if (getJvmType(attribute).string && lDataType.properties.exists[it.key.toLowerCase.equals(IPropertyConstants.PROPERTY_BLOB)]){
return EType.BLOPMAPPING
}
- if (lDataType.properties.exists[it.value.toLowerCase.equals("richtextarea")]){
+ // data type is defined as rich text area
+ if (getJvmType(attribute).string && lDataType.properties.exists[it.value.toLowerCase.equals(IPropertyConstants.PROPERTY_RICH_TEXT)]){
return EType.RICHTEXTAREA
}
+ // data type is defined as checkbox
+ if (getJvmType(attribute).boolean && lDataType.properties.exists[it.value.toLowerCase.equals(IPropertyConstants.PROPERTY_CHECKBOX)]){
+ return EType.BOOLEAN_CHECKBOX
+ }
}
- // Otherwise entity attribute is defined as Blob
if (!attribute.properties.isNullOrEmpty) {
- if (attribute.properties.exists[it.key.toLowerCase.equals("blob")]){
+ // Otherwise entity attribute is defined as Blob
+ if (getJvmType(attribute).string && attribute.properties.exists[it.key.toLowerCase.equals(IPropertyConstants.PROPERTY_BLOB)]){
return EType.BLOPMAPPING
}
- if (attribute.properties.exists[it.value.toLowerCase.equals("richtextarea")]){
+ // Otherwise entity attribute is defined as rich text area
+ if (getJvmType(attribute).string && attribute.properties.exists[it.value.toLowerCase.equals(IPropertyConstants.PROPERTY_RICH_TEXT)]){
return EType.RICHTEXTAREA
}
+ // data type is defined as rich text area
+ if (getJvmType(attribute).boolean && lDataType.properties.exists[it.value.toLowerCase.equals(IPropertyConstants.PROPERTY_CHECKBOX)]){
+ return EType.BOOLEAN_CHECKBOX
+ }
}
if ("blobMapping".equalsIgnoreCase(lDataType.name)) {
return EType.BLOPMAPPING
@@ -191,6 +211,7 @@ public class DataType {
case BOOLEAN: return (sourceType == EType.BOOLEAN)
case BYTE: return (sourceType == EType.BYTE)
case DATE: return (sourceType == EType.DATE)
+ case TIMESTAMP: return (sourceType == EType.TIMESTAMP)
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 ||

Back to the top