public InterfaceDataRecord CreateInterfaceRepresentation(ModelInterface intfc) { if (intfc == null) { return(null); } InterfaceDataRecord raw = new InterfaceDataRecord(intfc.PersistentId); if (intfc is ModelInterface) { // Common parameters AddCommonInterfacePropertiesAsNVPairs(intfc, raw); raw.AddProperty(AgentKeys.AgentName, AgentId); // mark it as mine raw.AddProperty(AgentKeys.VisaIntfType, VisaIntfTypeString); } // Unique parameters var specificIntfc = intfc as ModelInterfaceSample; if (specificIntfc != null) { AddInfoToInterface(raw, specificIntfc); } return(raw); }
private ModelElement ConstructInterface(string persistentID, Dictionary <string, string> rawProperties) { var intfcRecord = new InterfaceDataRecord(persistentID); intfcRecord.Properties = rawProperties; var element = ReconstituteInterface(intfcRecord); return(element); }
public bool CanReconstituteThis(InterfaceDataRecord raw) { string recordType = raw.GetString(AgentKeys.RecordType); string agent = raw.GetString(AgentKeys.AgentName); if (agent == string.Empty) { agent = AgentId; } bool canHandle = false; if (agent == AgentId && recordType == MODELINTERFACE_RECORDTYPE) { canHandle = true; } return(canHandle); }
public ModelInterface ReconstituteInterface(InterfaceDataRecord raw) { if (raw == null) { return(null); } if (!CanReconstituteThis(raw)) { return(null); } var intfc = new ModelInterfaceSample(); ExtractCommonInterfacePropertiesFromNVPairs(raw, intfc); intfc.ConnectionTimeout = raw.GetInt(Consts.CONNECTION_TIMEOUT_KEY); intfc.BusAddress = raw.GetInt(Consts.BUS_ADDRESS_KEY); intfc.Dirty = false; return(intfc); }
private static void AddInfoToInterface(InterfaceDataRecord raw, ModelInterfaceSample specificIntfc) { raw.AddProperty(Consts.CONNECTION_TIMEOUT_KEY, specificIntfc.ConnectionTimeout.ToString()); raw.AddProperty(Consts.BUS_ADDRESS_KEY, specificIntfc.BusAddress.ToString()); }
private ModelElement ConstructInterface(string persistentID, Dictionary<string, string> rawProperties) { var intfcRecord = new InterfaceDataRecord(persistentID); intfcRecord.Properties = rawProperties; var element = ReconstituteInterface(intfcRecord); return element; }
private static void AddInfoToInterface(InterfaceDataRecord raw, ModelInterfaceSample specificIntfc) { raw.AddProperty(Consts.CONNECTION_TIMEOUT_KEY, specificIntfc.ConnectionTimeout.ToString()); raw.AddProperty(Consts.BUS_ADDRESS_KEY, specificIntfc.BusAddress.ToString()); }
public ModelInterface ReconstituteInterface(InterfaceDataRecord raw) { if (raw == null) return null; if (!CanReconstituteThis(raw)) return null; var intfc = new ModelInterfaceSample(); ExtractCommonInterfacePropertiesFromNVPairs(raw, intfc); intfc.ConnectionTimeout = raw.GetInt(Consts.CONNECTION_TIMEOUT_KEY); intfc.BusAddress = raw.GetInt(Consts.BUS_ADDRESS_KEY); intfc.Dirty = false; return intfc; }
public InterfaceDataRecord CreateInterfaceRepresentation(ModelInterface intfc) { if (intfc == null) return null; InterfaceDataRecord raw = new InterfaceDataRecord(intfc.PersistentId); if (intfc is ModelInterface) { // Common parameters AddCommonInterfacePropertiesAsNVPairs(intfc, raw); raw.AddProperty(AgentKeys.AgentName, AgentId); // mark it as mine raw.AddProperty(AgentKeys.VisaIntfType, VisaIntfTypeString); } // Unique parameters var specificIntfc = intfc as ModelInterfaceSample; if (specificIntfc != null) { AddInfoToInterface(raw, specificIntfc); } return raw; }
public bool CanReconstituteThis(InterfaceDataRecord raw) { string recordType = raw.GetString(AgentKeys.RecordType); string agent = raw.GetString(AgentKeys.AgentName); if (agent == string.Empty) agent = AgentId; bool canHandle = false; if (agent == AgentId && recordType == MODELINTERFACE_RECORDTYPE) { canHandle = true; } return canHandle; }