示例#1
0
  /**
   * Updating SurveyReplyType
   *
   * @param record
   * @return
   * @throws Exception
   */
  @SuppressWarnings("rawtypes")
  public SurveyReplyType updateSurveyReplyType(Map record) throws Exception {
    EntityManager oracleManager = null;
    Object transaction = null;
    try {
      String log = "Method:CommonDMI.updateSurveyReplyType.";
      oracleManager = EMF.getEntityManager();
      transaction = EMF.getTransaction(oracleManager);

      Timestamp recDate = new Timestamp(System.currentTimeMillis());
      Long survey_reply_type_id = new Long(record.get("survey_reply_type_id").toString());
      String survey_reply_type_name =
          record.get("survey_reply_type_name") == null
              ? null
              : record.get("survey_reply_type_name").toString();
      String loggedUserName = record.get("loggedUserName").toString();
      RCNGenerator.getInstance().initRcn(oracleManager, recDate, loggedUserName, log);
      SurveyReplyType SurveyReplyType =
          oracleManager.find(SurveyReplyType.class, survey_reply_type_id);

      SurveyReplyType.setSurvey_reply_type_name(survey_reply_type_name);

      oracleManager.merge(SurveyReplyType);
      oracleManager.flush();

      SurveyReplyType = oracleManager.find(SurveyReplyType.class, survey_reply_type_id);

      EMF.commitTransaction(transaction);
      log += ". Updating Finished SuccessFully. ";
      logger.info(log);
      return SurveyReplyType;
    } catch (Exception e) {
      EMF.rollbackTransaction(transaction);
      if (e instanceof CallCenterException) {
        throw (CallCenterException) e;
      }
      logger.error("Error While Update SurveyReplyType Into Database : ", e);
      throw new CallCenterException("შეცდომა მონაცემების შენახვისას : " + e.toString());
    } finally {
      if (oracleManager != null) {
        EMF.returnEntityManager(oracleManager);
      }
    }
  }
示例#2
0
  /**
   * Adding New SurveyReplyType
   *
   * @param record
   * @return
   * @throws Exception
   */
  public SurveyReplyType addSurveyReplyType(SurveyReplyType surveyReplyType) throws Exception {
    EntityManager oracleManager = null;
    Object transaction = null;
    try {
      String log = "Method:CommonDMI.addSurveyReplyType.";
      oracleManager = EMF.getEntityManager();
      transaction = EMF.getTransaction(oracleManager);

      // sysdate
      Timestamp recDate = new Timestamp(System.currentTimeMillis());
      String loggedUserName = surveyReplyType.getLoggedUserName();
      RCNGenerator.getInstance().initRcn(oracleManager, recDate, loggedUserName, log);
      oracleManager.persist(surveyReplyType);
      oracleManager.flush();

      surveyReplyType =
          oracleManager.find(SurveyReplyType.class, surveyReplyType.getSurvey_reply_type_id());
      surveyReplyType.setLoggedUserName(loggedUserName);

      EMF.commitTransaction(transaction);
      log += ". Inserting Finished SuccessFully. ";
      logger.info(log);
      return surveyReplyType;
    } catch (Exception e) {
      EMF.rollbackTransaction(transaction);
      if (e instanceof CallCenterException) {
        throw (CallCenterException) e;
      }
      logger.error("Error While Insert SurveyReplyType Into Database : ", e);
      throw new CallCenterException("შეცდომა მონაცემების შენახვისას : " + e.toString());
    } finally {
      if (oracleManager != null) {
        EMF.returnEntityManager(oracleManager);
      }
    }
  }