private ResourceDescription CreateControlResourceDescription(FTN.Control cimControl) { ResourceDescription rd = null; if (cimControl != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.CONTROL, importHelper.CheckOutIndexForDMSType(DMSType.CONTROL)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimControl.ID, gid); ////populate ResourceDescription Converter.PopulateControlProperties(cimControl, rd, importHelper, report); } return(rd); }
public static void PopulateControlProperties(FTN.Control cimControl, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimControl != null) && (rd != null)) { Converter.PopulateIdentifiedObjectProperties(cimControl, rd); if (cimControl.RegulatingCondEqHasValue) { long gid = importHelper.GetMappedGID(cimControl.RegulatingCondEq.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimControl.GetType().ToString()).Append(" rdfID = \"").Append(cimControl.ID); report.Report.Append("\" - Failed to set reference to RegulatingCondEq: rdfID \"").Append(cimControl.RegulatingCondEq.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.CONTROL_REGULATINGCONDEQ, gid)); } } }
private void ImportControls() { SortedDictionary <string, object> cimControls = concreteModel.GetAllObjectsOfType("FTN.Control"); if (cimControls != null) { foreach (KeyValuePair <string, object> cimControlPair in cimControls) { FTN.Control cimControl = cimControlPair.Value as FTN.Control; ResourceDescription rd = CreateControlResourceDescription(cimControl); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Control ID = ").Append(cimControl.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("Control ID = ").Append(cimControl.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }