Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Mollik2019-01-30 07:39:30 -0500
committerRalf Mollik2019-01-30 07:39:30 -0500
commit3841512d5c5b3033fb63ec624cc958a1cc9ec05c (patch)
treeac9c165534192da7067871937e1ae9b6fc0e67d0
parent1dc60d2d356001d5c6cc682350f73d76362f4211 (diff)
downloadorg.eclipse.osbp.xtext.datainterchange-3841512d5c5b3033fb63ec624cc958a1cc9ec05c.tar.gz
org.eclipse.osbp.xtext.datainterchange-3841512d5c5b3033fb63ec624cc958a1cc9ec05c.tar.xz
org.eclipse.osbp.xtext.datainterchange-3841512d5c5b3033fb63ec624cc958a1cc9ec05c.zip
catch up with branch daily
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
-rw-r--r--org.eclipse.osbp.xtext.datainterchange/emf-gen/org/eclipse/osbp/xtext/datainterchange/DataDSLPackage.java2
-rw-r--r--org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLJvmModelInferrer.xtend24
-rw-r--r--org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLModelGenerator.xtend28
3 files changed, 30 insertions, 24 deletions
diff --git a/org.eclipse.osbp.xtext.datainterchange/emf-gen/org/eclipse/osbp/xtext/datainterchange/DataDSLPackage.java b/org.eclipse.osbp.xtext.datainterchange/emf-gen/org/eclipse/osbp/xtext/datainterchange/DataDSLPackage.java
index 0cb969c..621fc83 100644
--- a/org.eclipse.osbp.xtext.datainterchange/emf-gen/org/eclipse/osbp/xtext/datainterchange/DataDSLPackage.java
+++ b/org.eclipse.osbp.xtext.datainterchange/emf-gen/org/eclipse/osbp/xtext/datainterchange/DataDSLPackage.java
@@ -39,7 +39,7 @@ import org.eclipse.osbp.dsl.semantic.common.types.OSBPTypesPackage;
* <!-- end-user-doc -->
* @see org.eclipse.osbp.xtext.datainterchange.DataDSLFactory
* @model kind="package"
- * annotation="http://www.eclipse.org/emf/2002/GenModel fileExtensions='data' modelName='DataDSL' prefix='DataDSL' updateClasspath='false' loadInitialization='false' literalsInterface='true' copyrightText='Copyright (c) 2014, Loetz GmbH&Co.KG (Heidelberg)\n All rights reserved. This program and the accompanying materials \n are made available under the terms of the Eclipse Public License 2.0 \n which accompanies this distribution, and is available at \n https://www.eclipse.org/legal/epl-2.0/ \n \n SPDX-License-Identifier: EPL-2.0 \n\n Based on ideas from Xtext, Xtend, Xcore\n \n Contributors: \n \t\tJoerg Riegel - Initial implementation \n ' basePackage='org.eclipse.osbp.xtext'"
+ * annotation="http://www.eclipse.org/emf/2002/GenModel fileExtensions='data' modelName='DataDSL' prefix='DataDSL' updateClasspath='false' loadInitialization='false' literalsInterface='true' copyrightText='Copyright (c) 2014, Loetz GmbH&Co.KG (Heidelberg)\r\n All rights reserved. This program and the accompanying materials \r\n are made available under the terms of the Eclipse Public License 2.0 \r\n which accompanies this distribution, and is available at \r\n https://www.eclipse.org/legal/epl-2.0/ \r\n \r\n SPDX-License-Identifier: EPL-2.0 \r\n\r\n Based on ideas from Xtext, Xtend, Xcore\r\n \r\n Contributors: \r\n \t\tJoerg Riegel - Initial implementation \r\n ' basePackage='org.eclipse.osbp.xtext'"
* annotation="http://www.eclipse.org/emf/2002/Ecore rootPackage='datadsl'"
* @generated
*/
diff --git a/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLJvmModelInferrer.xtend b/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLJvmModelInferrer.xtend
index e66fadc..a55cec4 100644
--- a/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLJvmModelInferrer.xtend
+++ b/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLJvmModelInferrer.xtend
@@ -253,6 +253,7 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
annotations += _annotationTypesBuilder.annotationRef(PostConstruct)
body = [append(
'''
+ super.initView();
user.addUserLocaleListener(this);
eventDispatcher.addEventReceiver(this);''')]
@@ -265,7 +266,8 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
body = [append(
'''
user.removeUserLocaleListener(this);
- eventDispatcher.removeEventReceiver(this);''')]
+ eventDispatcher.removeEventReceiver(this);
+ super.destroyView();''')]
])
// focus
type.members += group.toMethod("setFocus", _typeReferenceBuilder.typeRef(Void::TYPE), [
@@ -458,7 +460,7 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
@Override
public void buttonClick(ClickEvent event) {
log.debug("pressed «dataInterchange.name» import");
- «dataInterchange.getConfigFileURL»
+ «getConfigFileURL((dataInterchange.eContainer as DataInterchangeGroup).name)»
«dataInterchange.getBasicRunConfiguration(false, WorkerThreadRunnable.Direction.IMPORT.name, null)»
«dataInterchange.defaultVariableName».setName(UUID.randomUUID().toString());
«dataInterchange.defaultVariableName».setEventDispatcher(eventDispatcher);
@@ -485,7 +487,7 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
@Override
public void buttonClick(ClickEvent event) {
log.debug("pressed «dataInterchange.name» export");
- «dataInterchange.getConfigFileURL»
+ «getConfigFileURL((dataInterchange.eContainer as DataInterchangeGroup).name)»
«dataInterchange.getBasicRunConfiguration(false, WorkerThreadRunnable.Direction.EXPORT.name, null)»
«dataInterchange.defaultVariableName».setName(UUID.randomUUID().toString());
«dataInterchange.defaultVariableName».setEventDispatcher(eventDispatcher);
@@ -529,7 +531,7 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
'''
«className» «dataInterchange.getDefaultVariableName» = new «className»();
«if(baseInterchange === null || (baseInterchange !== null && direction.equals(Direction.EXPORT.name))){
- dataInterchange.getConfigFileURL
+ getConfigFileURL((dataInterchange.eContainer as DataInterchangeGroup).name)
dataInterchange.getConfigFileURLA(URL, direction)
«dataInterchange.getDefaultVariableName».setPersistenceService(persistenceService);
@@ -542,18 +544,18 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
'''
}
- def String getConfigFileURL(DataInterchange dataInterchange){
+ def String getConfigFileURL(String groupname){
return
'''
String url = ProductConfiguration.getDatainterchangeConfiguration();
if(url == null || url.isEmpty()) {
- url = System.getProperty("user.home")+"/.osbee/"+"«(dataInterchange.eContainer as DataInterchangeGroup).name»Config.xml";
+ url = System.getProperty("user.home")+"/.osbee/"+"«groupname»Config.xml";
}
if(!url.endsWith(".xml") ) {
if(!(url.endsWith("/") || url.endsWith("\\")) ) {
url = url+File.separator;
}
- url = url+"«(dataInterchange.eContainer as DataInterchangeGroup).name»Config.xml";
+ url = url+"«groupname»Config.xml";
}
'''
}
@@ -578,7 +580,6 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
log.error("{}", sw.toString());
- return;
}
} else {
«dataInterchange.getDefaultVariableName».setFileURL("«fileURL»");
@@ -647,6 +648,10 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
parameters += dataInterchange.toParameter("direction", _typeReferenceBuilder.typeRef(WorkerThreadRunnable.Direction))
body = [ append('''«dataInterchange.init»''')]
])
+ type.members += dataInterchange.toMethod("getExportPath", _typeReferenceBuilder.typeRef(Path), [
+ visibility = JvmVisibility.PUBLIC
+ body = [ append(''' return exportPath;''')]
+ ])
}
/**
@@ -675,7 +680,6 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
if (log.isDebugEnabled()) log.debug("initializing datainterchange factory");
// get entity manager
if (log.isDebugEnabled()) log.debug("opening entity manager to persist results");
- getPersistenceService().registerPersistenceUnit("«firstEntity.entity.persistenceUnit»", «firstEntity.entity.fullyQualifiedName».class);
em = getPersistenceService().getEntityManagerFactory("«firstEntity.entity.persistenceUnit»").createEntityManager();
if(dataInterchange != null) {
dataInterchange.open(FrameworkUtil.getBundle(getClass()),"«DSLOutputConfigurationProvider.SMOOKS_OUTPUT_DIRECTORY»/«dataInterchange.name»-"+direction.toString().toLowerCase()+".xml");
@@ -905,8 +909,8 @@ class DataDSLJvmModelInferrer extends AbstractModelInferrer {
e.printStackTrace(new PrintWriter(sw));
log.error(getDirection().name()+" Execution of «dataInterchange.name»: failed due to: {}", sw.toString());
setExecutionFailed(true);
- Path filePath = Paths.get(getFileURL().getPath().substring(1));
«IF dataInterchange.isDeleteFileAfterImport»
+ Path filePath = Paths.get(getFileURL().getPath().substring(1));
if(Files.exists(filePath) && getDirection()==WorkerThreadRunnable.Direction.IMPORT) {
renameFile(filePath, "FAILEDIMPORT"+ getFormatter().format(new Date(System.currentTimeMillis())) + filePath.getFileName().toString()+ ".LOCKED");
}
diff --git a/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLModelGenerator.xtend b/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLModelGenerator.xtend
index ed986de..04f21a0 100644
--- a/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLModelGenerator.xtend
+++ b/org.eclipse.osbp.xtext.datainterchange/src/org/eclipse/osbp/xtext/datainterchange/jvmmodel/DataDSLModelGenerator.xtend
@@ -559,25 +559,27 @@ class DataDSLModelGenerator extends I18NModelGenerator {
}
}
}
- // do the references
- for(li:lookupInterchanges){
- for(lup:li.lookup){
- for(f:fieldList) {
- if(f instanceof LEntityReference && f.name.equals(lup.dataMap)){
- //add reference only if they are specified by lookup
- if(!fldList.contains(lup.dataMap)){
+ } else {
+ for(f:fieldList) {
+ if(f instanceof LEntityAttribute || f instanceof LBeanAttribute){
+ for(mi:mappingInterchanges){
+ for(mapping:mi.mappings){
+ if(!(mapping instanceof DataInterchangeBlobMapping) && mapping.property.equals(f)) {
+ fldList.add(mapping.data)
+ }
+ }
+ }
+ }else if(f instanceof LEntityReference && lookupInterchanges.length > 0){
+ //add reference only if they are specified by lookup
+ for(li:lookupInterchanges){
+ for(lup:li.lookup){
+ if(!fldList.contains(lup.dataMap) && f.name.equals(lup.dataMap)){
fldList.add(f.toName)
}
}
}
}
}
- } else {
- for(mi:mappingInterchanges){
- for(mapping:mi.mappings){
- fldList.add(mapping.data)
- }
- }
}
fields.textContent = fldList.join(",")

Back to the top