public static void PopulateRegularTimePoint(FTN.RegularTimePoint cimRegularTimePoint, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimRegularTimePoint != null) && (rd != null)) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(cimRegularTimePoint, rd); if (cimRegularTimePoint.SequenceNumberHasValue) { rd.AddProperty(new Property(ModelCode.RTP_SEQNUMBER, cimRegularTimePoint.SequenceNumber)); } if (cimRegularTimePoint.Value1HasValue) { rd.AddProperty(new Property(ModelCode.RTP_VAL1, cimRegularTimePoint.Value1)); } if (cimRegularTimePoint.Value2HasValue) { rd.AddProperty(new Property(ModelCode.RTP_VAL2, cimRegularTimePoint.Value2)); } if (cimRegularTimePoint.IntervalScheduleHasValue) { long gid = importHelper.GetMappedGID(cimRegularTimePoint.IntervalSchedule.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimRegularTimePoint.GetType().ToString()).Append(" rdfID = \"").Append(cimRegularTimePoint.ID); report.Report.Append("\" - Failed to set reference to IntervalSchedule: rdfID \"").Append(cimRegularTimePoint.IntervalSchedule.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.RTP_INTERVALSCHEDULE, gid)); } } }
private ResourceDescription CreateRegularTimePointResourceDescription(FTN.RegularTimePoint cimRegularTimePoint) { ResourceDescription rd = null; if (cimRegularTimePoint != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.REGULARTIMEPOINT, importHelper.CheckOutIndexForDMSType(DMSType.REGULARTIMEPOINT)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimRegularTimePoint.ID, gid); ////populate ResourceDescription PowerTransformerConverter.PopulateRegularTimePoint(cimRegularTimePoint, rd, importHelper, report); } return(rd); }
private void ImportRegularTimePoints() { SortedDictionary <string, object> RegularTimePoints = concreteModel.GetAllObjectsOfType("FTN.RegularTimePoint"); if (RegularTimePoints != null) { foreach (KeyValuePair <string, object> RegularTimePointPair in RegularTimePoints) { FTN.RegularTimePoint cimRegularTimePoint = RegularTimePointPair.Value as FTN.RegularTimePoint; ResourceDescription rd = CreateRegularTimePointResourceDescription(cimRegularTimePoint); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("RegularTimePoint ID = ").Append(cimRegularTimePoint.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("RegularTimePoint ID = ").Append(cimRegularTimePoint.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }