package it.inaf.ia2.gms.persistence.model; import java.util.Objects; public class GroupEntity { private String id; private String name; private String path; private boolean leaf; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public boolean isLeaf() { return leaf; } public void setLeaf(boolean leaf) { this.leaf = leaf; } public String getParentPath() { if (path.isEmpty()) { return null; } if (path.contains(".")) { return path.substring(0, path.lastIndexOf(".")); } return ""; } @Override public int hashCode() { int hash = 5; hash = 79 * hash + Objects.hashCode(this.id); hash = 79 * hash + Objects.hashCode(this.name); hash = 79 * hash + Objects.hashCode(this.path); return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GroupEntity other = (GroupEntity) obj; if (!Objects.equals(this.id, other.id)) { return false; } if (!Objects.equals(this.name, other.name)) { return false; } if (!Objects.equals(this.path, other.path)) { return false; } return true; } }