Update license date and text
[aai/champ.git] / champ-lib / champ-core / src / main / java / org / onap / aai / champcore / model / fluent / index / impl / CreateObjectIndexableImpl.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.champcore.model.fluent.index.impl;
22
23 import org.onap.aai.champcore.model.ChampField;
24 import org.onap.aai.champcore.model.ChampObject;
25 import org.onap.aai.champcore.model.ChampObjectIndex;
26 import org.onap.aai.champcore.model.fluent.BuildStep;
27 import org.onap.aai.champcore.model.fluent.index.CreateObjectIndexable;
28 import org.onap.aai.champcore.model.fluent.index.ObjectIndexFieldStep;
29 import org.onap.aai.champcore.model.fluent.index.ObjectIndexTypeStep;
30
31 public final class CreateObjectIndexableImpl implements CreateObjectIndexable {
32
33         @Override
34         public ObjectIndexTypeStep ofName(String name) {
35                 return new ObjectIndexTypeStep() {
36
37                         @Override
38                         public ObjectIndexFieldStep onType(String objectType) {
39                                 return new ObjectIndexFieldStep() {
40
41                                         @Override
42                                         public BuildStep<ChampObjectIndex> forField(String fieldName) {
43                                                 return new BuildStep<ChampObjectIndex> () {
44
45                                                         @Override
46                                                         public ChampObjectIndex build() {
47                                                                 return new ChampObjectIndex.Builder(
48                                                                         name, objectType, new ChampField.Builder(fieldName).build()
49                                                                 ).build();
50                                                         }
51                                                 };
52                                         }
53                                 };
54                         }
55
56                         @Override
57                         public ObjectIndexFieldStep onAnyType() {
58                                 return new ObjectIndexFieldStep() {
59
60                                         @Override
61                                         public BuildStep<ChampObjectIndex> forField(String fieldName) {
62                                                 return new BuildStep<ChampObjectIndex> () {
63
64                                                         @Override
65                                                         public ChampObjectIndex build() {
66                                                                 return new ChampObjectIndex.Builder(
67                                                                         name, ChampObject.ReservedTypes.ANY.toString(), new ChampField.Builder(fieldName).build()
68                                                                 ).build();
69                                                         }
70                                                 };
71                                         }
72                                 };
73                         }
74                 };
75         }
76 }