private void addSecurityPolicies(ref CogObject cog, cognosdotnet_2_0.baseClass bc) { if (bc is cognosdotnet_2_0.package) { cognosdotnet_2_0.package pkg = (cognosdotnet_2_0.package)bc; int count = 0; foreach (cognosdotnet_2_0.policy plcy in pkg.policies.value) { cog.AddAttribute("SecurityPath" + count, plcy.securityObject.searchPath.value); count++; } } else if (bc is cognosdotnet_2_0.report) { cognosdotnet_2_0.report rpt = (cognosdotnet_2_0.report)bc; int count = 0; foreach (cognosdotnet_2_0.policy plcy in rpt.policies.value) { cog.AddAttribute("SecurityPath" + count, plcy.securityObject.searchPath.value); count++; } } else if (bc is cognosdotnet_2_0.reportView) { cognosdotnet_2_0.reportView rv = (cognosdotnet_2_0.reportView)bc; int count = 0; foreach (cognosdotnet_2_0.policy plcy in rv.policies.value) { cog.AddAttribute("SecurityPath" + count, plcy.securityObject.searchPath.value); count++; } } else if (bc is cognosdotnet_2_0.query) { cognosdotnet_2_0.query qry = (cognosdotnet_2_0.query)bc; int count = 0; foreach (cognosdotnet_2_0.policy plcy in qry.policies.value) { cog.AddAttribute("SecurityPath" + count, plcy.securityObject.searchPath.value); count++; } } }
/* * Method to extract the options, which can vary a great deal, from * the array of options */ private void addOptionsAttributes(ref CogObject cog, cognosdotnet_2_0.option[] options) { if (options != null) { for (int i = 0; i < options.Length; i++) { cognosdotnet_2_0.option option = options[i]; System.Type optionType = option.GetType(); if (optionType.Name == "runOptionBoolean") { cognosdotnet_2_0.runOptionBoolean rob = (cognosdotnet_2_0.runOptionBoolean)option; cog.AddAttribute(rob.name.ToString(), rob.value.ToString()); } else if (optionType.Name == "runOptionData") { cognosdotnet_2_0.runOptionData rod = (cognosdotnet_2_0.runOptionData)option; cog.AddAttribute(rod.name.ToString(), rod.value.ToString()); } else if (optionType.Name == "runOptionStringArray") { cognosdotnet_2_0.runOptionStringArray rosa = (cognosdotnet_2_0.runOptionStringArray)option; StringBuilder runOptions = new StringBuilder(); foreach (string s in rosa.value) { runOptions.AppendFormat("{0}:", s); } // Remove the last colon runOptions.Remove(runOptions.Length - 1, 1); cog.AddAttribute(rosa.name.ToString(), runOptions.ToString()); } else if (optionType.Name == "runOptionLanguageArray") { cognosdotnet_2_0.runOptionLanguageArray rola = (cognosdotnet_2_0.runOptionLanguageArray)option; StringBuilder languageOptions = new StringBuilder(); foreach (string s in rola.value) { languageOptions.AppendFormat("{0}:", s); } // Remove the last colon languageOptions.Remove(languageOptions.Length - 1, 1); cog.AddAttribute(rola.name.ToString(), languageOptions.ToString()); } else if (optionType.Name == "deliveryOptionString") { cognosdotnet_2_0.deliveryOptionString dos = (cognosdotnet_2_0.deliveryOptionString)option; cog.AddAttribute(dos.name.ToString(), dos.value); } else if (optionType.Name == "deliveryOptionSearchPathMultipleObjectArray") { cognosdotnet_2_0.deliveryOptionSearchPathMultipleObjectArray dospmoa = (deliveryOptionSearchPathMultipleObjectArray)option; StringBuilder toOptions = new StringBuilder(); foreach (searchPathMultipleObject s in dospmoa.value) { toOptions.AppendFormat("{0}|", s.Value); } // Remove the last colon toOptions.Remove(toOptions.Length - 1, 1); cog.AddAttribute(dospmoa.name.ToString(), toOptions.ToString()); } else if (optionType.Name == "deliveryOptionAddressSMTPArray") { cognosdotnet_2_0.deliveryOptionAddressSMTPArray doasa = (deliveryOptionAddressSMTPArray)option; StringBuilder ccOptions = new StringBuilder(); foreach (addressSMTP a in doasa.value) { ccOptions.AppendFormat("{0}:", a.Value); } // Remove the last colon ccOptions.Remove(ccOptions.Length - 1, 1); cog.AddAttribute(doasa.name.ToString(), ccOptions.ToString()); } } } }
/** * Method to add attributes specific to a Schedule object to our CogObject */ private void addScheduleAttributes(ref CogObject cog, cognosdotnet_2_0.schedule sched) { cog.ID = sched.storeID.value.Value; cog.AddAttribute("ID", cog.ID); cog.AddAttribute("Type", "Schedule"); cog.AddAttribute("CreationTime", sched.creationTime.value.ToString()); cog.AddAttribute("Name", sched.name.value[0].value); cog.AddAttribute("Path", sched.searchPath.value); cog.AddAttribute("Active", sched.active.value.ToString()); cog.AddAttribute("Credential", sched.credential.value[0].searchPath.value); if(sched.dailyPeriod.value != null) { cog.AddAttribute("DailyPeriod", sched.dailyPeriod.value); } cog.AddAttribute("EndDate", sched.endDate.value.ToString()); cog.AddAttribute("EndType", sched.endType.value); if (sched.everyNPeriods.value != null) { cog.AddAttribute("EveryNPeriods", sched.everyNPeriods.value); } else { cog.AddAttribute("EveryNPeriods", "null"); } addOptionsAttributes(ref cog, sched.options.value); }
/** * Method to add attribute specific to a History object to our CogObject */ private void addHistoryAttributes(CogObject cog, cognosdotnet_2_0.history hist) { cog.ID = hist.storeID.value.Value; cog.AddAttribute("ID", cog.ID); cog.AddAttribute("Type", "History"); cog.AddAttribute("CreationTime", hist.creationTime.value.ToString()); cog.AddAttribute("Name", hist.name.value[0].value); cog.AddAttribute("Path", hist.searchPath.value); cog.AddAttribute("actualCompletionTime", hist.actualCompletionTime.value.ToString()); cog.AddAttribute("actualExecutionTime", hist.actualExecutionTime.value.ToString()); cog.AddAttribute("requestedExecutionTime", hist.requestedExecutionTime.value.ToString()); cog.AddAttribute("Status", hist.status.value); if (hist.user.value != null) { cog.AddAttribute("User", hist.user.value[0].searchPath.value); } else { cog.AddAttribute("User", "Null"); } }