Exemplo n.º 1
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;
    }
Exemplo n.º 2
0
  private void updateOfferInfoDbEntry(OfferInfoDbType dbEntry, OffersInfo offersInfo) {
    boolean updated = false;
    if (!dbEntry.getType().equals(offersInfo.getType())) {
      dbEntry.setType(offersInfo.getType());
      updated = true;
    }
    if (!dbEntry.getDetails().equals(offersInfo.getDetails())) {
      dbEntry.setDetails(offersInfo.getDetails());
      updated = true;
    }
    if (!dbEntry.getStartTS().equals(offersInfo.getStart())) {
      dbEntry.setStartTS(offersInfo.getStart());
      updated = true;
    }
    if (!dbEntry.getEndTS().equals(offersInfo.getEnd())) {
      dbEntry.setEndTS(offersInfo.getEnd());
      updated = true;
    }
    if (dbEntry.getRecurrenceDay() != offersInfo.getRecurrenceDay()) {
      dbEntry.setRecurrenceDay(offersInfo.getRecurrenceDay());
      updated = true;
    }
    if (dbEntry.isRecurrence() != offersInfo.isRecurrence()) {
      dbEntry.setRecurrence(offersInfo.isRecurrence());
      updated = true;
    }
    if (dbEntry.isHourlyPush() != offersInfo.isHourlyPush()) {
      dbEntry.setHourlyPush(offersInfo.isHourlyPush());
      updated = true;
    }
    if (dbEntry.isClientAppVisibility() != offersInfo.isClientAppVisibility()) {
      dbEntry.setClientAppVisibility(offersInfo.isClientAppVisibility());
      updated = true;
    }

    if (updated == true) {
      offersInfoDao.update(dbEntry);
    }
  }