edu.uiowa.icts.bluebutton.domain.ClinicalDocument.java Source code

Java tutorial

Introduction

Here is the source code for edu.uiowa.icts.bluebutton.domain.ClinicalDocument.java

Source

package edu.uiowa.icts.bluebutton.domain;

/*
 * #%L
 * blue-button Spring MVC Web App
 * %%
 * Copyright (C) 2014 - 2015 University of Iowa Institute for Clinical and Translational Science (ICTS)
 * %%
 * 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.
 * #L%
 */

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Size;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.format.annotation.DateTimeFormat;

/** 
 * Generated by Protogen - www.icts.uiowa.edu/protogen 
 * @since 07/31/2014 09:37:03 CDT
 */

@Entity(name = "edu_uiowa_icts_bluebutton_domain_clinicalDocument")
@Table(name = "clinical_document", schema = "bluebutton")
public class ClinicalDocument {

    private static final Log log = LogFactory.getLog(ClinicalDocument.class);

    private Integer clinicalDocumentId;

    private byte[] document;
    private String name;

    private String jsonParserVersion;

    @Size(min = 1)
    private byte[] parsedJson;

    private String source;

    @NotBlank
    private String description;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date dateUploaded;
    private Person person;

    public ClinicalDocument() {
        this.clinicalDocumentId = null;
        this.document = null;
        this.name = "";
        this.description = "";
        this.dateUploaded = null;
        this.person = null;
        this.source = null;
    }

    public ClinicalDocument(Integer clinicalDocumentId, byte[] document, String name, String description,
            Date dateUploaded, Person person, String source) {
        this.clinicalDocumentId = clinicalDocumentId;
        this.document = document;
        this.name = name;
        this.description = description;
        this.dateUploaded = dateUploaded;
        this.person = person;
        this.source = source;
    }

    @Transient
    public String getXml() {
        if (this.document != null) {
            return new String(this.document);
        } else {
            return "";
        }
    }

    /*****clinicalDocumentId*****/
    @javax.persistence.SequenceGenerator(name = "gen", sequenceName = "bluebutton.seqnum", allocationSize = 1)
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "gen")
    @Column(name = "clinical_document_id", unique = true, nullable = false)
    public Integer getClinicalDocumentId() {
        return clinicalDocumentId;
    }

    public void setClinicalDocumentId(Integer clinicalDocumentId) {
        this.clinicalDocumentId = clinicalDocumentId;
    }

    /*****document*****/
    @Column(name = "document")
    public byte[] getDocument() {
        return document;
    }

    public void setDocument(byte[] document) {
        this.document = document;
    }

    /*****name*****/
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /*****description*****/
    @Column(name = "description")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    /*****dateUploaded*****/
    @Column(name = "date_uploaded")
    public Date getDateUploaded() {
        return dateUploaded;
    }

    public void setDateUploaded(Date dateUploaded) {
        this.dateUploaded = dateUploaded;
    }

    /*****person*****/
    @ManyToOne(fetch = FetchType.LAZY, targetEntity = Person.class)
    @JoinColumn(name = "person_id", nullable = true)
    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    /*****source*****/
    @Column(name = "source")
    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    /*****parsed_json*****/
    @Column(length = 10000, name = "parsed_json")
    public byte[] getParsedJson() {
        return parsedJson;
    }

    public void setParsedJson(byte[] parsedJson) {
        this.parsedJson = parsedJson;
    }

    /****json_parser_version****/
    @Column(name = "json_parser_version")
    public String getJsonParserVersion() {
        return jsonParserVersion;
    }

    public void setJsonParserVersion(String jsonParserVersion) {
        this.jsonParserVersion = jsonParserVersion;
    }

}