preparing to delete locations
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user