/* * 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; namespace com.itac.oib.monitoring.contracts.data { // source: assembly 5.1.0.84 // 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 asmHead) { if (asmHead == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head itacHead = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head(); mapItac2Asm(itacHead, asmHead); return itacHead; } public static void mapItac2Asm(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head itacHead, Head asmHead) { itacHead.HeadNumber = asmHead.HeadNumber; itacHead.GantryNumber = asmHead.GantryNumber; itacHead.HeadType = asmHead.HeadType; itacHead.Bypassed = asmHead.Bypassed; } // maps iTAC namespace conform array to ASM namespace array public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head[] get(Head[] asmHead) { if (asmHead == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head[] itacHead = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Head[asmHead.Length]; for (int i = 0; i < asmHead.Length; i++) { // to itac array itacHead[i] = HeadMapper.get(asmHead[i]); } return itacHead; } // 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; } } }