/** * The contents of this file are subject to the license and copyright * detailed in the LICENSE file at the root of the source * tree and available online at * * https://github.com/keeps/roda */ package org.roda.core.data.v2.ip; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import org.roda.core.data.common.RodaConstants; import org.roda.core.data.v2.IsModelObject; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @XmlRootElement(name = RodaConstants.RODA_OBJECT_FILE) @JsonInclude(JsonInclude.Include.NON_NULL) public class File implements IsModelObject { private static final long serialVersionUID = 3303019735787641534L; private String id; private List<String> path; private String aipId; private String representationId; private boolean isDirectory; public File() { super(); } public File(String id, String aipId, String representationId, List<String> path, boolean isDirectory) { super(); this.id = id; this.aipId = aipId; this.representationId = representationId; this.path = path; this.isDirectory = isDirectory; } @JsonIgnore @Override public int getClassVersion() { return 1; } @Override public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAipId() { return aipId; } public void setAipId(String aipId) { this.aipId = aipId; } public String getRepresentationId() { return representationId; } public void setRepresentationId(String representationId) { this.representationId = representationId; } public List<String> getPath() { return path; } public void setPath(List<String> path) { this.path = path; } public boolean isDirectory() { return isDirectory; } public void setDirectory(boolean isDirectory) { this.isDirectory = isDirectory; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((aipId == null) ? 0 : aipId.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + (isDirectory ? 1231 : 1237); result = prime * result + ((path == null) ? 0 : path.hashCode()); result = prime * result + ((representationId == null) ? 0 : representationId.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; File other = (File) obj; if (aipId == null) { if (other.aipId != null) return false; } else if (!aipId.equals(other.aipId)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (isDirectory != other.isDirectory) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; if (representationId == null) { if (other.representationId != null) return false; } else if (!representationId.equals(other.representationId)) return false; return true; } @Override public String toString() { return "File [id=" + id + ", path=" + path + ", aipId=" + aipId + ", representationId=" + representationId + ", isDirectory=" + isDirectory + "]"; } }