preparing to delete locations

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-10-21 08:49:18 +02:00
parent 4e9c8c0f69
commit 59e6a7001d
6 changed files with 51 additions and 20 deletions

View File

@@ -50,11 +50,11 @@ public class DbLocation extends Location {
@Override
public Map<String, Object> toMap() {
return Map.of(
OWNER,owner.toMap(),
ID,id(),
NAME,name,
DESCRIPTION,description);
var map = super.toMap();
map.put(OWNER,owner.toMap());
map.put(NAME,name);
map.put(DESCRIPTION,description);
return map;
}
@Override

View File

@@ -9,16 +9,27 @@ import static java.text.MessageFormat.format;
import de.srsoftware.tools.Mappable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
public class Location implements Mappable {
private final long id;
private long id;
public Location(long id){
this.id = id;
}
public long id(){
return id;
}
public <T extends Location> T id(long newValue){
id = newValue;
//noinspection unchecked
return (T) this;
}
public static Location of(ResultSet rs) throws SQLException {
return new Location(rs.getLong(LOCATION_ID));
}
@@ -31,13 +42,11 @@ public class Location implements Mappable {
return stockService().loadLocation(id());
}
public long id(){
return id;
}
@Override
public Map<String, Object> toMap() {
return Map.of(ID,id);
var map = new HashMap<String,Object>();
map.put(ID,id);
return map;
}
@Override