Пример #1
0
        public void CreateStarSchemaExtractTemplate(
            [Parameter("The name to give to the template")]
            string templateName,
            [Parameter("The name of the DSN that contains the connection details for the " +
                       "database where the star schema extract is to be created. This DSN " +
                       "must exist on the HFM server, and have been registered via the " +
                       "HFM Configuration utility.")]
            string DSN,
            [Parameter("The prefix that should appear at the start of each table name created " +
                       "by the extract process.")]
            string tablePrefix,
            [Parameter("Whether to delete any existing data before performing the extract",
                       DefaultValue = true)]
            bool deleteExisting,
            [Parameter("The type of star schema to produce.")]
            EStarSchemaExtractType extractType,
            [Parameter("Whether to include dynamic accounts",
                       DefaultValue = false)]
            bool includeDynamicAccounts,
            [Parameter("Whether to include calculated data",
                       DefaultValue = true)]
            bool includeCalculatedData,
            [Parameter("Whether to include derived data",
                       DefaultValue = true)]
            bool includeDerivedData,
            ExtractSpecification slice)
        {
            // TODO: Complete this
            StringBuilder sb = new StringBuilder();

            sb.Append("<povTemplate><povEA>");
            sb.Append(slice);
            sb.Append("</povEA><options><tablePrefix>");
            //sb.Append(spec.TablePrefix);
            sb.Append("</tablePrefix><exportOption>");
            //sb.Append((int)spec.ExtractType);
            sb.Append("</exportOption><selectedDSN>");
            //sb.Append(spec.DataSource);
            sb.Append("</selectedDSN><excludeDynAccts>");
            sb.Append(includeDynamicAccounts ? 0 : -1);
            sb.Append("</excludeDynAccts></options></povTemplate>");

            HFM.Try("Creating star schema template {0}", templateName,
                    () => HsvStarSchemaTemplates.SetTemplate(templateName, sb.ToString(), true));
        }
Пример #2
0
        public void CreateFlatFileExtractTemplate(
            [Parameter("The name to give to the template")]
            string templateName,
            [Parameter("Whether to include dynamic accounts",
                       DefaultValue = false)]
            bool includeDynamicAccounts,
            [Parameter("Whether to include calculated data",
                       DefaultValue = true)]
            bool includeCalculatedData,
            [Parameter("Whether to include derived data",
                       DefaultValue = true)]
            bool includeDerivedData,
#if LATE_BIND || HFM_11_1_2_2
            [Parameter("Level of detail to be extracted for line item detail accounts",
                       DefaultValue = ELineItems.Summary, Since = "11.1.2.2")]
            ELineItems lineItems,
#endif
            [Parameter("The field delimiter to use",
                       DefaultValue = ";")]
            string delimiter,
            ExtractSpecification slice)
        {
            // TODO: Complete this
            StringBuilder sb = new StringBuilder();

            sb.Append("<povTemplate><povEA>");
            sb.Append(slice);
            sb.Append("</povEA><options><tablePrefix>");
            //sb.Append(spec.TablePrefix);
            sb.Append("</tablePrefix><exportOption>");
            //sb.Append((int)spec.ExtractType);
            sb.Append("</exportOption><selectedDSN>");
            //sb.Append(spec.DataSource);
            sb.Append("</selectedDSN><excludeDynAccts>");
            sb.Append(includeDynamicAccounts ? 0 : -1);
            sb.Append("</excludeDynAccts></options></povTemplate>");

            HFM.Try("Creating star schema template {0}", templateName,
                    () => HsvStarSchemaTemplates.SetTemplate(templateName, sb.ToString(), true));
        }
