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