Exemplo n.º 1
0
    @Override
    public void addChild(Location parent, Location newChild) {
      if (this.manager != null) {
        parent.getChildLocations().add(newChild);
        newChild.setParentLocation(parent);

        manager.persistLocation(newChild);
      }
    }
Exemplo n.º 2
0
    @Override
    public boolean removeChild(Location child) {
      if (child.getParentLocation() != null && manager != null) {
        child.getParentLocation().getChildLocations().remove(child);
        child.setParentLocation(null);

        manager.cascadeDeleteLocation(child.getId());

        return true;
      }

      return false;
    }
Exemplo n.º 3
0
 @Override
 public boolean hasChildren(Location item) {
   return item.getChildLocations().size() > 0;
 }
Exemplo n.º 4
0
 @Override
 public List<Location> getChildren(Location item) {
   return new ArrayList<Location>(item.getChildLocations());
 }
Exemplo n.º 5
0
 @Override
 public Location getParent(Location item) {
   return item.getParentLocation();
 }