Пример #3
0
        public void ExtractDataToStarSchema(
            [Parameter("The name of the DSN that contains the connection details for the " +
                       "database where the star schema extract is to be created. This DSN " +
                       "must exist on the HFM server, and have been registered via the " +
                       "HFM Configuration utility.")]
            string DSN,
            [Parameter("The prefix that should appear at the start of each table name created " +
                       "by the extract process.")]
            string tablePrefix,
            [Parameter("Whether to delete any existing data before performing the extract",
                       DefaultValue = true)]
            bool deleteExisting,
            [Parameter("The type of star schema to produce.")]
            EStarSchemaExtractType extractType,
            [Parameter("Whether to include data",
                       DefaultValue = true, Since = "11.1.2.2.300")]
            bool includeData,
            [Parameter("Whether to include dynamic accounts",
                       DefaultValue = false)]
            bool includeDynamicAccounts,
            [Parameter("Whether to include calculated data",
                       DefaultValue = true, Since = "11.1.1")]
            bool includeCalculatedData,
            [Parameter("Whether to include derived data",
                       DefaultValue = true, Since = "11.1.1")]
            bool includeDerivedData,
            [Parameter("The path to where the EA extract log file should be generated; " +
                       "if omitted, no log file is created.", DefaultValue = null)]
            string logFile,
            ExtractSpecification slice,
            IOutput output)
        {
            DoEAExtract(DSN, tablePrefix, (SS_PUSH_OPTIONS)(deleteExisting ? EPushType.Create : EPushType.Update),
                        (EA_EXTRACT_TYPE_FLAGS)extractType, includeData, includeDynamicAccounts,
                        includeCalculatedData, includeDerivedData, false, false,
#if LATE_BIND || HFM_11_1_2_2
                        (EA_LINEITEM_OPTIONS)ELineItems.Summary,
#endif
                        "", logFile, slice, output);
        }
Пример #4
0
        // Performs an EA extract to a relational or flat file target
        private int DoEAExtract(string dsn, string prefix, SS_PUSH_OPTIONS pushType,
                                EA_EXTRACT_TYPE_FLAGS extractType, bool includeData, bool includeDynamicAccts,
                                bool includeCalculatedData, bool includeDerivedData, bool includeCellText,
                                bool includePhasedSubmissionGroupData,
#if LATE_BIND || HFM_11_1_2_2
                                EA_LINEITEM_OPTIONS lineItems,
#endif
                                string delimiter, string logFile,
                                ExtractSpecification slice, IOutput output)
        {
            int taskId = 0;

            // Check user is permitted to run EA extracts
            Session.Security.CheckPermissionFor(ETask.ExtendedAnalytics);

            // Perform the EA extract
            _log.InfoFormat("Extracting data for {0}", slice);
            try {
                if (HFM.HasVariableCustoms)
                {
#if LATE_BIND
                    if (HFM.Version > HFM.VER_11_1_2_2_300)
                    {
                        HFM.Try(() => HsvStarSchemaACM.CreateStarSchemaExtDim(dsn, prefix, pushType, extractType,
                                                                              includeData, includeDynamicAccts, includeCalculatedData, includeDerivedData,
                                                                              lineItems, includeCellText, includePhasedSubmissionGroupData, delimiter,
                                                                              slice.HfmSliceCOM, out taskId));
                    }
                    else
                    {
                        HFM.Try(() => HsvStarSchemaACM.CreateStarSchemaExtDim(dsn, prefix, pushType, extractType,
                                                                              includeDynamicAccts, includeCalculatedData, includeDerivedData,
                                                                              lineItems, includeCellText, includePhasedSubmissionGroupData, delimiter,
                                                                              slice.HfmSliceCOM, out taskId));
                    }
                    _log.DebugFormat("Task id: {0}", taskId);
#elif HFM_11_1_2_2
                    HFM.Try(() => HsvStarSchemaACM.CreateStarSchemaExtDim(dsn, prefix, pushType,
                                                                          extractType,
#if HFM_11_1_2_2_300
                                                                          includeData,
#endif
                                                                          includeDynamicAccts, includeCalculatedData, includeDerivedData,
                                                                          lineItems, includeCellText, includePhasedSubmissionGroupData, delimiter,
                                                                          slice.HfmSliceCOM, out taskId));
                    _log.DebugFormat("Task id: {0}", taskId);
#else
                    HFM.ThrowIncompatibleLibraryEx();
#endif
                }
                else
                {
                    HFM.Try(() => HsvStarSchemaACM.CreateStarSchema(dsn, prefix, pushType,
                                                                    extractType, !includeDynamicAccts, slice.Scenario.MemberIds,
                                                                    slice.Year.MemberIds, slice.Period.MemberIds, slice.View.MemberIds,
                                                                    slice.Entity.MemberIds, slice.Entity.ParentIds, slice.Value.MemberIds,
                                                                    slice.Account.MemberIds, slice.ICP.MemberIds, slice.Custom1.MemberIds,
                                                                    slice.Custom2.MemberIds, slice.Custom3.MemberIds, slice.Custom4.MemberIds));
                }

                // Monitor progress
                MonitorEAExtract(output);
            }
            finally {
                // Retrieve log file
                if (logFile != null)
                {
                    RetrieveLog(logFile);
                }
            }
            return(taskId);
        }
