private void handleShowPrevExon(Tuple request) { SearchService searchService = ServiceLocator.instance().getSearchService(); ExonDTO exonDTO = searchService.findPrevExon(request.getInt("exon_id")); request.set("__action", "showExon"); request.set("exon_id", exonDTO.getId()); this.handleShowExon(request); }
/** * Needed for hyperlink form switches... * * @param request * @throws DatabaseException */ private void doXrefselect(Tuple request) throws DatabaseException { // also set the parent menu if (getParent() != null && getParent() instanceof MenuController) { // set the filter to select the xref-ed entity pager.resetFilters(); getModel().setUserRules(new ArrayList<QueryRule>()); QueryRule rule = new QueryRule( request.getString("attribute"), QueryRule.Operator.valueOf(request.getString("operator")), request.getString("value")); pager.addFilter(rule); // tell "my" menu to select me Tuple parentRequest = new SimpleTuple(); String aChildName = getModel().getName(); ScreenController<?> aParent = getParent(); while (aParent != null) { if (aParent instanceof MenuModel) { parentRequest.set("select", aChildName); MenuController c = (MenuController) aParent; c.doSelect(parentRequest); } aChildName = aParent.getName(); aParent = aParent.getParent(); } } }
private void handleShowNextMutation(Tuple request) { SearchService searchService = ServiceLocator.instance().getSearchService(); MutationSummaryDTO mutationSummaryDTO = searchService.findNextMutation(request.getString("mid")); request.set("mid", mutationSummaryDTO.getIdentifier()); this.handleShowMutation(request); }
/** NOTE: Copied from InvestigationExcelReader */ private void writeSheetToFile(Sheet sheet, File file) throws FileNotFoundException { List<String> headers = new ArrayList<String>(); Cell[] headerCells = sheet.getRow(0); // assume headers are on first // line ArrayList<Integer> namelessHeaderLocations = new ArrayList<Integer>(); // allow // for // empty // columns, // also // column // order // does // not // matter for (int i = 0; i < headerCells.length; i++) { if (!headerCells[i].getContents().equals("")) { headers.add(headerCells[i].getContents()); } else { headers.add("nameless" + i); namelessHeaderLocations.add(i); } } PrintWriter pw = new PrintWriter(file); CsvWriter cw = new CsvWriter(pw, headers); cw.setMissingValue(""); cw.writeHeader(); for (int rowIndex = 1; rowIndex < sheet.getRows(); rowIndex++) { Tuple t = new SimpleTuple(); int colIndex = 0; for (Cell c : sheet.getRow(rowIndex)) { if (!namelessHeaderLocations.contains(colIndex)) { t.set(headers.get(colIndex), c.getContents()); } colIndex++; } cw.writeRow(t); } cw.close(); }
private boolean writeSheetToFile(Sheet sheet, File file) throws FileNotFoundException { List<String> headers = new ArrayList<String>(); Cell[] headerCells = sheet.getRow(0); // assume headers are on first line if (headerCells.length == 0) { return false; } ArrayList<Integer> namelessHeaderLocations = new ArrayList<Integer>(); // allow for empty columns, also column order does not matter for (int i = 0; i < headerCells.length; i++) { if (!headerCells[i].getContents().equals("")) { headers.add(headerCells[i].getContents()); } else { headers.add("nameless" + i); namelessHeaderLocations.add(i); } } PrintWriter pw = new PrintWriter(file); CsvWriter cw = new CsvWriter(pw, headers); cw.setMissingValue(""); cw.writeHeader(); for (int rowIndex = 1; rowIndex < sheet.getRows(); rowIndex++) { Tuple t = new SimpleTuple(); int colIndex = 0; for (Cell c : sheet.getRow(rowIndex)) { if (!namelessHeaderLocations.contains(colIndex) && colIndex < headers.size() && c.getContents() != null) { t.set(headers.get(colIndex), c.getContents()); } colIndex++; } cw.writeRow(t); } cw.close(); return true; }
private void handleShowFirstExon(Tuple request) { SearchService searchService = ServiceLocator.instance().getSearchService(); ExonDTO exonDTO = searchService.findFirstExon(); request.set("exon_id", exonDTO.getId()); this.handleShowExon(request); }