Add DAO module for Models
[policy/models.git] / models-base / src / main / java / org / onap / policy / models / base / PfConceptGetter.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.models.base;
22
23 import java.util.Set;
24
25 /**
26  * This interface is used to allow get methods to be placed on concepts that have embedded maps.
27  *
28  * <p>It forces those concepts with maps to implement the get methods specified on this interface as convenience methods
29  * to avoid concept users having to use a second level of referencing to access concepts in the maps.
30  *
31  * @param <C> the type of concept on which the interface is applied.
32  */
33 public interface PfConceptGetter<C> {
34
35     /**
36      * Get the latest version for a concept with the given key.
37      *
38      * @param conceptKey The key of the concept
39      * @return The concept
40      */
41     C get(PfConceptKey conceptKey);
42
43     /**
44      * Get the latest version for a concept with the given key name.
45      *
46      * @param conceptKeyName The name of the concept
47      * @return The concept
48      */
49     C get(String conceptKeyName);
50
51     /**
52      * Get the latest version for a concept with the given key name and version.
53      *
54      * @param conceptKeyName The name of the concept
55      * @param conceptKeyVersion The version of the concept
56      * @return The concept
57      */
58     C get(String conceptKeyName, String conceptKeyVersion);
59
60     /**
61      * Get the all versions for a concept with the given key name.
62      *
63      * @param conceptKeyName The name of the concept
64      * @return The concepts
65      */
66     Set<C> getAll(String conceptKeyName);
67
68     /**
69      * Get the all versions for a concept with the given key name and starting version.
70      *
71      * @param conceptKeyName The name of the concept
72      * @param conceptKeyVersion The first version version of the concept to get
73      * @return The concepts
74      */
75     Set<C> getAll(String conceptKeyName, String conceptKeyVersion);
76 }