Unit.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package cz.hsrs.db.model;
  2. import java.sql.ResultSet;
  3. import java.sql.SQLException;
  4. import cz.hsrs.db.DBObject;
  5. /**
  6. * Class represents unit object from DB
  7. * @author mkepka
  8. *
  9. */
  10. public class Unit implements DBObject{
  11. private long unitId;
  12. private int holderId;
  13. private String description;
  14. public Unit(long unitId, int userId, String description) {
  15. super();
  16. this.unitId = unitId;
  17. this.holderId = userId;
  18. this.description = description;
  19. }
  20. public Unit(long unitId, String description) {
  21. super();
  22. this.unitId = unitId;
  23. this.description = description;
  24. }
  25. public Unit(){
  26. }
  27. public Unit(ResultSet set) throws SQLException {
  28. this.unitId = set.getLong("unit_id");
  29. this.description = set.getString("description");
  30. this.holderId = set.getInt("holder_id");
  31. }
  32. public long getUnitId() {
  33. return unitId;
  34. }
  35. public void setUnitId(long unitId) {
  36. this.unitId = unitId;
  37. }
  38. public int getHolderId() {
  39. return holderId;
  40. }
  41. public void setHolderId(int userId) {
  42. this.holderId = userId;
  43. }
  44. public String getDescription() {
  45. return description;
  46. }
  47. public void setDescription(String description) {
  48. this.description = description;
  49. }
  50. @Override
  51. public DBObject getDBObject(ResultSet set) throws SQLException {
  52. // TODO Auto-generated method stub
  53. return new Unit(set);
  54. }
  55. }