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.aai.introspection.sideeffect;
23 import org.openecomp.aai.exceptions.AAIException;
24 import org.openecomp.aai.introspection.Introspector;
25 import org.openecomp.aai.introspection.Wanderer;
26 import org.openecomp.aai.serialization.db.DBSerializer;
27 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
29 import java.io.UnsupportedEncodingException;
30 import java.lang.reflect.InvocationTargetException;
31 import java.net.URISyntaxException;
32 import java.util.List;
35 class SideEffectRunnerHelper implements Wanderer {
38 protected final TransactionalGraphEngine dbEngine;
39 protected final DBSerializer serializer;
40 protected final Set<Class<? extends SideEffect>> sideEffects;
41 protected SideEffectRunnerHelper(final TransactionalGraphEngine dbEngine, final DBSerializer serializer, final Set<Class<? extends SideEffect>> sideEffects) {
42 this.dbEngine = dbEngine;
43 this.serializer = serializer;
44 this.sideEffects = sideEffects;
47 private void runSideEffects(Introspector obj) throws AAIException {
48 for (Class<? extends SideEffect> se : sideEffects) {
50 se.getConstructor(Introspector.class, TransactionalGraphEngine.class, DBSerializer.class)
51 .newInstance(obj, dbEngine, serializer).execute();
52 } catch (UnsupportedEncodingException | InstantiationException | IllegalAccessException
53 | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException
54 | URISyntaxException e) {
55 throw new AAIException("strange exception", e);
60 public void processPrimitive(String propName, Introspector obj) {
61 // TODO Auto-generated method stub
66 public void processPrimitiveList(String propName, Introspector obj) {
67 // TODO Auto-generated method stub
72 public void processComplexObj(Introspector obj) throws AAIException {
79 public void modifyComplexList(List<Introspector> list, List<Object> listReference, Introspector parent,
81 // TODO Auto-generated method stub