
001package ca.uhn.fhir.jpa.model.entity; 002 003/*- 004 * #%L 005 * HAPI FHIR JPA Model 006 * %% 007 * Copyright (C) 2014 - 2025 Smile CDR, Inc. 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import jakarta.persistence.Column; 024import jakarta.persistence.EmbeddedId; 025import jakarta.persistence.Entity; 026import jakarta.persistence.Table; 027import jakarta.persistence.Temporal; 028import jakarta.persistence.TemporalType; 029 030import java.io.Serializable; 031import java.util.Date; 032 033/** 034 * This class describes how a resourceModifiedMessage is stored for later processing in the event where 035 * submission to the subscription processing pipeline would fail. The persisted message does not include a 036 * payload (resource) as an in-memory version of the same message would. Instead, it points to a payload 037 * through the entity primary key {@link PersistedResourceModifiedMessageEntityPK} which is composed 038 * of the resource Pid and current version. 039 */ 040@Entity 041@Table(name = "HFJ_RESOURCE_MODIFIED") 042public class ResourceModifiedEntity implements IPersistedResourceModifiedMessage, Serializable { 043 044 public static final int MESSAGE_LENGTH = 4000; 045 046 @EmbeddedId 047 private PersistedResourceModifiedMessageEntityPK myResourceModifiedEntityPK; 048 049 @Column(name = "SUMMARY_MESSAGE", length = MESSAGE_LENGTH, nullable = false) 050 private String mySummaryResourceModifiedMessage; 051 052 @Column(name = "CREATED_TIME", nullable = false) 053 @Temporal(TemporalType.TIMESTAMP) 054 private Date myCreatedTime; 055 056 public PersistedResourceModifiedMessageEntityPK getResourceModifiedEntityPK() { 057 return myResourceModifiedEntityPK; 058 } 059 060 public ResourceModifiedEntity setResourceModifiedEntityPK( 061 PersistedResourceModifiedMessageEntityPK theResourceModifiedEntityPK) { 062 myResourceModifiedEntityPK = theResourceModifiedEntityPK; 063 return this; 064 } 065 066 @Override 067 public String getResourceType() { 068 return myResourceModifiedEntityPK == null ? null : myResourceModifiedEntityPK.getResourceType(); 069 } 070 071 @Override 072 public Date getCreatedTime() { 073 return myCreatedTime; 074 } 075 076 public void setCreatedTime(Date theCreatedTime) { 077 myCreatedTime = theCreatedTime; 078 } 079 080 public String getSummaryResourceModifiedMessage() { 081 return mySummaryResourceModifiedMessage; 082 } 083 084 public ResourceModifiedEntity setSummaryResourceModifiedMessage(String theSummaryResourceModifiedMessage) { 085 mySummaryResourceModifiedMessage = theSummaryResourceModifiedMessage; 086 return this; 087 } 088 089 @Override 090 public IPersistedResourceModifiedMessagePK getPersistedResourceModifiedMessagePk() { 091 return myResourceModifiedEntityPK; 092 } 093}