/* * 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 02.11.2018 11:01:17 using System; using System.Collections.Generic; namespace com.itac.oib.linecontrol.contracts.data { // source: assembly 5.1.0.84 // source: assembly ASM.AS.OIB.SIPLACEPro.LineControl.Contracts public class MissingComponentsMapper { // used for itac->asm: True // used for asm->itac: True // maps iTAC namespace conform type to ASM namespace type public static Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents get(MissingComponents asmMissingComponents) { if (asmMissingComponents == null) { return null; } Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents itacMissingComponents = new Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents(); mapItac2Asm(itacMissingComponents, asmMissingComponents); return itacMissingComponents; } public static void mapItac2Asm(Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents itacMissingComponents, MissingComponents asmMissingComponents) { // skip readonly property MissingComponentsTotalCount // complex property ComponentsNotKnownAtAll, isArray:False, isGeneric:True // map Dictionary itacMissingComponents.ComponentsNotKnownAtAll = getDictionary(asmMissingComponents.ComponentsNotKnownAtAll); // complex property ComponentsSetUpOnWrongTable, isArray:False, isGeneric:True // map Dictionary itacMissingComponents.ComponentsSetUpOnWrongTable = getDictionary(asmMissingComponents.ComponentsSetUpOnWrongTable); // complex property ComponentsKnownButNotSetUp, isArray:False, isGeneric:True // map Dictionary itacMissingComponents.ComponentsKnownButNotSetUp = getDictionary(asmMissingComponents.ComponentsKnownButNotSetUp); } // maps iTAC namespace conform array to ASM namespace array public static Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents[] get(MissingComponents[] asmMissingComponents) { if (asmMissingComponents == null) { return null; } Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents[] itacMissingComponents = new Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents[asmMissingComponents.Length]; for (int i = 0; i < asmMissingComponents.Length; i++) { // to itac array itacMissingComponents[i] = MissingComponentsMapper.get(asmMissingComponents[i]); } return itacMissingComponents; } // maps iTAC namespace conform array to ASM namespace list public static List getList(MissingComponents[] asmMissingComponents) { if (asmMissingComponents == null) { return null; } List itacMissingComponents = new List(); for (int i = 0; i < asmMissingComponents.Length; i++) { itacMissingComponents.Add(MissingComponentsMapper.get(asmMissingComponents[i])); } return itacMissingComponents; } // map type from ASM namespace to iTAC namespace public static MissingComponents get(Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents asmMissingComponents) { if (asmMissingComponents == null) { return null; } MissingComponents itacMissingComponents = new MissingComponents(); mapAsm2Itac(asmMissingComponents, itacMissingComponents); return itacMissingComponents; } public static void mapAsm2Itac(Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents asmMissingComponents, MissingComponents itacMissingComponents) { itacMissingComponents.MissingComponentsTotalCount = asmMissingComponents.MissingComponentsTotalCount; // assign Dictionary(): maps ASM Dictionary 2 iTAC dictionary itacMissingComponents.ComponentsNotKnownAtAll = getComponentsNotKnownAtAllDictionary( asmMissingComponents.ComponentsNotKnownAtAll); // assign Dictionary(): maps ASM Dictionary 2 iTAC dictionary itacMissingComponents.ComponentsSetUpOnWrongTable = getComponentsSetUpOnWrongTableDictionary( asmMissingComponents.ComponentsSetUpOnWrongTable); // assign Dictionary(): maps ASM Dictionary 2 iTAC dictionary itacMissingComponents.ComponentsKnownButNotSetUp = getComponentsKnownButNotSetUpDictionary( asmMissingComponents.ComponentsKnownButNotSetUp); } // maps ASM namespace conform list to iTAC namespace array public static MissingComponents[] getArray(IList asmMissingComponents) { if (asmMissingComponents == null) { return null; } MissingComponents[] itacMissingComponents = new MissingComponents[asmMissingComponents.Count]; for (int i = 0; i < asmMissingComponents.Count; i++) { itacMissingComponents[i] = MissingComponentsMapper.get(asmMissingComponents[i]); } return itacMissingComponents; } // maps ASM namespace conform array to iTAC namespace array public static MissingComponents[] getArray(Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.MissingComponents[] asmMissingComponents) { if (asmMissingComponents == null) { return null; } MissingComponents[] itacMissingComponents = new MissingComponents[asmMissingComponents.Length]; for (int i = 0; i < asmMissingComponents.Length; i++) { itacMissingComponents[i] = MissingComponentsMapper.get(asmMissingComponents[i]); } return itacMissingComponents; } // maps c# dictionary with ASM types to c# dictionary with java types public static Dictionary getDictionary(Dictionary dictionary) { Dictionary result = new Dictionary(); foreach (String key in dictionary.Keys) { result.Add(key, ComponentNotKnownAtAllMapper.get(dictionary[key])); } return result; } // maps c# dictionary with ASM types to c# dictionary with java types public static Dictionary getDictionary(Dictionary dictionary) { Dictionary result = new Dictionary(); foreach (String key in dictionary.Keys) { result.Add(key, ComponentSetUpOnWrongTableMapper.get(dictionary[key])); } return result; } // maps c# dictionary with ASM types to c# dictionary with java types public static Dictionary getDictionary(Dictionary dictionary) { Dictionary result = new Dictionary(); foreach (String key in dictionary.Keys) { result.Add(key, ComponentKnownButNotSetUpMapper.get(dictionary[key])); } return result; } // original declaration: System.Collections.Generic.Dictionary`2[System.String,Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.ComponentNotKnownAtAll] // generate key / value array for dictionary // generated dictionary mapper private static Dictionary getComponentsNotKnownAtAllDictionary(IDictionary componentsNotKnownAtAll) { Dictionary result = new Dictionary(); foreach (String key in componentsNotKnownAtAll.Keys) { result.Add(key, com.itac.oib.linecontrol.contracts.data.ComponentNotKnownAtAllMapper.get(componentsNotKnownAtAll[key])); } return result; } // original declaration: System.Collections.Generic.Dictionary`2[System.String,Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.ComponentSetUpOnWrongTable] // generate key / value array for dictionary // generated dictionary mapper private static Dictionary getComponentsSetUpOnWrongTableDictionary(IDictionary componentsSetUpOnWrongTable) { Dictionary result = new Dictionary(); foreach (String key in componentsSetUpOnWrongTable.Keys) { result.Add(key, com.itac.oib.linecontrol.contracts.data.ComponentSetUpOnWrongTableMapper.get(componentsSetUpOnWrongTable[key])); } return result; } // original declaration: System.Collections.Generic.Dictionary`2[System.String,Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.ComponentKnownButNotSetUp] // generate key / value array for dictionary // generated dictionary mapper private static Dictionary getComponentsKnownButNotSetUpDictionary(IDictionary componentsKnownButNotSetUp) { Dictionary result = new Dictionary(); foreach (String key in componentsKnownButNotSetUp.Keys) { result.Add(key, com.itac.oib.linecontrol.contracts.data.ComponentKnownButNotSetUpMapper.get(componentsKnownButNotSetUp[key])); } return result; } } }