2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.dao.api;
23 import java.util.List;
26 * A DAO that allows accessing data by Id or / and multiple Ids.
28 * @author Igor Ngouagna
30 public interface IGenericIdDAO {
33 * Find an instance from the given class.
36 * The class of the object to find.
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.
42 <T> T findById(String typeName, String id, Class<T> clazz);
45 * Find instances by id
48 * The class for which to find an instance.
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.
54 <T> List<T> findByIds(String typeName, Class<T> clazz, String... ids);
57 * Delete an instance from the given class.
60 * The class of the object to delete.
62 * The id of the object to delete.
64 void delete(String typeName, String id);