2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 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=========================================================
20 package org.onap.aai.introspection.sideeffect;
22 import org.onap.aai.exceptions.AAIException;
23 import org.onap.aai.introspection.Introspector;
24 import org.onap.aai.introspection.Wanderer;
25 import org.onap.aai.serialization.db.DBSerializer;
26 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
28 import java.io.UnsupportedEncodingException;
29 import java.lang.reflect.InvocationTargetException;
30 import java.net.URISyntaxException;
31 import java.util.List;
34 class SideEffectRunnerHelper implements Wanderer {
37 protected final TransactionalGraphEngine dbEngine;
38 protected final DBSerializer serializer;
39 protected final Set<Class<? extends SideEffect>> sideEffects;
40 protected SideEffectRunnerHelper(final TransactionalGraphEngine dbEngine, final DBSerializer serializer, final Set<Class<? extends SideEffect>> sideEffects) {
41 this.dbEngine = dbEngine;
42 this.serializer = serializer;
43 this.sideEffects = sideEffects;
46 private void runSideEffects(Introspector obj) throws AAIException {
47 for (Class<? extends SideEffect> se : sideEffects) {
49 se.getConstructor(Introspector.class, TransactionalGraphEngine.class, DBSerializer.class)
50 .newInstance(obj, dbEngine, serializer).execute();
51 } catch (UnsupportedEncodingException | InstantiationException | IllegalAccessException
52 | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException
53 | URISyntaxException e) {
54 throw new AAIException("strange exception", e);
59 public void processPrimitive(String propName, Introspector obj) {
60 // TODO Auto-generated method stub
65 public void processPrimitiveList(String propName, Introspector obj) {
66 // TODO Auto-generated method stub
71 public void processComplexObj(Introspector obj) throws AAIException {
78 public void modifyComplexList(List<Introspector> list, List<Object> listReference, Introspector parent,
80 // TODO Auto-generated method stub