[AAI-2175] Change aai champ container processes to run as non-root on the host
[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 java.util.ArrayList;
24 import java.util.List;
25
26 import org.onap.aai.champcore.model.ChampField;
27 import org.onap.aai.champcore.model.ChampObject;
28 import org.onap.aai.champcore.model.ChampObjectIndex;
29 import org.onap.aai.champcore.model.fluent.BuildStep;
30 import org.onap.aai.champcore.model.fluent.index.CreateObjectIndexable;
31 import org.onap.aai.champcore.model.fluent.index.ObjectIndexFieldStep;
32 import org.onap.aai.champcore.model.fluent.index.ObjectIndexTypeStep;
33
34 public final class CreateObjectIndexableImpl implements CreateObjectIndexable {
35
36         @Override
37         public ObjectIndexTypeStep ofName(String name) {
38                 return new ObjectIndexTypeStep() {
39
40                         @Override
41                         public ObjectIndexFieldStep onType(String objectType) {
42                                 return new ObjectIndexFieldStep() {
43
44                                         @Override
45                                         public BuildStep<ChampObjectIndex> forFields(List<String> fieldNames) {
46                                                 return new BuildStep<ChampObjectIndex> () {
47
48                                                         @Override
49                                                         public ChampObjectIndex build() {
50                                                             List<ChampField> fields = new ArrayList<ChampField>();
51                                                             for (String fn : fieldNames) {
52                                                                 fields.add(new ChampField.Builder(fn).build());
53                                                             }
54                                                                 return new ChampObjectIndex.Builder(
55                                                                         name, objectType, fields).build();
56                                                         }
57                                                 };
58                                         }
59                                 };
60                         }
61
62                         @Override
63                         public ObjectIndexFieldStep onAnyType() {
64                                 return new ObjectIndexFieldStep() {
65
66                                         @Override
67                                         public BuildStep<ChampObjectIndex> forFields(List<String> fieldNames) {
68                                                 return new BuildStep<ChampObjectIndex> () {
69
70                                                         @Override
71                                                         public ChampObjectIndex build() {
72                                                             List<ChampField> fields = new ArrayList<ChampField>();
73                                 for (String fn : fieldNames) {
74                                     fields.add(new ChampField.Builder(fn).build());
75                                 }
76                                                                 return new ChampObjectIndex.Builder(
77                                                                         name, ChampObject.ReservedTypes.ANY.toString(), fields).build();
78                                                         }
79                                                 };
80                                         }
81                                 };
82                         }
83                 };
84         }
85 }