106 lines
4.6 KiB
C#
106 lines
4.6 KiB
C#
/*
|
|
* 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 ConfigurationMapper
|
|
{
|
|
// 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.Configuration get(Configuration asmConfiguration)
|
|
{
|
|
if (asmConfiguration == null) { return null; }
|
|
Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration itacConfiguration = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration();
|
|
mapItac2Asm(itacConfiguration, asmConfiguration);
|
|
return itacConfiguration;
|
|
}
|
|
|
|
public static void mapItac2Asm(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration itacConfiguration, Configuration asmConfiguration)
|
|
{
|
|
// property Lines is readonly(no set method)
|
|
// property AdapterVersion is readonly(no set method)
|
|
// property MonitoringVersion is readonly(no set method)
|
|
// property HostName is readonly(no set method)
|
|
}
|
|
|
|
// maps iTAC namespace conform array to ASM namespace array
|
|
public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration[] get(Configuration[] asmConfiguration)
|
|
{
|
|
if (asmConfiguration == null) { return null; }
|
|
Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration[] itacConfiguration = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration[asmConfiguration.Length];
|
|
for (int i = 0; i < asmConfiguration.Length; i++)
|
|
{
|
|
// to itac array
|
|
itacConfiguration[i] = ConfigurationMapper.get(asmConfiguration[i]);
|
|
}
|
|
return itacConfiguration;
|
|
}
|
|
|
|
// maps iTAC namespace conform array to ASM namespace list
|
|
public static List<Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration> getList(Configuration[] asmConfiguration)
|
|
{
|
|
if (asmConfiguration == null) { return null; }
|
|
List<Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration> itacConfiguration = new List<Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration>();
|
|
for (int i = 0; i < asmConfiguration.Length; i++)
|
|
{
|
|
itacConfiguration.Add(ConfigurationMapper.get(asmConfiguration[i]));
|
|
}
|
|
return itacConfiguration;
|
|
}
|
|
|
|
// map type from ASM namespace to iTAC namespace
|
|
public static Configuration get(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration asmConfiguration)
|
|
{
|
|
if (asmConfiguration == null) { return null; }
|
|
Configuration itacConfiguration = new Configuration();
|
|
mapAsm2Itac(asmConfiguration, itacConfiguration);
|
|
return itacConfiguration;
|
|
}
|
|
|
|
public static void mapAsm2Itac(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration asmConfiguration, Configuration itacConfiguration)
|
|
{
|
|
// maps ASM list 2 iTAC array
|
|
itacConfiguration.Lines = LineMapper.getArray(asmConfiguration.Lines);
|
|
itacConfiguration.AdapterVersion = asmConfiguration.AdapterVersion;
|
|
itacConfiguration.MonitoringVersion = asmConfiguration.MonitoringVersion;
|
|
itacConfiguration.HostName = asmConfiguration.HostName;
|
|
}
|
|
|
|
// maps ASM namespace conform list to iTAC namespace array
|
|
public static Configuration[] getArray(IList<Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration> asmConfiguration)
|
|
{
|
|
if (asmConfiguration == null) { return null; }
|
|
Configuration[] itacConfiguration = new Configuration[asmConfiguration.Count];
|
|
for (int i = 0; i < asmConfiguration.Count; i++)
|
|
{
|
|
itacConfiguration[i] = ConfigurationMapper.get(asmConfiguration[i]);
|
|
}
|
|
return itacConfiguration;
|
|
}
|
|
|
|
// maps ASM namespace conform array to iTAC namespace array
|
|
public static Configuration[] getArray(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Configuration[] asmConfiguration)
|
|
{
|
|
if (asmConfiguration == null) { return null; }
|
|
Configuration[] itacConfiguration = new Configuration[asmConfiguration.Length];
|
|
for (int i = 0; i < asmConfiguration.Length; i++)
|
|
{
|
|
itacConfiguration[i] = ConfigurationMapper.get(asmConfiguration[i]);
|
|
}
|
|
return itacConfiguration;
|
|
}
|
|
}
|
|
}
|