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