added ModelTransformer class

Signed-off-by: Sebastian Reiser <Sebastian.Reiser@de.bosch.com>
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/ModelTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/ModelTransformer.xtend
new file mode 100644
index 0000000..32e97d5
--- /dev/null
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/ModelTransformer.xtend
@@ -0,0 +1,87 @@
+package templates.m2m
+
+import templates.AbstractAmaltheaInchronTransformer
+import com.inchron.realtime.root.model.ModelFactory
+import org.eclipse.app4mc.amalthea.model.Amalthea
+import com.inchron.realtime.root.model.Model
+import java.text.SimpleDateFormat
+import java.text.DateFormat
+import java.util.Date
+import java.util.Locale
+import org.eclipse.app4mc.amalthea.model.StringObject
+import com.google.inject.Inject
+import templates.m2m.hw.HWTransformer
+import templates.m2m.os.OSTransformer
+import templates.m2m.mapping.MappingTransformer
+import templates.m2m.stimuli.StimuliTransformer
+import templates.m2m.sw.SWTransformer
+import com.google.inject.Singleton
+
+@Singleton
+class ModelTransformer  extends AbstractAmaltheaInchronTransformer{
+	
+	@Inject extension HWTransformer hwTransformer
+
+	@Inject extension OSTransformer osTransformer
+
+	@Inject extension MappingTransformer mappingTransformer
+
+	@Inject extension StimuliTransformer stimuliTransformer
+
+	@Inject extension SWTransformer swTransformer
+	
+	
+		/**
+	 * This method creates the object of INCHRON Model element, and fills it by invoking various transformations
+	 */
+	def create ModelFactory.eINSTANCE.createModel createInchronModel(Amalthea amalthea) {
+		customObjsStore.injectMembers(Amalthea , amalthea)
+		customObjsStore.injectMembers(Model , it)
+
+		transformMetaInfo(amalthea, it)
+
+		it.name = "Model"
+
+		hwTransformer.transfromHWModel(amalthea.hwModel, it)
+
+		osTransformer.transfromOSModel(amalthea.osModel, it)
+
+		mappingTransformer.transfromMappingModel(amalthea.mappingModel, it)
+
+		stimuliTransformer.transformStimuliModel(amalthea.stimuliModel, it)
+
+		swTransformer.transformSWModel(amalthea.swModel, it)
+	}
+
+	/**
+	 * Create and fill the INCHRON model's GeneralInfo with meta information,
+	 * mainly from the Amalthea customProperties map.
+	 * @Note: customProperties keys used here are currently informal/not specified. 
+	 */
+	def transformMetaInfo(Amalthea amalthea, Model inchronModel) {
+
+		var DateFormat dateFormat = new SimpleDateFormat("dd.MMMM.yyyy", Locale.ENGLISH)
+
+		var info = ModelFactory.eINSTANCE.createGeneralInfo()
+		info.setCreator(("Amlt2Inchron " + amalthea.getVersion() + " " + new Date()).toString())
+		info.setVersion("1")
+
+		val value = amalthea.getCustomProperties().get("Date_Last_Modified")
+		if (value instanceof StringObject) {
+			val date = (value as StringObject).getValue()
+			if (date !== null)
+				info.setModifiedDate(dateFormat.parse(date))
+		}
+
+		val author = amalthea.getCustomProperties().get("Author")
+		if (author instanceof StringObject)
+			info.setAuthor((author as StringObject).getValue())
+
+		val descr = amalthea.getCustomProperties().get("Description")
+		if (descr instanceof StringObject)
+			info.setDescription((descr as StringObject).getValue())
+
+		inchronModel.setGeneralInfo(info)
+	}
+	
+}