/* * Copyright (c) 2018 iTAC Software AG, Germany. All Rights Reserved. * * This software is protected by copyright. Under no circumstances may any part of this file in any form be copied, * printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language * without the written permission of iTAC Software AG. */ // created 23.11.2018 08:09:33 using System; using System.Collections.Generic; namespace com.itac.oib.monitoring.contracts.data { // source: assembly 3.2.0.152 // source: assembly ASM.AS.OIB.Monitoring.Proxy public class StationMapper { // used for itac->asm: True // used for asm->itac: True // maps iTAC namespace conform type to ASM namespace type public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station get(Station itacStation) { if (itacStation == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station asmStation = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station(); mapItac2Asm(asmStation, itacStation); return asmStation; } public static void mapItac2Asm(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station asmStation, Station itacStation) { asmStation.LineName = itacStation.LineName; asmStation.LineFullPath = itacStation.LineFullPath; asmStation.Name = itacStation.Name; asmStation.FullPath = itacStation.FullPath; asmStation.ProcessingAreaCount = itacStation.ProcessingAreaCount; asmStation.Text = itacStation.Text; asmStation.ComputerAddress = itacStation.ComputerAddress; asmStation.MachineId = itacStation.MachineId; asmStation.SoftwareVersion = itacStation.SoftwareVersion; asmStation.TypeName = itacStation.TypeName; } // maps iTAC namespace conform array to ASM namespace array public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station[] get(Station[] itacStation) { if (itacStation == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station[] asmStation = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station[itacStation.Length]; for (int i = 0; i < itacStation.Length; i++) { // to itac array asmStation[i] = StationMapper.get(itacStation[i]); } return asmStation; } // maps iTAC namespace conform array to ASM namespace list public static List getList(Station[] asmStation) { if (asmStation == null) { return null; } List itacStation = new List(); for (int i = 0; i < asmStation.Length; i++) { itacStation.Add(StationMapper.get(asmStation[i])); } return itacStation; } // map type from ASM namespace to iTAC namespace public static Station get(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station asmStation) { if (asmStation == null) { return null; } Station itacStation = new Station(); mapAsm2Itac(asmStation, itacStation); return itacStation; } public static void mapAsm2Itac(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station asmStation, Station itacStation) { itacStation.LineName = asmStation.LineName; itacStation.LineFullPath = asmStation.LineFullPath; itacStation.Name = asmStation.Name; itacStation.FullPath = asmStation.FullPath; itacStation.ProcessingAreaCount = asmStation.ProcessingAreaCount; itacStation.Text = asmStation.Text; itacStation.ComputerAddress = asmStation.ComputerAddress; itacStation.MachineId = asmStation.MachineId; itacStation.SoftwareVersion = asmStation.SoftwareVersion; itacStation.TypeName = asmStation.TypeName; } // maps ASM namespace conform list to iTAC namespace array public static Station[] getArray(IList asmStation) { if (asmStation == null) { return null; } Station[] itacStation = new Station[asmStation.Count]; for (int i = 0; i < asmStation.Count; i++) { itacStation[i] = StationMapper.get(asmStation[i]); } return itacStation; } // maps ASM namespace conform array to iTAC namespace array public static Station[] getArray(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station[] asmStation) { if (asmStation == null) { return null; } Station[] itacStation = new Station[asmStation.Length]; for (int i = 0; i < asmStation.Length; i++) { itacStation[i] = StationMapper.get(asmStation[i]); } return itacStation; } } }