CSIT Fix for SDC-2585
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / dao / api / IGenericIdDAO.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.dao.api;
22
23 import java.util.List;
24
25 /**
26  * A DAO that allows accessing data by Id or / and multiple Ids.
27  * 
28  * @author Igor Ngouagna
29  */
30 public interface IGenericIdDAO {
31
32         /**
33          * Find an instance from the given class.
34          * 
35          * @param clazz
36          *            The class of the object to find.
37          * @param id
38          *            The id of the object.
39          * @return The object that has the given id or null if no object matching
40          *         the request is found.
41          */
42         <T> T findById(String typeName, String id, Class<T> clazz);
43
44         /**
45          * Find instances by id
46          * 
47          * @param clazz
48          *            The class for which to find an instance.
49          * @param ids
50          *            array of id of the data to find.
51          * @return List of Objects that has the given ids or empty list if no object
52          *         matching the request is found.
53          */
54         <T> List<T> findByIds(String typeName, Class<T> clazz, String... ids);
55
56         /**
57          * Delete an instance from the given class.
58          * 
59          * @param clazz
60          *            The class of the object to delete.
61          * @param id
62          *            The id of the object to delete.
63          */
64         void delete(String typeName, String id);
65
66 }