Package com.iisigroup.cap.base.model

Examples of com.iisigroup.cap.base.model.Sequence


   *            最大序號
   * @return next seq
   */
  private int getDBNextSeq(String seqNode, int interval, int startSeq,
      int maxSeq) {
    Sequence thisSeq = getSequence(seqNode);
    int returnSeq = -1;
    try {
      if (thisSeq == null || thisSeq.getSeqNode().length() == 0) {
        thisSeq = new Sequence();
        thisSeq.setSeqNode(seqNode);
        thisSeq.setNextSeq(startSeq + 1);
        thisSeq.setUpdateTime(CapDate.getCurrentTimestamp());
        thisSeq.setRounds(1);
        saveSeq(thisSeq, -1);
        return startSeq;
      } else {
        Sequence nextSeq = thisSeq;
        returnSeq = thisSeq.getNextSeq();
        int next = returnSeq + 1;
        if (maxSeq > 0 && (next * interval) >= maxSeq) {
          next = startSeq;
          nextSeq.setRounds(thisSeq.getRounds() + 1);
        }
        nextSeq.setNextSeq(next);
        nextSeq.setUpdateTime(CapDate.getCurrentTimestamp());
        int row = saveSeq(nextSeq, returnSeq);
        if (row != 1) {
          return getDBNextSeq(seqNode, interval, startSeq, maxSeq);
        }
      }
View Full Code Here


    }
    return rtn;
  }// ;

  private Sequence getSequence(String seqNode) {
    Sequence thisSeq = sequenceDao.findBySeqNode(seqNode);
    return thisSeq;
  }// ;
View Full Code Here

    return getNamedJdbcTemplate().queryForObject("Sequence.findBySeqNode", args,
        new RowMapper<Sequence>() {
      @Override
      public Sequence mapRow(ResultSet rs, int rowNum)
          throws SQLException {
        Sequence seq = new Sequence();
        seq.setSeqNode(rs.getString("SEQNODE"));
        seq.setNextSeq(rs.getInt("NEXTSEQ"));
        seq.setRounds(rs.getInt("ROUNDS"));
        seq.setUpdateTime(rs.getTimestamp("UPDATETIME"));
        return seq;
      }
    });
  }
View Full Code Here

TOP

Related Classes of com.iisigroup.cap.base.model.Sequence

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.