Skip to content

Commit

Permalink
feat: introduce lombok to models
Browse files Browse the repository at this point in the history
  • Loading branch information
NuttyShrimp committed Mar 25, 2024
1 parent b107fdb commit 001e4c5
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 352 deletions.
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ dependencies {

// Swagger-UI
implementation 'com.smoketurner:dropwizard-swagger:2.0.0-1'

// Getter & Setter via annotations
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'

testCompileOnly 'org.projectlombok:lombok:1.18.32'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
}

test {
Expand Down
33 changes: 5 additions & 28 deletions src/main/java/telraam/database/models/Baton.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package telraam.database.models;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Objects;

@Getter @Setter @NoArgsConstructor
public class Baton {
private Integer id;
private String name;
private String mac;

// DO NOT REMOVE
public Baton() {
}

public Baton(String name) {
this.name = name;
}
Expand All @@ -20,30 +21,6 @@ public Baton(String name, String mac) {
this.mac = mac;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getMac() {
return mac;
}

public void setMac(String mac) {
this.mac = mac;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
49 changes: 5 additions & 44 deletions src/main/java/telraam/database/models/BatonSwitchover.java
Original file line number Diff line number Diff line change
@@ -1,66 +1,27 @@
package telraam.database.models;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.sql.Timestamp;
import java.util.Objects;

@Getter @Setter @NoArgsConstructor
public class BatonSwitchover {
private Integer id;
private Integer teamId;
private Integer previousBatonId;
private Integer newBatonId;
private Timestamp timestamp;

// DO NOT REMOVE
public BatonSwitchover() {
}

public BatonSwitchover(Integer teamId, Integer previousBatonId, Integer newBatonId, Timestamp timestamp) {
this.teamId = teamId;
this.previousBatonId = previousBatonId;
this.newBatonId = newBatonId;
this.timestamp = timestamp;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Integer getTeamId() {
return teamId;
}

public void setTeamId(Integer teamId) {
this.teamId = teamId;
}

public Integer getPreviousBatonId() {
return previousBatonId;
}

public void setPreviousBatonId(Integer previousBatonId) {
this.previousBatonId = previousBatonId;
}

public Integer getNewBatonId() {
return newBatonId;
}

public void setNewBatonId(Integer newBatonId) {
this.newBatonId = newBatonId;
}

public Timestamp getTimestamp() {
return timestamp;
}

public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
88 changes: 5 additions & 83 deletions src/main/java/telraam/database/models/Detection.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package telraam.database.models;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.sql.Timestamp;

@Setter @Getter @NoArgsConstructor
public class Detection {
private Integer id;
private Integer batonId;
Expand All @@ -14,9 +19,6 @@ public class Detection {
private Timestamp timestampIngestion;
private Integer teamId;

public Detection() {
}

public Detection(Integer batonId, Integer stationId, Integer rssi, Float battery, Long uptimeMs, Integer remoteId, Timestamp timestamp, Timestamp timestampIngestion) {
this.batonId = batonId;
this.stationId = stationId;
Expand All @@ -27,84 +29,4 @@ public Detection(Integer batonId, Integer stationId, Integer rssi, Float battery
this.timestamp = timestamp;
this.timestampIngestion = timestampIngestion;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Integer getBatonId() {
return batonId;
}

public void setBatonId(Integer batonId) {
this.batonId = batonId;
}

public Integer getStationId() {
return stationId;
}

public void setStationId(Integer stationId) {
this.stationId = stationId;
}

public Integer getRssi() {
return rssi;
}

public void setRssi(Integer rssi) {
this.rssi = rssi;
}

public Float getBattery() {
return battery;
}

public void setBattery(Float battery) {
this.battery = battery;
}

public Long getUptimeMs() {
return uptimeMs;
}

public void setUptimeMs(Long uptimeMs) {
this.uptimeMs = uptimeMs;
}

public Integer getRemoteId() {
return remoteId;
}

public void setRemoteId(Integer remoteId) {
this.remoteId = remoteId;
}

public Timestamp getTimestamp() {
return timestamp;
}

public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}

public Timestamp getTimestampIngestion() {
return timestampIngestion;
}

public void setTimestampIngestion(Timestamp timestampIngestion) {
this.timestampIngestion = timestampIngestion;
}

public Integer getTeamId() {
return teamId;
}

public void setTeamId(Integer teamId) {
this.teamId = teamId;
}
}
48 changes: 5 additions & 43 deletions src/main/java/telraam/database/models/Lap.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package telraam.database.models;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.sql.Timestamp;

@Getter @Setter @NoArgsConstructor
public class Lap {
private Integer id;
private Integer teamId;
Expand All @@ -10,52 +15,9 @@ public class Lap {
private Boolean manual;
private Timestamp timestamp;

public Lap() {
}

public Lap(Integer teamId, Integer lapSourceId, Timestamp timestamp) {
this.teamId = teamId;
this.lapSourceId = lapSourceId;
this.timestamp = timestamp;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Integer getTeamId() {
return teamId;
}

public void setTeamId(Integer teamId) {
this.teamId = teamId;
}

public Integer getLapSourceId() {
return lapSourceId;
}

public void setLapSourceId(Integer lapSourceId) {
this.lapSourceId = lapSourceId;
}

public Boolean getManual() {
return manual;
}

public void setManual(Boolean manual) {
this.manual = manual;
}

public Timestamp getTimestamp() {
return timestamp;
}

public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}
}
25 changes: 5 additions & 20 deletions src/main/java/telraam/database/models/LapSource.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
package telraam.database.models;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* The lap source tells you where the lap comes from.
*/
@Getter @Setter @NoArgsConstructor
public class LapSource {
private Integer id;
private String name;

public LapSource() {

}

public LapSource(String name) {
this.name = name;
}

public Integer getId() {
return id;
}

public String getName() {
return name;
}

public void setId(Integer id) {
this.id = id;
}

public void setName(String name) {
this.name = name;
}
}
Loading

0 comments on commit 001e4c5

Please sign in to comment.