2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 package org.openecomp.sparky.synchronizer.entity;
28 import com.fasterxml.jackson.databind.ObjectMapper;
29 import com.fasterxml.jackson.databind.node.ObjectNode;
31 import java.util.ArrayList;
32 import java.util.List;
34 import org.json.JSONArray;
35 import org.json.JSONObject;
36 import org.openecomp.sparky.util.NodeUtils;
38 public class AggregationSuggestionEntity extends IndexableEntity implements IndexDocument {
40 private List<String> inputs = new ArrayList<String>();
41 private final String outputString = "VNFs";
42 protected ObjectMapper mapper = new ObjectMapper();
44 public AggregationSuggestionEntity() {
47 inputs.add("generic-vnfs");
51 public void deriveFields() {
52 this.id = NodeUtils.generateUniqueShaDigest(this.outputString);
56 public String getIndexDocumentJson() {
58 JSONArray inputArray = new JSONArray();
59 for (String input: inputs) {
60 input = input.replace(",","" );
61 input = input.replace("[","" );
62 input = input.replace("]","" );
63 inputArray.put(input);
66 JSONObject entitySuggest = new JSONObject();
67 entitySuggest.put("input", inputArray);
68 entitySuggest.put("output", this.outputString);
69 entitySuggest.put("weight", 100);
71 JSONObject payloadNode = new JSONObject();
72 entitySuggest.put("payload", payloadNode);
74 JSONObject rootNode = new JSONObject();
75 rootNode.put("entity_suggest", entitySuggest);
77 return rootNode.toString();
81 public ObjectNode getBulkImportEntity() {
82 // TODO Auto-generated method stub