Пример #5
0
        public void ExtractDataToFlatFile(
            [Parameter("The path to the extract file to be created")]
            string extractFile,
            [Parameter("Include file header containing extract details",
                       DefaultValue = false)]
            bool includeHeader,
            [Parameter("Flag specifying whether extract file should be decompressed; " +
                       "extracts are generated in GZip (.gz) format, so compressed files " +
                       "are faster to create and smaller in size",
                       DefaultValue = true)]
            bool decompress,
            [Parameter("Whether to include data",
                       DefaultValue = true, Since = "11.1.2.2.300")]
            bool includeData,
            [Parameter("Whether to include dynamic accounts",
                       DefaultValue = false)]
            bool includeDynamicAccounts,
            [Parameter("Whether to include calculated data",
                       DefaultValue = true)]
            bool includeCalculatedData,
            [Parameter("Whether to include derived data",
                       DefaultValue = true)]
            bool includeDerivedData,
#if LATE_BIND || HFM_11_1_2_2
            [Parameter("Level of detail to be extracted for line item detail accounts",
                       DefaultValue = ELineItems.Summary, Since = "11.1.2.2")]
            ELineItems lineItems,
#endif
            [Parameter("The field delimiter to use",
                       DefaultValue = ";")]
            string delimiter,
            [Parameter("The path to where the EA extract log file should be generated; " +
                       "if omitted, no log file is created.", DefaultValue = null)]
            string logFile,
            ExtractSpecification slice,
            IOutput output,
            Client client)
        {
            int taskId = DoEAExtract("", "EA_FILE", (SS_PUSH_OPTIONS)EPushType.Create,
                                     (EA_EXTRACT_TYPE_FLAGS)(includeHeader ? EFileExtractType.FlatFile :
                                                             EFileExtractType.FlatFileNoHeader),
                                     includeData, includeDynamicAccounts, includeCalculatedData, includeDerivedData,
                                     false, false,
#if LATE_BIND || HFM_11_1_2_2
                                     (EA_LINEITEM_OPTIONS)lineItems,
#endif
                                     delimiter, logFile, slice,
                                     output);

            // Get the path to the extract file
            string path = null;

            HFM.Try("Retrieving extract file path",
                    () => Session.SystemInfo.HsvSystemInfo.GetRunningTaskLogFilePathName(taskId, out path));
            _log.DebugFormat("Path: {0}", path);

            // Returns a string containing 3 parts, separated by semi-colons:
            // - the root directory where Oracle middleware is installed
            // - the path relative to that root where the log file is located
            // - the path relative to that root where the data file is located
            var parts      = path.Split(';');
            var serverFile = Path.Combine(parts[0], parts[2]);

            // Download the extract file
            var ft = Session.Server.FileTransfer;

            ft.RetrieveFile(Session, serverFile, extractFile, decompress, output);
        }