コード例 #1
0
 protected void determineExecutableTypes() {
   IPluginManager pluginManager = null;
   try {
     pluginManager = PentahoSystem.get(IPluginManager.class, null);
   } catch (Exception ignored) {
     log.debug("Executing outside the BIPLATFORM");
   }
   executableTypes = new HashSet<String>();
   if (pluginManager != null && pluginManager.getContentTypes() != null) {
     executableTypes.addAll(pluginManager.getContentTypes());
   }
   // Add the non-plugin types
   executableTypes.add("xaction");
   executableTypes.add("url");
 }
コード例 #2
0
  /**
   * Return the current user console settings
   *
   * @return current settings
   */
  @GET
  @Path("/settings")
  @Produces({APPLICATION_JSON, APPLICATION_XML})
  public List<Setting> getMantleSettings() {
    ArrayList<Setting> settings = new ArrayList<Setting>();
    settings.add(
        new Setting(
            "login-show-users-list",
            PentahoSystem.getSystemSetting(
                "login-show-users-list", ""))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    settings.add(
        new Setting(
            "documentation-url",
            PentahoSystem.getSystemSetting(
                "documentation-url", ""))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    settings.add(
        new Setting(
            "submit-on-enter-key",
            PentahoSystem.getSystemSetting(
                "submit-on-enter-key", "true"))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    settings.add(
        new Setting(
            "user-console-revision",
            PentahoSystem.getSystemSetting(
                "user-console-revision", ""))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    settings.add(
        new Setting(
            "startupPerspective",
            PentahoSystem.getSystemSetting(
                "startup-perspective", ""))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    settings.add(
        new Setting(
            "showOnlyPerspective",
            PentahoSystem.getSystemSetting(
                "show-only-perspective", ""))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    int startupUrls = Integer.parseInt(PentahoSystem.getSystemSetting("num-startup-urls", "0"));
    settings.add(
        new Setting(
            "num-startup-urls",
            PentahoSystem.getSystemSetting(
                "num-startup-urls", "0"))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    for (int i = 1; i <= startupUrls; i++) {
      settings.add(
          new Setting(
              "startup-url-" + i,
              PentahoSystem.getSystemSetting("startup-url-" + i, ""))); // $NON-NLS-1$
      settings.add(
          new Setting(
              "startup-name-" + i,
              PentahoSystem.getSystemSetting("startup-name-" + i, ""))); // $NON-NLS-1$
    }

    // Check for override of New Analysis View via pentaho.xml
    // Poked in via pentaho.xml entries
    // <new-analysis-view>
    // <command-url>http://www.google.com</command-url>
    // <command-title>Marc Analysis View</command-title>
    // </new-analysis-view>
    // <new-report>
    // <command-url>http://www.yahoo.com</command-url>
    // <command-title>Marc New Report</command-title>
    // </new-report>
    //
    String overrideNewAnalysisViewCommmand =
        PentahoSystem.getSystemSetting("new-analysis-view/command-url", null); // $NON-NLS-1$
    String overrideNewAnalysisViewTitle =
        PentahoSystem.getSystemSetting("new-analysis-view/command-title", null); // $NON-NLS-1$
    if ((overrideNewAnalysisViewCommmand != null) && (overrideNewAnalysisViewTitle != null)) {
      settings.add(
          new Setting(
              "new-analysis-view-command-url", overrideNewAnalysisViewCommmand)); // $NON-NLS-1$
      settings.add(
          new Setting(
              "new-analysis-view-command-title", overrideNewAnalysisViewTitle)); // $NON-NLS-1$
    }
    String overrideNewReportCommmand =
        PentahoSystem.getSystemSetting("new-report/command-url", null); // $NON-NLS-1$
    String overrideNewReportTitle =
        PentahoSystem.getSystemSetting("new-report/command-title", null); // $NON-NLS-1$
    if ((overrideNewReportCommmand != null) && (overrideNewReportTitle != null)) {
      settings.add(new Setting("new-report-command-url", overrideNewReportCommmand)); // $NON-NLS-1$
      settings.add(new Setting("new-report-command-title", overrideNewReportTitle)); // $NON-NLS-1$
    }

    IPluginManager pluginManager =
        PentahoSystem.get(IPluginManager.class, getPentahoSession()); // $NON-NLS-1$
    if (pluginManager != null) {
      // load content types from IPluginSettings
      int i = 0;
      for (String contentType : pluginManager.getContentTypes()) {
        IContentInfo info = pluginManager.getContentTypeInfo(contentType);
        if (info != null) {
          settings.add(
              new Setting(
                  "plugin-content-type-" + i, "." + contentType)); // $NON-NLS-1$ //$NON-NLS-2$
          settings.add(
              new Setting("plugin-content-type-icon-" + i, info.getIconUrl())); // $NON-NLS-1$
          int j = 0;
          for (IPluginOperation operation : info.getOperations()) {
            settings.add(
                new Setting(
                    "plugin-content-type-" + i + "-command-" + j,
                    operation.getId())); // $NON-NLS-1$
            settings.add(
                new Setting(
                    "plugin-content-type-" + i + "-command-perspective-" + j,
                    operation.getPerspective())); // $NON-NLS-1$
            j++;
          }
          i++;
        }
      }
    }

    return settings;
  }