/* Copyright (C) 2005-2012, by the President and Fellows of Harvard College. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Dataverse Network - A web application to share, preserve and analyze research data. Developed at the Institute for Quantitative Social Science, Harvard University. Version 3.0. */ /* * StudyAuthor.java * * Created on August 7, 2006, 9:49 AM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package edu.harvard.iq.dvn.core.study; import javax.persistence.*; /** * * @author Ellen Kraffmiller */ @Entity public class StudyRelPublication implements java.io.Serializable, MetadataFieldGroup { /** Creates a new instance of StudyGrant */ public StudyRelPublication() { } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Version private Long version; @ManyToOne @JoinColumn(nullable = false) private Metadata metadata; @Column(columnDefinition = "TEXT") private String text; private String idType; private String idNumber; private String url; private boolean replicationData; private int displayOrder; public int getDisplayOrder() { return displayOrder; } public void setDisplayOrder(int displayOrder) { this.displayOrder = displayOrder; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getIdNumber() { return idNumber; } public void setIdNumber(String idNumber) { this.idNumber = idNumber; } public String getIdType() { return idType; } public void setIdType(String idType) { this.idType = idType; } public Metadata getMetadata() { return metadata; } public void setMetadata(Metadata metadata) { this.metadata = metadata; } public boolean isReplicationData() { return replicationData; } public void setReplicationData(boolean replicationData) { this.replicationData = replicationData; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } public boolean isEmpty() { return ((text==null || text.trim().equals("")) && (!replicationData) && (idType==null || idType.trim().equals("")) && (idNumber==null || idNumber.trim().equals("")) && (url==null || url.trim().equals(""))); } public int hashCode() { int hash = 0; hash += (this.id != null ? this.id.hashCode() : 0); return hash; } public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof StudyRelPublication)) { return false; } StudyRelPublication other = (StudyRelPublication) object; if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) { return false; } return true; } }