| /** |
| * ******************************************************************************* |
| * 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.utils |
| |
| import com.inchron.realtime.root.model.FrequencyUnit |
| import org.eclipse.app4mc.amalthea.model.Frequency |
| import templates.AbstractAmaltheaInchronTransformer |
| import com.google.inject.Singleton |
| |
| @Singleton |
| class FrequencyTransformer extends AbstractAmaltheaInchronTransformer { |
| |
| def create inchronModelFactory.createFrequency createFrequency(Frequency amltFrequency) { |
| |
| it.value = if(amltFrequency !== null) amltFrequency.value.floatValue else 0 |
| |
| it.unit = FrequencyUnit.getByName(amltFrequency?.unit.getName) |
| } |
| |
| } |