Пример #1
0
  @Override
  public void addFields(BasicDBObject bannerDoc, AdDefinition bannerDefinition) {
    DayConditionDefinition ddef = null;

    if (bannerDefinition.hasConditionDefinition(ConditionDefinitions.DAY)) {
      ddef =
          (DayConditionDefinition)
              bannerDefinition.getConditionDefinition(ConditionDefinitions.DAY);
    }

    if (ddef != null && ddef.getDays().size() > 0) {
      List<Day> list = ddef.getDays();
      List<String> days = new ArrayList<String>();
      for (Day day : list) {
        days.add(String.valueOf(day.getDay()));
      }
      bannerDoc.put(AdDBConstants.ADDB_AD_DAY, days);
    } else {
      List<String> days = new ArrayList<String>();
      days.add(AdDBConstants.ADDB_AD_DAY_ALL);
      bannerDoc.put(AdDBConstants.ADDB_AD_DAY, days);
    }
  }