|
|
|
@ -6,7 +6,9 @@ import static de.srsoftware.umbrella.core.Constants.*; |
|
|
|
import de.srsoftware.umbrella.core.api.Owner; |
|
|
|
import de.srsoftware.umbrella.core.api.Owner; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
public class DbLocation extends Location { |
|
|
|
public class DbLocation extends Location { |
|
|
|
private Owner owner; |
|
|
|
private Owner owner; |
|
|
|
@ -14,6 +16,7 @@ public class DbLocation extends Location { |
|
|
|
private String name; |
|
|
|
private String name; |
|
|
|
private String description; |
|
|
|
private String description; |
|
|
|
private String relation; // when added to an item, this field describes the type of the relation
|
|
|
|
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){ |
|
|
|
public DbLocation(long id, Owner owner, Long parentLocationId, String name, String description){ |
|
|
|
super(id); |
|
|
|
super(id); |
|
|
|
@ -23,10 +26,23 @@ public class DbLocation extends Location { |
|
|
|
this.description = description; |
|
|
|
this.description = description; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DbLocation clear(){ |
|
|
|
|
|
|
|
dirtyFields.clear(); |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String description() { |
|
|
|
public String description() { |
|
|
|
return description; |
|
|
|
return description; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isDirty() { |
|
|
|
|
|
|
|
return !dirtyFields.isEmpty(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isDirty(String field){ |
|
|
|
|
|
|
|
return dirtyFields.contains(field); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String name() { |
|
|
|
public String name() { |
|
|
|
return name; |
|
|
|
return name; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -45,6 +61,7 @@ public class DbLocation extends Location { |
|
|
|
|
|
|
|
|
|
|
|
public DbLocation parent(DbLocation newParent) { |
|
|
|
public DbLocation parent(DbLocation newParent) { |
|
|
|
parentLocationId = newParent.id(); |
|
|
|
parentLocationId = newParent.id(); |
|
|
|
|
|
|
|
dirtyFields.add(PARENT_LOCATION_ID); |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|