implemented stock display from location tree to property list
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -149,8 +149,6 @@ public class Constants {
|
||||
public static final String PROJECT = "project";
|
||||
public static final String PROJECT_ID = "project_id";
|
||||
public static final String PROPERTIES = "properties";
|
||||
|
||||
public static final String QUANTITY = "quantity";
|
||||
|
||||
public static final String RECEIVERS = "receivers";
|
||||
public static final String REDIRECT = "redirect";
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.model;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
|
||||
public class Item implements Mappable {
|
||||
private long id;
|
||||
private Mappable owner;
|
||||
@@ -27,6 +26,10 @@ public class Item implements Mappable {
|
||||
this.properties = new HashSet<>();
|
||||
}
|
||||
|
||||
public long id(){
|
||||
return id;
|
||||
}
|
||||
|
||||
public static Item of(ResultSet rs, Mappable owner, Location location) throws SQLException {
|
||||
var id = rs.getLong(ID);
|
||||
var code = rs.getString(CODE);
|
||||
@@ -34,6 +37,14 @@ public class Item implements Mappable {
|
||||
return new Item(owner, id, location, code, name);
|
||||
}
|
||||
|
||||
public Mappable owner(){
|
||||
return owner;
|
||||
}
|
||||
|
||||
public Collection<Property> properties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
return Map.of(
|
||||
|
||||
@@ -1,18 +1,33 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.model;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
public class Property implements Mappable {
|
||||
long id;
|
||||
String name;
|
||||
Object value;
|
||||
String unit;
|
||||
String quantity;
|
||||
|
||||
public Property(long id, String name, Object value, String unit) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public static Property of(ResultSet rs) throws SQLException {
|
||||
var id = rs.getLong(ID);
|
||||
var name = rs.getString(NAME);
|
||||
var value = rs.getObject(VALUE);
|
||||
var unit = rs.getString(UNIT);
|
||||
return new Property(id, name, value, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
@@ -20,8 +35,7 @@ public class Property implements Mappable {
|
||||
ID, id,
|
||||
NAME, name,
|
||||
VALUE, value,
|
||||
UNIT, unit,
|
||||
QUANTITY, quantity
|
||||
UNIT, unit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user