예제 #1
0
/** Created by garran on 2015/09/06. */
public class LocationRepositoryImpl implements LocationRepository {
  Redisson redisson = Connection.getConnection();
  RMap<String, Location> lists = redisson.getMap("location");

  @Override
  public Location findById(String s) {
    return lists.get(s);
  }

  @Override
  public Location save(Location entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public Location update(Location entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public void delete(Location entity) {
    lists.remove(entity.getId());
  }

  @Override
  public Set<Location> findAll() {
    Set<Location> set = new HashSet<>();
    for (Map.Entry<String, Location> entry : lists.entrySet()) {
      set.add(entry.getValue());
    }
    return set;
  }
}
/** Created by zamzam on 15/09/09. */
public class LeaveTypeListRepositoryImpl implements LeaveTypeListRepository {
  Redisson redisson = Connection.getConnection();
  RMap<String, LeaveTypeList> lists = redisson.getMap("leaveTypeList");

  public LeaveTypeListRepositoryImpl() {}

  @Override
  public LeaveTypeList findById(String s) {
    return lists.get(s);
  }

  @Override
  public LeaveTypeList save(LeaveTypeList entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public LeaveTypeList update(LeaveTypeList entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public void delete(LeaveTypeList entity) {
    lists.remove(entity.getId());
  }

  @Override
  public Set<LeaveTypeList> findAll() {
    Set<LeaveTypeList> set = new HashSet<>();
    for (Map.Entry<String, LeaveTypeList> entry : lists.entrySet()) {
      set.add(entry.getValue());
    }
    return set;
  }
}