private ResourceDescription CreateSubGeographicalRegionResourceDescription(DERMS.SubGeographicalRegion cimSubRegion) { ResourceDescription rd = null; if (cimSubRegion != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.SUBREGION, importHelper.CheckOutIndexForDMSType(DMSType.SUBREGION)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimSubRegion.ID, gid); ////populate ResourceDescription DERMSConveter.PopulateSubGeographicalRegionProperties(cimSubRegion, rd, importHelper, report); } return(rd); }
public static void PopulateSubGeographicalRegionProperties(DERMS.SubGeographicalRegion cimSubGeographicalRegion, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimSubGeographicalRegion != null) && (rd != null)) { DERMSConveter.PopulateIdentifiedObjectProperties(cimSubGeographicalRegion, rd); if (cimSubGeographicalRegion.RegionHasValue) { long gid = importHelper.GetMappedGID(cimSubGeographicalRegion.Region.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimSubGeographicalRegion.GetType().ToString()).Append(" rdfID = \"").Append(cimSubGeographicalRegion.ID); report.Report.Append("\" - Failed to set reference to SubGeographicalRegion: rdfID \"").Append(cimSubGeographicalRegion.Region.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.SUBREGION_REGION, gid)); } } }
private void ImportSubGeographicalRegions() { SortedDictionary <string, object> cimSubRegions = concreteModel.GetAllObjectsOfType("DERMS.SubGeographicalRegion"); if (cimSubRegions != null) { foreach (KeyValuePair <string, object> cimSubRegionPair in cimSubRegions) { DERMS.SubGeographicalRegion cimSubRegion = cimSubRegionPair.Value as DERMS.SubGeographicalRegion; ResourceDescription rd = CreateSubGeographicalRegionResourceDescription(cimSubRegion); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("SubGeographicalRegion ID = ").Append(cimSubRegion.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("SubGeographicalRegion ID = ").Append(cimSubRegion.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }