
001/*- 002 * #%L 003 * HAPI FHIR JPA Model 004 * %% 005 * Copyright (C) 2014 - 2023 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.jpa.model.entity; 021 022import javax.persistence.Column; 023import javax.persistence.Entity; 024import javax.persistence.Id; 025import javax.persistence.Lob; 026import javax.persistence.Table; 027import javax.persistence.Temporal; 028import javax.persistence.TemporalType; 029import java.sql.Blob; 030import java.util.Date; 031 032@Entity 033@Table(name = "HFJ_BINARY_STORAGE_BLOB") 034public class BinaryStorageEntity { 035 036 @Id 037 @Column(name = "BLOB_ID", length = 200, nullable = false) 038 //N.B GGG: Note that the `blob id` is the same as the `externalized binary id`. 039 private String myBlobId; 040 @Column(name = "RESOURCE_ID", length = 100, nullable = false) 041 private String myResourceId; 042 @Column(name = "BLOB_SIZE", nullable = true) 043 private long mySize; 044 @Column(name = "CONTENT_TYPE", nullable = false, length = 100) 045 private String myBlobContentType; 046 @Lob 047 @Column(name = "BLOB_DATA", nullable = false, insertable = true, updatable = false) 048 private Blob myBlob; 049 @Temporal(TemporalType.TIMESTAMP) 050 @Column(name = "PUBLISHED_DATE", nullable = false) 051 private Date myPublished; 052 @Column(name = "BLOB_HASH", length = 128, nullable = true) 053 private String myHash; 054 055 public Date getPublished() { 056 return new Date(myPublished.getTime()); 057 } 058 059 public void setPublished(Date thePublishedDate) { 060 myPublished = thePublishedDate; 061 } 062 063 public String getHash() { 064 return myHash; 065 } 066 067 public void setBlobId(String theBlobId) { 068 myBlobId = theBlobId; 069 } 070 071 public void setResourceId(String theResourceId) { 072 myResourceId = theResourceId; 073 } 074 075 public long getSize() { 076 return mySize; 077 } 078 079 public String getBlobContentType() { 080 return myBlobContentType; 081 } 082 083 public void setBlobContentType(String theBlobContentType) { 084 myBlobContentType = theBlobContentType; 085 } 086 087 public Blob getBlob() { 088 return myBlob; 089 } 090 091 public void setBlob(Blob theBlob) { 092 myBlob = theBlob; 093 } 094 095 public String getBlobId() { 096 return myBlobId; 097 } 098 099 public void setSize(long theSize) { 100 mySize = theSize; 101 } 102 103 public void setHash(String theHash) { 104 myHash = theHash; 105 } 106}