Page MenuHomeHEPForge

Reference.java
No OneTemporary

Reference.java

package cedar.hepdata.model;
import java.util.Date;
import java.util.Set;
import javax.persistence.*;
/**
* One way of referencing a published paper, for example the hep-ex number, the
* journal reference, the institute's preprint code, etc.
* @author Andy Buckley
* @version $Date: 2007-05-29 16:57:52 +0100 (Tue, 29 May 2007) $ $Revision: 995 $
*/
@Entity
@Table(name="TReferences")
public class Reference extends Storeable {
/** Unique internal identifier */
@Id @GeneratedValue
@Column(name="REFERENCE_ID")
private Long _id;
/** Paper that this reference points to */
@ManyToOne
private Paper _paper;
/** Date that the reference was established */
@Column(name="Date", nullable=true)
@Temporal(TemporalType.TIME)
private Date _date = new Date();
/** Type of reference: Journal, arXiv, etc. */
@Column(name="Type", nullable=false)
private RefType _type = RefType.UNKNOWN;
/** Journal name, hep-ex or -ph code, etc. */
@Column(name="Description", nullable=false)
private String _description = "";
/** Optional comment */
@Column(name="Comment", nullable=false)
private String _comment = "";
//////////////////////////////////////////////////////////////////
/** No-arg constructor */
public Reference() { super(); }
/** Constructor from a short description */
public Reference(String description) {
this();
setDescription(description);
}
/** Constructor from a RefType and a description */
public Reference(RefType type, String description) {
this(description);
setType(type);
}
/** Constructor from a RefType, a description and a date */
public Reference(RefType type, String description, Date date) {
this(type, description);
setDate(date);
}
/** Constructor from a Paper */
public Reference(Paper paper) {
this();
setPaper(paper);
}
/** Constructor from a Paper and a short description */
public Reference(Paper paper, String description) {
this(description);
setPaper(paper);
}
/** Constructor from a Paper, a RefType and a description */
public Reference(Paper paper, RefType type, String description) {
this(type, description);
setPaper(paper);
}
/** Constructor from a Paper, a RefType, a description and a date */
public Reference(Paper paper, RefType type, String description, Date date) {
this(type, description, date);
setPaper(paper);
}
//////////////////////////////////////////////////////////////////
/** Get the Paper which this reference refers to */
public Paper getPaper() {
return _paper;
}
/** Set the Paper which this reference refers to */
public Reference setPaper(Paper paper) {
if (getPaper() != null) getPaper().getReferences().add(this);
_paper = paper;
return this;
}
/** Get the date of this Reference */
public Date getDate() {
return _date;
}
/** Set the date of this Reference */
public Reference setDate(Date date) {
_date = date;
return this;
}
/** Get type of reference (as RefType enum) */
public RefType getType() {
return _type;
}
/** Set type of reference (as RefType enum) */
public Reference setType(RefType type) {
_type = type;
return this;
}
/** Get description */
public String getDescription() {
return _description;
}
/** Set description */
public Reference setDescription(String description) {
_description = description;
return this;
}
/** Get comment */
public String getComment() {
return _comment;
}
/** Set comment */
public Reference setComment(String comment) {
_comment = comment;
return this;
}
/** String representation */
public String toString() {
StringBuffer s = new StringBuffer();
s.append("Reference: " + getType().toString() + " " );
return s.toString();
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 5:23 PM (12 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4023621
Default Alt Text
Reference.java (4 KB)

Event Timeline