/* * 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 HeadMapper { // 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.Head get(Head itacHead) { if (itacHead == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head asmHead = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head(); mapItac2Asm(asmHead, itacHead); return asmHead; } public static void mapItac2Asm(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head asmHead, Head itacHead) { asmHead.HeadNumber = itacHead.HeadNumber; asmHead.GantryNumber = itacHead.GantryNumber; asmHead.HeadType = itacHead.HeadType; asmHead.Bypassed = itacHead.Bypassed; } // maps iTAC namespace conform array to ASM namespace array public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head[] get(Head[] itacHead) { if (itacHead == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head[] asmHead = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head[itacHead.Length]; for (int i = 0; i < itacHead.Length; i++) { // to itac array asmHead[i] = HeadMapper.get(itacHead[i]); } return asmHead; } // maps iTAC namespace conform array to ASM namespace list public static List getList(Head[] asmHead) { if (asmHead == null) { return null; } List itacHead = new List(); for (int i = 0; i < asmHead.Length; i++) { itacHead.Add(HeadMapper.get(asmHead[i])); } return itacHead; } // map type from ASM namespace to iTAC namespace public static Head get(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head asmHead) { if (asmHead == null) { return null; } Head itacHead = new Head(); mapAsm2Itac(asmHead, itacHead); return itacHead; } public static void mapAsm2Itac(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head asmHead, Head itacHead) { itacHead.HeadNumber = asmHead.HeadNumber; itacHead.GantryNumber = asmHead.GantryNumber; itacHead.HeadType = asmHead.HeadType; itacHead.Bypassed = asmHead.Bypassed; } // maps ASM namespace conform list to iTAC namespace array public static Head[] getArray(IList asmHead) { if (asmHead == null) { return null; } Head[] itacHead = new Head[asmHead.Count]; for (int i = 0; i < asmHead.Count; i++) { itacHead[i] = HeadMapper.get(asmHead[i]); } return itacHead; } // maps ASM namespace conform array to iTAC namespace array public static Head[] getArray(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head[] asmHead) { if (asmHead == null) { return null; } Head[] itacHead = new Head[asmHead.Length]; for (int i = 0; i < asmHead.Length; i++) { itacHead[i] = HeadMapper.get(asmHead[i]); } return itacHead; } } }