001package ca.uhn.fhir.jpa.subscription.match.registry;
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.model.CanonicalSubscription;
024import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
025import org.slf4j.Logger;
026import org.slf4j.LoggerFactory;
027
028public class ActiveSubscription {
029        private static final Logger ourLog = LoggerFactory.getLogger(ActiveSubscription.class);
030
031        private CanonicalSubscription mySubscription;
032        private final String myChannelName;
033        private final String myId;
034        private boolean flagForDeletion;
035
036        public ActiveSubscription(CanonicalSubscription theSubscription, String theChannelName) {
037                mySubscription = theSubscription;
038                myChannelName = theChannelName;
039                myId = theSubscription.getIdPart();
040        }
041
042        public CanonicalSubscription getSubscription() {
043                return mySubscription;
044        }
045
046        public String getChannelName() {
047                return myChannelName;
048        }
049
050        public String getCriteriaString() {
051                return mySubscription.getCriteriaString();
052        }
053
054        public void setSubscription(CanonicalSubscription theCanonicalizedSubscription) {
055                mySubscription = theCanonicalizedSubscription;
056        }
057
058        public boolean isFlagForDeletion() {
059                return flagForDeletion;
060        }
061
062        public void setFlagForDeletion(boolean theFlagForDeletion) {
063                flagForDeletion = theFlagForDeletion;
064        }
065
066        public String getId() {
067                return myId;
068        }
069
070        public CanonicalSubscriptionChannelType getChannelType() {
071                return mySubscription.getChannelType();
072        }
073}