implemented moving of locations
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -6,7 +6,9 @@ import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import de.srsoftware.umbrella.core.api.Owner;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class DbLocation extends Location {
|
||||
private Owner owner;
|
||||
@@ -14,6 +16,7 @@ public class DbLocation extends Location {
|
||||
private String name;
|
||||
private String description;
|
||||
private String relation; // when added to an item, this field describes the type of the relation
|
||||
private Set<String> dirtyFields = new HashSet<>();
|
||||
|
||||
public DbLocation(long id, Owner owner, Long parentLocationId, String name, String description){
|
||||
super(id);
|
||||
@@ -23,10 +26,23 @@ public class DbLocation extends Location {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public DbLocation clear(){
|
||||
dirtyFields.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public String description() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public boolean isDirty() {
|
||||
return !dirtyFields.isEmpty();
|
||||
}
|
||||
|
||||
public boolean isDirty(String field){
|
||||
return dirtyFields.contains(field);
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
@@ -45,6 +61,7 @@ public class DbLocation extends Location {
|
||||
|
||||
public DbLocation parent(DbLocation newParent) {
|
||||
parentLocationId = newParent.id();
|
||||
dirtyFields.add(PARENT_LOCATION_ID);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user