| /** |
| * ******************************************************************************* |
| * Copyright (c) 2019 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| * ******************************************************************************* |
| */ |
| |
| package templates.m2m.event |
| |
| import com.google.inject.Inject |
| import com.google.inject.Singleton |
| import com.inchron.realtime.root.model.TraceEventType |
| import org.eclipse.app4mc.amalthea.model.Event |
| import org.eclipse.app4mc.amalthea.model.ProcessEvent |
| import org.eclipse.app4mc.amalthea.model.ProcessEventType |
| import org.eclipse.app4mc.amalthea.model.RunnableEvent |
| import org.eclipse.app4mc.amalthea.model.RunnableEventType |
| import templates.AbstractAmaltheaInchronTransformer |
| import templates.m2m.sw.RunnableTransformer |
| import templates.utils.AmltCacheModel |
| |
| @Singleton |
| class AbstractEventTransformer extends AbstractAmaltheaInchronTransformer { |
| |
| @Inject RunnableTransformer runnableTransformer |
| |
| def dispatch createTraceEvent(Event event){ |
| logger.warn("AbstractEventTransformer: event " + event.description + " not supported in chronSIM transformation") |
| } |
| |
| def dispatch create inchronModelFactory.createTraceEvent createTraceEvent(ProcessEvent event){ |
| it.name = event.name; |
| switch (event.eventType){ |
| case ProcessEventType.ACTIVATE: it.type = TraceEventType.ACTIVATE |
| case ProcessEventType.TERMINATE: it.type = TraceEventType.TERMINATE |
| default:{} |
| } |
| |
| val AmltCacheModel cacheModel = customObjsStore.getInstance(AmltCacheModel) |
| val com.inchron.realtime.root.model.Process csProcess = cacheModel.amltProcess_inchronProcessMap.get(event.entity as org.eclipse.app4mc.amalthea.model.Process) |
| csProcess.traceEvents.add(it) |
| } |
| |
| |
| def dispatch create inchronModelFactory.createTraceEvent createTraceEvent(RunnableEvent event){ |
| it.name = event.name; |
| switch (event.eventType){ |
| case RunnableEventType.START: it.type = TraceEventType.START |
| case RunnableEventType.TERMINATE: it.type = TraceEventType.TERMINATE |
| default: {} |
| } |
| val AmltCacheModel cacheModel = customObjsStore.getInstance(AmltCacheModel) |
| val csFunction = runnableTransformer.createFunction(cacheModel.getInchronComponent(event.process), event.process, event.entity) |
| csFunction.traceEvents.add(it) |
| } |
| |
| |
| |
| } |