Exemplo n.º 1
0
  /**
   * Show the explorer page
   *
   * @param model
   * @return the view name
   */
  @RequestMapping(method = RequestMethod.GET)
  public String init(
      @RequestParam(value = "dataset", required = false) String selectedEntityName,
      @RequestParam(value = "wizard", required = false) Boolean wizard,
      Model model)
      throws Exception {
    // set entityExplorer URL for link to EntityExplorer for x/mrefs, but only if the user has
    // permission to see the
    // plugin
    if (molgenisPermissionService.hasPermissionOnPlugin(
            EntityExplorerController.ID, Permission.READ)
        || molgenisPermissionService.hasPermissionOnPlugin(
            EntityExplorerController.ID, Permission.WRITE)) {
      model.addAttribute("entityExplorerUrl", EntityExplorerController.ID);
    }

    Iterable<EntityMetaData> entitiesMeta =
        Iterables.transform(
            dataService.getEntityNames(),
            new Function<String, EntityMetaData>() {
              @Override
              public EntityMetaData apply(String entityName) {
                return dataService.getEntityMetaData(entityName);
              }
            });
    model.addAttribute("entitiesMeta", entitiesMeta);

    if (selectedEntityName == null) {
      selectedEntityName = entitiesMeta.iterator().next().getName();
    }
    model.addAttribute("selectedEntityName", selectedEntityName);
    model.addAttribute("wizard", (wizard != null) && wizard.booleanValue());

    // Init genome browser
    model.addAttribute("genomeBrowserSets", getGenomeBrowserSetsToModel());

    String appHrefCss = molgenisSettings.getProperty(KEY_APP_HREF_CSS);
    if (appHrefCss != null) model.addAttribute(KEY_APP_HREF_CSS.replaceAll("\\.", "_"), appHrefCss);

    // including/excluding charts
    Boolean appIncludeCharts =
        molgenisSettings.getBooleanProperty(KEY_APP_INCLUDE_CHARTS, INCLUDE_CHARTS_MODULE);
    model.addAttribute(MODEL_APP_INCLUDE_CHARTS, appIncludeCharts);

    model.addAttribute(INITLOCATION, molgenisSettings.getProperty(INITLOCATION));
    model.addAttribute(COORDSYSTEM, molgenisSettings.getProperty(COORDSYSTEM));
    model.addAttribute(CHAINS, molgenisSettings.getProperty(CHAINS));
    model.addAttribute(SOURCES, molgenisSettings.getProperty(SOURCES));
    model.addAttribute(BROWSERLINKS, molgenisSettings.getProperty(BROWSERLINKS));
    model.addAttribute(SEARCHENDPOINT, molgenisSettings.getProperty(SEARCHENDPOINT));
    model.addAttribute(KARYOTYPEENDPOINT, molgenisSettings.getProperty(KARYOTYPEENDPOINT));
    model.addAttribute(GENOMEBROWSERTABLE, molgenisSettings.getProperty(GENOMEBROWSERTABLE));

    return "view-dataexplorer";
  }