/* * 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 Location 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 LocationMapper { // 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.Location get(Location itacLocation) { if (itacLocation == null) { return null; } www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location asmLocation = new www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location(); mapItac2Asm(asmLocation, itacLocation); return asmLocation; } public static void mapItac2Asm(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location asmLocation, Location itacLocation) { // skip property ExtensionDataObject, declared in Location asmLocation.Loc = itacLocation.Loc; // complex property Positions, isArray:True, isGeneric:False asmLocation.Positions = com.itac.oib.traceability.contracts.data.PositionMapper.get( itacLocation.Positions); asmLocation.Station = itacLocation.Station; asmLocation.TableID = itacLocation.TableID; } // maps iTAC namespace conform array to ASM namespace array public static www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location[] get(Location[] itacLocation) { if (itacLocation == null) { return null; } www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location[] asmLocation = new www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location[itacLocation.Length]; for (int i = 0; i < itacLocation.Length; i++) { // to itac array asmLocation[i] = LocationMapper.get(itacLocation[i]); } return asmLocation; } // maps iTAC namespace conform array to ASM namespace list public static List getList(Location[] asmLocation) { if (asmLocation == null) { return null; } List itacLocation = new List(); for (int i = 0; i < asmLocation.Length; i++) { itacLocation.Add(LocationMapper.get(asmLocation[i])); } return itacLocation; } // map type from ASM namespace to iTAC namespace public static Location get(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location asmLocation) { if (asmLocation == null) { return null; } Location itacLocation = new Location(); mapAsm2Itac(asmLocation, itacLocation); return itacLocation; } public static void mapAsm2Itac(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location asmLocation, Location itacLocation) { // skip property ExtensionDataObject, declared in Location itacLocation.Loc = asmLocation.Loc; // array mapping itacLocation.Positions = PositionMapper.getArray(asmLocation.Positions); // complex asm property Positions itacLocation.Station = asmLocation.Station; itacLocation.TableID = asmLocation.TableID; } // maps ASM namespace conform list to iTAC namespace array public static Location[] getArray(IList asmLocation) { if (asmLocation == null) { return null; } Location[] itacLocation = new Location[asmLocation.Count]; for (int i = 0; i < asmLocation.Count; i++) { itacLocation[i] = LocationMapper.get(asmLocation[i]); } return itacLocation; } // maps ASM namespace conform array to iTAC namespace array public static Location[] getArray(www.siplace.com.OIB._2009._03.Traceability.Contracts.Data.Location[] asmLocation) { if (asmLocation == null) { return null; } Location[] itacLocation = new Location[asmLocation.Length]; for (int i = 0; i < asmLocation.Length; i++) { itacLocation[i] = LocationMapper.get(asmLocation[i]); } return itacLocation; } } }