Ejemplo n.º 1
0
  public static ActivityDTO mapFromDB(UserActivity userActivity) {
    ActivityDTO activityDTO = new ActivityDTO();
    activityDTO.setId(userActivity.getId());
    activityDTO.setStartDate(userActivity.getStartDate());
    activityDTO.setClassified(userActivity.getClassified());
    activityDTO.setEndDate(userActivity.getEndDate());
    activityDTO.setDescription(userActivity.getDescription());
    activityDTO.setLevelOfJoy(userActivity.getLevelOfJoy());
    activityDTO.setSummary(userActivity.getSummary());
    activityDTO.setType(userActivity.getType());

    return activityDTO;
  }
Ejemplo n.º 2
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, UserActivity entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String type = entity.getType();
    if (type != null) {
      stmt.bindString(2, type);
    }

    String summary = entity.getSummary();
    if (summary != null) {
      stmt.bindString(3, summary);
    }

    String description = entity.getDescription();
    if (description != null) {
      stmt.bindString(4, description);
    }

    Boolean classified = entity.getClassified();
    if (classified != null) {
      stmt.bindLong(5, classified ? 1L : 0L);
    }

    Integer levelOfJoy = entity.getLevelOfJoy();
    if (levelOfJoy != null) {
      stmt.bindLong(6, levelOfJoy);
    }

    Long startDate = entity.getStartDate();
    if (startDate != null) {
      stmt.bindLong(7, startDate);
    }

    Long endDate = entity.getEndDate();
    if (endDate != null) {
      stmt.bindLong(8, endDate);
    }
  }