View Javadoc
1   /*
2    * Copyright 2016 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.commons.ihe.hl7v2.storage;
17  
18  import ca.uhn.hl7v2.model.Message;
19  
20  /**
21   * Interface for storages of HL7 v2 interactive continuation fragments.
22   * @author Dmytro Rud
23   */
24  public interface InteractiveContinuationStorage {
25      
26      /**
27       * Puts a fragment into this storage.
28       * 
29       * @param continuationPointer
30       *      continuation pointer of the fragment —
31       *      identifies the fragment in the context of the fragment chain.
32       *      <code>Null</code> values must be allowed.
33       * @param chainId
34       *      unique ID of the fragment chain.
35       *      Consisting of the query tag of the fragment (QPD-2) and
36       *      MSH-3-1, MSH-3-2, MSH-3-3 of the request.
37       * @param fragment
38       *      fragment as a HAPI message instance. 
39       */
40      void put(String continuationPointer, String chainId, Message fragment);
41      
42      
43      /**
44       * Retrieves a fragment from the storage or <code>null</code> 
45       * when no fragment with the given parameters could be found.
46       * 
47       * @param continuationPointer
48       *      continuation pointer of the fragment &mdash;
49       *      identifies the fragment in the context of the fragment chain.
50       *      <code>Null</code> values must be allowed.
51       * @param chainId
52       *      unique ID of the fragment chain.
53       *      Consists of the query tag of the fragment (QPD-2) and
54       *      MSH-3-1, MSH-3-2, MSH-3-3 of the request.
55       * @return
56       *      fragment as a HAPI message instance or <code>null</code> when none found.
57       */
58      Message get(String continuationPointer, String chainId);
59      
60      
61      /**
62       * Deletes all fragments which belong to the given query tag.
63       *
64       * @param chainId
65       *      unique ID of the fragment chain.
66       *      Consists of the query tag of the fragment (QPD-2) and
67       *      MSH-3-1, MSH-3-2, MSH-3-3 of the request.
68       * @return
69       *      <code>true</code>, when some fragments have been 
70       *      actually deleted, i.e. when the given query tag is known.
71       */
72      boolean delete(String chainId);
73  
74  }