001/*- 002 * #%L 003 * HAPI FHIR Subscription Server 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.subscription.match.deliver.websocket; 021 022import ca.uhn.fhir.jpa.subscription.match.registry.ActiveSubscription; 023 024public class WebsocketValidationResponse { 025 private final boolean myValid; 026 private final String myMessage; 027 private final ActiveSubscription myActiveSubscription; 028 029 public static WebsocketValidationResponse INVALID_RESPONSE(String theMessage) { 030 return new WebsocketValidationResponse(false, theMessage, null); 031 } 032 033 public static WebsocketValidationResponse VALID_RESPONSE(ActiveSubscription theActiveSubscription) { 034 return new WebsocketValidationResponse(true, null, theActiveSubscription); 035 } 036 037 private WebsocketValidationResponse(boolean theValid, String theMessage, ActiveSubscription theActiveSubscription) { 038 myValid = theValid; 039 myMessage = theMessage; 040 myActiveSubscription = theActiveSubscription; 041 } 042 043 public boolean isValid() { 044 return myValid; 045 } 046 047 public String getMessage() { 048 return myMessage; 049 } 050 051 public ActiveSubscription getActiveSubscription() { 052 return myActiveSubscription; 053 } 054}