예제 #1
0
  @Transactional
  public OffersInfo addOffersInfo(int companyId, OffersInfo offersInfo) throws Exception {
    try {
      int offerId = offersInfoDao.getMaxIdValue(companyId) + 1;
      OfferInfoDbType offerInfoDbType =
          Conversions.getOfferInfoDbEntry(companyId, offersInfo.getBranchId(), offerId, offersInfo);
      offersInfoDao.add(offerInfoDbType);

      offersInfo.setOfferId(offerId);
      return offersInfo;
    } catch (Exception e) {
      logger.error(
          "error adding offers for : "
              + companyId
              + " and : "
              + offersInfo.getBranchId()
              + " : "
              + e.getMessage());
      throw new Exception(
          "error adding offers for : "
              + companyId
              + " and : "
              + offersInfo.getBranchId()
              + " : "
              + e.getMessage());
    }
  }
예제 #2
0
    public static OffersInfo getOffersInfo(OfferInfoDbType dbEntry) {
      OffersInfo offersInfo = new OffersInfo();

      offersInfo.setBranchId(dbEntry.getBranchId());
      offersInfo.setOfferId(dbEntry.getId().getOfferId());
      offersInfo.setType(dbEntry.getType());
      offersInfo.setDetails(dbEntry.getDetails());

      offersInfo.setStart(dbEntry.getStartTS());
      offersInfo.setEnd(dbEntry.getEndTS());

      offersInfo.setRecurrenceDay(dbEntry.getRecurrenceDay());
      offersInfo.setRecurrence(dbEntry.isRecurrence());
      offersInfo.setHourlyPush(dbEntry.isHourlyPush());
      offersInfo.setClientAppVisibility(dbEntry.isClientAppVisibility());

      return offersInfo;
    }