Organise imports to ONAP Java standards
[aai/search-data-service.git] / src / main / java / org / onap / aai / sa / searchdbabstraction / elasticsearch / dao / DocumentStoreInterface.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 package org.onap.aai.sa.searchdbabstraction.elasticsearch.dao;
22
23
24 import org.onap.aai.sa.rest.BulkRequest;
25 import org.onap.aai.sa.rest.DocumentSchema;
26 import org.onap.aai.sa.searchdbabstraction.elasticsearch.exception.DocumentStoreOperationException;
27 import org.onap.aai.sa.searchdbabstraction.entity.DocumentOperationResult;
28 import org.onap.aai.sa.searchdbabstraction.entity.OperationResult;
29 import org.onap.aai.sa.searchdbabstraction.entity.SearchOperationResult;
30
31
32 public interface DocumentStoreInterface {
33
34   public OperationResult createIndex(String index, DocumentSchema documentSchema);
35
36   public OperationResult createDynamicIndex(String index, String dynamicSchema);
37
38   public OperationResult deleteIndex(String indexName) throws DocumentStoreOperationException;
39
40   public DocumentOperationResult createDocument(String indexName, 
41                                                 DocumentStoreDataEntity document, 
42                                                 boolean allowImplicitIndexCreation) throws DocumentStoreOperationException;
43
44   public DocumentOperationResult updateDocument(String indexName, 
45                                                 DocumentStoreDataEntity document,
46                                                 boolean allowImplicitIndexCreation) throws DocumentStoreOperationException;
47
48   public SearchOperationResult suggestionQueryWithPayload(String indexName, String query) throws DocumentStoreOperationException;
49
50   public DocumentOperationResult deleteDocument(String indexName, DocumentStoreDataEntity document)
51       throws DocumentStoreOperationException;
52
53   public DocumentOperationResult getDocument(String indexName, DocumentStoreDataEntity document)
54       throws DocumentStoreOperationException;
55
56   public SearchOperationResult search(String indexName, String queryText)
57       throws DocumentStoreOperationException;
58
59   public SearchOperationResult searchWithPayload(String indexName, String query)
60       throws DocumentStoreOperationException;
61
62
63   /**
64    * Forwards a set of operations to the document store as a single, bulk
65    * request.
66    *
67    * @param anIndex    - The index to apply the operations to.
68    * @param operations - A java object containing the set of operations to
69    *                   be performed.
70    * @return - An operation result.
71    * @throws DocumentStoreOperationException
72    */
73   public OperationResult performBulkOperations(BulkRequest[] request)
74       throws DocumentStoreOperationException;
75 }