catch up with branch daily

Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
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 @@
  * <!-- 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 @@
 				annotations += _annotationTypesBuilder.annotationRef(PostConstruct)
 				body = [append(
 				'''
+				super.initView();
 				user.addUserLocaleListener(this);
 				eventDispatcher.addEventReceiver(this);''')]
 				
@@ -265,7 +266,8 @@
 				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 @@
 				@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 @@
 				@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 @@
         '''
 		«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 @@
         '''
     }
     
-    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 @@
 				StringWriter sw = new StringWriter();
 				e.printStackTrace(new PrintWriter(sw));
 				log.error("{}", sw.toString());
-				return;
 			}
 		} else {
 			«dataInterchange.getDefaultVariableName».setFileURL("«fileURL»");
@@ -647,6 +648,10 @@
    			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 @@
 			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 @@
 			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 @@
 					}
 				}
 			}
-			// 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(",")