コード例 #1
0
  /** Update list the Access Record */
  public ReturnMessage updateAccessRecord(List<AccessRecord> listRecords) {

    logger.debug(
        " enter constructor AccessRecordController.updateAccessRecord() list " + listRecords);
    ReturnMessage msg = new ReturnMessage();
    try {

      Iterator<AccessRecord> itr = listRecords.iterator();

      while (itr.hasNext()) {
        msg = updateAccessRecord(itr.next());

        // if not success, then terminate will returning error
        if (!msg.getStatus().equalsIgnoreCase(StatusOfMessage.SUCCESS.toString())) {
          return msg;
        }
      }
      msg.setSuccessMsg(ReturnMessage.SuccessSet.UPDATE_SUCCESS.toString());

    } catch (Exception e) {
      logger.error(
          " Exception caught in AccessRecordController.updateAccessRecord() -> " + e.getMessage());
      e.printStackTrace();

      msg.setErrMsg(ReturnMessage.ErrorSet.UNKNOWN_ERROR.toString());
    }

    return msg;
  }
コード例 #2
0
  /** Update the Access Record */
  public ReturnMessage updateAccessRecord(AccessRecord record) {

    logger.debug(" enter constructor AccessRecordController.updateAccessRecord() " + record);
    ReturnMessage msg = new ReturnMessage();
    try {

      // TODO Validate all the key details. It should recalculate everything again, just to make
      // sure any false input
      // validatePartyRecord(record);

      // call the service method to update
      accessRecordService.save(record);

      // assuming saved successfully if no error is thrown
      msg.setSuccessMsg(
          ReturnMessage.SuccessSet.UPDATE_SUCCESS.toString() + record.getACCESSRECORDID());

      msg.setObj(record.getACCESSRECORDID());
      msg.setStatus(StatusOfMessage.SUCCESS);

    } catch (Exception e) {
      logger.error(
          " Exception caught in AccessRecordController.updateAccessRecord() -> " + e.getMessage());
      e.printStackTrace();

      msg.setErrMsg(ReturnMessage.ErrorSet.UNKNOWN_ERROR.toString());
    }

    return msg;
  }