private ResourceDescription CreateAORAreaResourceDescription(DERMS.AORArea cimAORArea) { ResourceDescription rd = null; if (cimAORArea != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.AOR_AREA, importHelper.CheckOutIndexForDMSType(DMSType.AOR_AREA)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimAORArea.ID, gid); ////populate ResourceDescription DERMSConveter.PopulateAORAreaProperties(cimAORArea, rd, importHelper, report); } return(rd); }
public static void PopulateAORAreaProperties(DERMS.AORArea cimAORArea, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimAORArea != null) && (rd != null)) { DERMSConveter.PopulateIdentifiedObjectProperties(cimAORArea, rd); if (cimAORArea.IsControlableHasValue) { rd.AddProperty(new Property(ModelCode.AOR_AREA_CONTROLLABLE, cimAORArea.IsControlable)); } if (cimAORArea.IsViewableHasValue) { rd.AddProperty(new Property(ModelCode.AOR_AREA_VIEWABLE, cimAORArea.IsViewable)); } if (cimAORArea.CoveredByHasValue) { rd.AddProperty(new Property(ModelCode.AOR_AREA_COVEREDBY, cimAORArea.CoveredBy)); } if (cimAORArea.AORUserHasValue) { long gid = importHelper.GetMappedGID(cimAORArea.AORUser.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimAORArea.GetType().ToString()).Append(" rdfID = \"").Append(cimAORArea.ID); report.Report.Append("\" - Failed to set reference to AORArea: rdfID \"").Append(cimAORArea.AORUser.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.AOR_AREA_USER, gid)); } if (cimAORArea.AOR_AGAggregatorHasValue) { long gid = importHelper.GetMappedGID(cimAORArea.AOR_AGAggregator.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimAORArea.GetType().ToString()).Append(" rdfID = \"").Append(cimAORArea.ID); report.Report.Append("\" - Failed to set reference to AORArea: rdfID \"").Append(cimAORArea.AOR_AGAggregator.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.AOR_AREA_AGGREGATOR, gid)); } } }
private void ImportAORAreas() { SortedDictionary <string, object> cimAORAreas = concreteModel.GetAllObjectsOfType("DERMS.AORArea"); if (cimAORAreas != null) { foreach (KeyValuePair <string, object> cimAORAreaPair in cimAORAreas) { DERMS.AORArea cimAORAreaValue = cimAORAreaPair.Value as DERMS.AORArea; ResourceDescription rd = CreateAORAreaResourceDescription(cimAORAreaValue); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("AORArea ID = ").Append(cimAORAreaValue.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("AORArea ID = ").Append(cimAORAreaValue.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }