/* * 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 31.10.2018 08:16:46 using System; using System.Collections.Generic; using com.itac.oib.monitoring.contracts.data; namespace com.itac.oib.monitoring.contracts.data { // source: assembly 5.1.0.84 // 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 asmStation) { if (asmStation == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station itacStation = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station(); mapItac2Asm(itacStation, asmStation); return itacStation; } public static void mapItac2Asm(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station itacStation, Station asmStation) { 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; // complex property MachineType, isArray:False, isGeneric:False itacStation.MachineType = com.itac.oib.monitoring.contracts.data.MachineTypeMapper.get( asmStation.MachineType); } // maps iTAC namespace conform array to ASM namespace array public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station[] get(Station[] asmStation) { if (asmStation == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station[] itacStation = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Station[asmStation.Length]; for (int i = 0; i < asmStation.Length; i++) { // to itac array itacStation[i] = StationMapper.get(asmStation[i]); } return itacStation; } // 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; itacStation.MachineType = com.itac.oib.monitoring.contracts.data.MachineTypeMapper.get(asmStation.MachineType); // complex asm property MachineType } // 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; } } }