001/*- 002 * #%L 003 * HAPI FHIR Storage api 004 * %% 005 * Copyright (C) 2014 - 2024 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.bulk.export.model; 021 022import ca.uhn.fhir.model.api.IModelJson; 023import ca.uhn.fhir.rest.server.util.JsonDateDeserializer; 024import ca.uhn.fhir.rest.server.util.JsonDateSerializer; 025import com.fasterxml.jackson.annotation.JsonAutoDetect; 026import com.fasterxml.jackson.annotation.JsonInclude; 027import com.fasterxml.jackson.annotation.JsonProperty; 028import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 029import com.fasterxml.jackson.databind.annotation.JsonSerialize; 030 031import java.util.ArrayList; 032import java.util.Date; 033import java.util.List; 034 035@JsonInclude(JsonInclude.Include.NON_DEFAULT) 036@JsonAutoDetect( 037 creatorVisibility = JsonAutoDetect.Visibility.NONE, 038 fieldVisibility = JsonAutoDetect.Visibility.NONE, 039 getterVisibility = JsonAutoDetect.Visibility.NONE, 040 isGetterVisibility = JsonAutoDetect.Visibility.NONE, 041 setterVisibility = JsonAutoDetect.Visibility.NONE) 042public class BulkExportResponseJson { 043 044 @JsonProperty("transactionTime") 045 @JsonSerialize(using = JsonDateSerializer.class) 046 @JsonDeserialize(using = JsonDateDeserializer.class) 047 private Date myTransactionTime; 048 049 @JsonProperty("request") 050 private String myRequest; 051 052 @JsonProperty("requiresAccessToken") 053 private Boolean myRequiresAccessToken; 054 055 @JsonProperty("output") 056 private List<Output> myOutput; 057 058 /* 059 * Note that we override the include here as ONC regulations require that we actually serialize the empty error array. 060 */ 061 @JsonInclude 062 @JsonProperty("error") 063 private List<Output> myError = new ArrayList<>(); 064 065 @JsonProperty("message") 066 private String myMsg; 067 068 public Date getTransactionTime() { 069 return myTransactionTime; 070 } 071 072 public BulkExportResponseJson setTransactionTime(Date theTransactionTime) { 073 myTransactionTime = theTransactionTime; 074 return this; 075 } 076 077 public String getRequest() { 078 return myRequest; 079 } 080 081 public BulkExportResponseJson setRequest(String theRequest) { 082 myRequest = theRequest; 083 return this; 084 } 085 086 public Boolean getRequiresAccessToken() { 087 return myRequiresAccessToken; 088 } 089 090 public BulkExportResponseJson setRequiresAccessToken(Boolean theRequiresAccessToken) { 091 myRequiresAccessToken = theRequiresAccessToken; 092 return this; 093 } 094 095 public List<Output> getOutput() { 096 if (myOutput == null) { 097 myOutput = new ArrayList<>(); 098 } 099 return myOutput; 100 } 101 102 public List<Output> getError() { 103 if (myError == null) { 104 myError = new ArrayList<>(); 105 } 106 return myError; 107 } 108 109 public Output addOutput() { 110 Output retVal = new Output(); 111 getOutput().add(retVal); 112 return retVal; 113 } 114 115 public String getMsg() { 116 return myMsg; 117 } 118 119 public void setMsg(String theMsg) { 120 myMsg = theMsg; 121 } 122 123 public static class Output implements IModelJson { 124 125 @JsonProperty("type") 126 private String myType; 127 128 @JsonProperty("url") 129 private String myUrl; 130 131 public String getType() { 132 return myType; 133 } 134 135 public Output setType(String theType) { 136 myType = theType; 137 return this; 138 } 139 140 public String getUrl() { 141 return myUrl; 142 } 143 144 public Output setUrl(String theUrl) { 145 myUrl = theUrl; 146 return this; 147 } 148 } 149}