package gov.nih.ncgc.bard.entity; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; /** * A one line summary. * * @author Rajarshi Guha */ public class Source extends BaseEntity { String name; Long sourceId; public Source() { } public Source(Long sourceId, String name) { this.sourceId = sourceId; this.name = name; } public Long getSourceId() { return sourceId; } public void setSourceId(Long sourceId) { this.sourceId = sourceId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toJson() throws IOException { ObjectMapper mapper = new ObjectMapper(); Writer writer = new StringWriter(); mapper.writeValue(writer, this); return writer.toString(); } /** * Return the path for this resource in the REST API. * <p/> * The actual resource can be accessed by prepending the hostname of the server * hosting the REST API. * * @return The path to this resource. <code>null</code> if the object is not meant * to be publically available via the REST API */ public String getResourcePath() { return null; //To change body of implemented methods use File | Settings | File Templates. } /** * Set the resource path. * <p/> * In most cases, this can be an empty function as its primary purpose * is to allow Jackson to deserialize a JSON entity to the relevant Java * entity. * * @param resourcePath the resource path for this entity */ public void setResourcePath(String resourcePath) { //To change body of implemented methods use File | Settings | File Templates. } }