/* * 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:02:34 // skip property ExtensionDataObject, declared in Panel using System; using System.Collections.Generic; namespace com.itac.oib.traceability.contracts.data { // source: assembly 2.3.0.2 // source: assembly ASM.AS.OIB.Client public class PanelMapper { // used for itac->asm: True // used for asm->itac: True // maps iTAC namespace conform type to ASM namespace type public static www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel get(Panel itacPanel) { if (itacPanel == null) { return null; } www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel asmPanel = new www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel(); mapItac2Asm(asmPanel, itacPanel); return asmPanel; } public static void mapItac2Asm(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel asmPanel, Panel itacPanel) { // skip property ExtensionDataObject, declared in Panel asmPanel.Omit = itacPanel.Omit; // complex property Packagings, isArray:True, isGeneric:False asmPanel.Packagings = com.itac.oib.traceability.contracts.data.PanelPackagingMapper.get( itacPanel.Packagings); asmPanel.PanelID = itacPanel.PanelID; asmPanel.PanelName = itacPanel.PanelName; } // maps iTAC namespace conform array to ASM namespace array public static www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel[] get(Panel[] itacPanel) { if (itacPanel == null) { return null; } www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel[] asmPanel = new www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel[itacPanel.Length]; for (int i = 0; i < itacPanel.Length; i++) { // to itac array asmPanel[i] = PanelMapper.get(itacPanel[i]); } return asmPanel; } // maps iTAC namespace conform array to ASM namespace list public static List getList(Panel[] asmPanel) { if (asmPanel == null) { return null; } List itacPanel = new List(); for (int i = 0; i < asmPanel.Length; i++) { itacPanel.Add(PanelMapper.get(asmPanel[i])); } return itacPanel; } // map type from ASM namespace to iTAC namespace public static Panel get(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel asmPanel) { if (asmPanel == null) { return null; } Panel itacPanel = new Panel(); mapAsm2Itac(asmPanel, itacPanel); return itacPanel; } public static void mapAsm2Itac(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel asmPanel, Panel itacPanel) { // skip property ExtensionDataObject, declared in Panel itacPanel.Omit = asmPanel.Omit; // array mapping itacPanel.Packagings = PanelPackagingMapper.getArray(asmPanel.Packagings); // complex asm property Packagings itacPanel.PanelID = asmPanel.PanelID; itacPanel.PanelName = asmPanel.PanelName; } // maps ASM namespace conform list to iTAC namespace array public static Panel[] getArray(IList asmPanel) { if (asmPanel == null) { return null; } Panel[] itacPanel = new Panel[asmPanel.Count]; for (int i = 0; i < asmPanel.Count; i++) { itacPanel[i] = PanelMapper.get(asmPanel[i]); } return itacPanel; } // maps ASM namespace conform array to iTAC namespace array public static Panel[] getArray(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Panel[] asmPanel) { if (asmPanel == null) { return null; } Panel[] itacPanel = new Panel[asmPanel.Length]; for (int i = 0; i < asmPanel.Length; i++) { itacPanel[i] = PanelMapper.get(asmPanel[i]); } return itacPanel; } } }