2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.openecomp.types;
22 import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
23 import com.amdocs.zusammen.datatypes.Id;
24 import com.amdocs.zusammen.datatypes.item.Action;
25 import com.amdocs.zusammen.datatypes.item.Info;
26 import com.amdocs.zusammen.datatypes.item.Relation;
27 import com.amdocs.zusammen.utils.fileutils.FileUtils;
29 import java.io.InputStream;
30 import java.util.ArrayList;
31 import java.util.Collection;
34 public class AsdcElement implements Element {
38 private String description;
40 private Map<String, Object> properties;
42 private Collection<Relation> relations;
43 private Collection<Element> subElements = new ArrayList<>();
44 private Action action;
48 public Action getAction() {
53 public Id getElementId() {
54 return this.elementId;
58 public Info getInfo() {
59 Info info = new Info();
60 info.setProperties(this.properties);
61 info.addProperty(ElementPropertyName.elementType.name(), this.type != null ? this.type : this.name);
62 info.setName(this.name);
63 info.setDescription(this.description);
69 public Collection<Relation> getRelations() {
70 return this.relations;
74 public InputStream getData() {
75 return FileUtils.toInputStream(this.data);
79 public InputStream getSearchableData() {
84 public InputStream getVisualization() {
90 public Collection<Element> getSubElements() {
91 return this.subElements;
94 public void setElementId(Id elementId) {
95 this.elementId = elementId;
98 public void setData(InputStream data) {
99 this.data = FileUtils.toByteArray(data);
102 public void setRelations(Collection<Relation> relations) {
103 this.relations = relations;
106 public void setSubElements(Collection<Element> subElements) {
107 this.subElements = subElements;
110 public void setAction(Action action) {
111 this.action = action;
114 public AsdcElement addSubElement(Element element) {
115 this.subElements.add(element);
119 public String getType() {
123 public void setType(String type) {
127 public String getName() {
131 public void setName(String name) {
135 public String getDescription() {
139 public void setDescription(String description) {
140 this.description = description;
143 public Map<String, Object> getProperties() {
147 public void setProperties(Map<String, Object> properties) {
148 this.properties = properties;