Package org.cipres.treebase.domain.matrix

Examples of org.cipres.treebase.domain.matrix.MatrixRow


    Object command,
    BindException bindExp) throws Exception {

    RowSegment aRowSegment = (RowSegment) command;
    Long matrixRowId = ControllerUtil.getMatrixRowId(request);
    MatrixRow matrixRow = mMatrixRowService.findByID(matrixRowId);

    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("++MARTIX ROW ID++ : " + matrixRowId.toString());
    }

    if (request.getParameter(ACTION_DELETE) != null) {
      mRowSegmentService.deleteRowSegment(aRowSegment);
    } else {
      System.out.println("MARTIX ROW ID In Submit Button: " + matrixRowId.toString());
      ExecutionResult executionResult = new ExecutionResult();
      boolean test = aRowSegment.validate(executionResult);
      if (test) {
        if (request.getParameter(ACTION_SUBMIT) != null) {
          matrixRow.addSegment(aRowSegment);
          mMatrixRowService.update(matrixRow);
        } else if (request.getParameter(ACTION_UPDATE) != null) {
          mRowSegmentService.update(aRowSegment);
        }
      } else {
View Full Code Here


   * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest)
   */
  protected Object formBackingObject(HttpServletRequest request) throws ServletException {

    Long matrixRowId = ControllerUtil.getMatrixRowId(request);
    MatrixRow matrixRow = getMatrixRowService().findByID(matrixRowId);

    RowSegment rowSegment = null;

    String rowSegmentId = ServletRequestUtils.getStringParameter(request, "id", null);

    if (rowSegmentId == null) {
      rowSegment = new RowSegment();
      rowSegment.setMatrixRow(matrixRow);
      rowSegment.setTaxonLabel(matrixRow.getTaxonLabel());
     
      int endIndex = matrixRow.getSymbolString().length();
      if (endIndex >= 1) {
        rowSegment.setStartIndex(1);
        rowSegment.setEndIndex(endIndex);
      }
     
View Full Code Here

    // missing symbol is ?
    DiscreteCharState aState = dnaChar.getStateByDescription("" + DiscreteCharState.MISSING_SYMBOL);
    assertTrue("? is not a valid state", aState != null);

    // create one row with 2 elements:
    MatrixRow r1 = new MatrixRow();
    r1.setTaxonLabel(taxonLabel);

    DiscreteMatrixElement e1 = new DiscreteMatrixElement();
    e1.setColumn(c1);
    e1.setCharState(aState);
    r1.addElement(e1);

    DiscreteMatrixElement e2 = new DiscreteMatrixElement();
    e2.setColumn(c2);
    e2.setCharState(aState);
    r1.addElement(e2);

    // add two segments, each with one element:
    RowSegment seg1 = new RowSegment();

    seg1.setStartIndex(0);
    seg1.setEndIndex(0);
    r1.addSegment(seg1);

    RowSegment seg2 = new RowSegment();

    seg2.setStartIndex(1);
    seg2.setEndIndex(1);
    r1.addSegment(seg2);

    matrix.addRow(r1);

    // TODO: add a second row.
 
    //getMatrixHome().store(taxonLabel);
    getMatrixHome().store(c1);
    getMatrixHome().store(c2);
    getMatrixHome().store(e1);
    getMatrixHome().store(e2);
    getMatrixHome().store(matrix);
   
    // 2. verify
    Long matrixID = matrix.getId();
    Long c1ID = c1.getId();
    Long c2ID = c2.getId();
    Long r1ID = r1.getId();
    Long seg1ID = seg1.getId();
    Long seg2ID = seg2.getId();
    Long e1ID = e1.getId();
    Long e2ID = e2.getId();
    Long taxonID = taxonLabel.getId();

      logger.info("matrix created: " + matrix.getTitle() + "id = " + matrixID + " symbols=" + matrix.getSymbols() + " gap =" + matrix.getGapSymbol());
    logger.info("taxonLabel created: " + taxonLabel.getTaxonLabel() + "id = " + taxonID);
    logger.info("2 columns created: id = " + c1ID + ", " + c2ID);
    logger.info("2 rows created: id = " + r1.getId() + ", ");
    logger.info("2 segments created: id = " + seg1.getId() + ", " + seg2.getId());
    logger.info("2 elements created: id = " + e1.getId() + ", " + e2.getId());

    // force commit immediately, important:
    //setComplete();
    //endTransaction();
 
    Matrix m = (Matrix)loadObject(Matrix.class, matrixID);
    TaxonLabel tl = (TaxonLabel)loadObject(TaxonLabel.class, taxonID);
      //String sqlStr = "select count(*) from matrix where matrix_id=" + matrixID;
    //int count = jdbcTemplate.queryForInt(sqlStr);
    //assertTrue(count == 1);
    assertTrue( m!=null );
    //assertTrue( tl!=null );
    assertTrue(c1ID != null && c2ID != null);
    assertTrue(r1.getId() != null);
    assertTrue(seg1ID != null && seg2ID != null);
    assertTrue(e1ID != null && e2ID != null);
 

    // 3. delete
View Full Code Here

    if (pSegment == null) {
      return false;
    }

    // bi-directional relationship management
    MatrixRow aRow = pSegment.getMatrixRow();
    if (aRow != null) {
      aRow.removeSegment(pSegment);
    }

    // Cascade delete:
    // TODO: need to delete specimenLabel if it has no other references.
View Full Code Here

    // add rows
    for (int rowIndex = 0; rowIndex < taxonLabels.size(); rowIndex++) {

      TaxonLabel label = taxonLabels.get(rowIndex);

      MatrixRow aRow = new MatrixRow();
      aRow.setTaxonLabel(label);
      m.addRow(aRow);

      // add elements for a row: replaced by the direct jdbc version
      // addRowElements(aRow, rowIndex, pMesqMatrix);
    }
View Full Code Here

    Object command,
    BindException bindExp) {

    RowSegmentCommand rowSegmentCommand = (RowSegmentCommand) command;
    Long matrix_row_id = ControllerUtil.getMatrixRowId(request);
    MatrixRow matrixRow = mMatrixRowService.findByID(matrix_row_id);

    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("++MARTIX ROW ID++ : " + matrix_row_id.toString());
    }

    // will never get here. see onCancel().
    // if (request.getParameter(ACTION_CANCEL) != null) {
    // System.out.println("MARTIX ROW ID In Cancel Button: " + matrix_row_id.toString());
    // return null;
    // // return new ModelAndView(getSuccessView() + "?id=" + matrix_row_id.toString());
    // }

    // get matrix so we can have the taxon label to show to user

    if (request.getParameter(ACTION_SUBMIT) != null) {
      System.out.println("MARTIX ROW ID In Submit Button: " + matrix_row_id.toString());
      matrixRow.addSegment(rowSegmentCommand.getRowSegment());
      mMatrixRowService.update(matrixRow);
    } else if (request.getParameter(ACTION_UPDATE) != null) {
      mRowSegmentService.update(rowSegmentCommand.getRowSegment());
    } else if (request.getParameter(ACTION_DELETE) != null) {
      mRowSegmentService.deleteRowSegment(rowSegmentCommand.getRowSegment());
View Full Code Here

  protected Object formBackingObject(HttpServletRequest request) throws ServletException {

    // get matrix so we can have the taxon label to show to user

    Long matrix_row_id = ControllerUtil.getMatrixRowId(request);
    MatrixRow matrixRow = mMatrixRowService.findByID(matrix_row_id);

    RowSegmentCommand rowSegmentCommand = new RowSegmentCommand();
    // add taxon label
    rowSegmentCommand.setTaxonLabel(matrixRow.getTaxonLabel().getTaxonLabel());
    rowSegmentCommand.setTaxonLabelId(matrixRow.getTaxonLabel().getId());
    // add matrix row data
    rowSegmentCommand.setMatrixRowData(matrixRow.buildElementAsString());

    String matrix_row_segment_id = ServletRequestUtils.getStringParameter(request, "id", null);

    // Setting the session variable "REQUEST_VIEW_URL
    List<String> sessionlist = new ArrayList<String>();
View Full Code Here

    if (TreebaseUtil.isEmpty(matrix_row_id)) {
      return new ModelAndView(new RedirectView("matrixRowList.html" + "?id="
        + request.getSession().getAttribute("MATRIX_ID"))); // Go back to the matrix row
      // list using Matrix ID.
    }
    MatrixRow matrixRow = mMatrixRowService.findByID(Long.parseLong(matrix_row_id));
    // Save MatrixRow to session
    ControllerUtil.saveMatrixRow(request, matrixRow);
    // Get row segment list for the matrix row selected
    Set<RowSegment> rowSegments = matrixRow.getSegmentsReadOnly();
    return new ModelAndView(
      "matrixRowSegmentList",
      Constants.MATRIX_ROW_SEGMENT_LIST,
      rowSegments);
  }
View Full Code Here

    // add some data for the row to show
    List<MatrixRowCommand> matrixRowSet = new ArrayList<MatrixRowCommand>();
    //List<String> rowElementStr = getMatrixService().findRowAsString(standardMatrix, 0, Constants.MAX_MATRIX_COLUMNS_SHOW);
   
    for (int i = 0; i < matrixRows.size(); i++) {
      MatrixRow row = matrixRows.get(i);
     
//      String rowElementString = row.getElementAsString(
//        0,
//        Constants.MAX_MATRIX_COLUMNS_SHOW);
     
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.matrix.MatrixRow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.