Exemplo n.º 1
0
  public static UserActivity mapToDB(ActivityDTO activity) {
    UserActivity userActivity = new UserActivity();
    userActivity.setId(activity.getId());
    userActivity.setStartDate(activity.getStartDate());
    userActivity.setClassified(activity.isClassified());
    userActivity.setEndDate(activity.getEndDate());
    userActivity.setDescription(activity.getDescription());
    userActivity.setLevelOfJoy(activity.getLevelOfJoy());
    userActivity.setSummary(activity.getSummary());
    userActivity.setType(activity.getType());

    return userActivity;
  }
Exemplo n.º 2
0
 /** @inheritdoc */
 @Override
 public Long getKey(UserActivity entity) {
   if (entity != null) {
     return entity.getId();
   } else {
     return null;
   }
 }
Exemplo n.º 3
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, UserActivity entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
   entity.setSummary(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
   entity.setDescription(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
   entity.setClassified(cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0);
   entity.setLevelOfJoy(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
   entity.setStartDate(cursor.isNull(offset + 6) ? null : cursor.getLong(offset + 6));
   entity.setEndDate(cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7));
 }
Exemplo n.º 4
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;
  }
Exemplo n.º 5
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);
    }
  }
Exemplo n.º 6
0
 /** @inheritdoc */
 @Override
 protected Long updateKeyAfterInsert(UserActivity entity, long rowId) {
   entity.setId(rowId);
   return rowId;
 }