implemented moving of items
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -77,6 +77,11 @@ public class Company implements Mappable, Owner {
|
||||
return decimalSeparator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Company c && c.id == id;
|
||||
}
|
||||
|
||||
public String email() {
|
||||
return email;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@ public class Item implements Mappable {
|
||||
this.properties = new HashSet<>();
|
||||
}
|
||||
|
||||
public Item clear() {
|
||||
dirtyFields.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public String code(){
|
||||
return code;
|
||||
}
|
||||
@@ -44,6 +49,12 @@ public class Item implements Mappable {
|
||||
return location;
|
||||
}
|
||||
|
||||
public Item location(Location newVal) {
|
||||
location = newVal;
|
||||
dirtyFields.add(LOCATION);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String name(){
|
||||
return name;
|
||||
}
|
||||
@@ -62,6 +73,24 @@ public class Item implements Mappable {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public Item patch(JSONObject json) {
|
||||
for (var field : json.keySet()){
|
||||
var known = true;
|
||||
switch (field) {
|
||||
case CODE:
|
||||
code = json.getString(field);
|
||||
break;
|
||||
case NAME:
|
||||
name = json.getString(field);
|
||||
break;
|
||||
default:
|
||||
known = false;
|
||||
}
|
||||
if (known) dirtyFields.add(field);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Collection<Property> properties() {
|
||||
return properties;
|
||||
}
|
||||
@@ -82,27 +111,4 @@ public class Item implements Mappable {
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Item patch(JSONObject json) {
|
||||
for (var field : json.keySet()){
|
||||
var known = true;
|
||||
switch (field) {
|
||||
case CODE:
|
||||
code = json.getString(field);
|
||||
break;
|
||||
case NAME:
|
||||
name = json.getString(field);
|
||||
break;
|
||||
default:
|
||||
known = false;
|
||||
}
|
||||
if (known) dirtyFields.add(field);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Item clear() {
|
||||
dirtyFields.clear();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user