2  * Copyright 2016 ZTE Corporation.
 
   4  * Licensed under the Apache License, Version 2.0 (the "License");
 
   5  * you may not use this file except in compliance with the License.
 
   6  * You may obtain a copy of the License at
 
   8  *     http://www.apache.org/licenses/LICENSE-2.0
 
  10  * Unless required by applicable law or agreed to in writing, software
 
  11  * distributed under the License is distributed on an "AS IS" BASIS,
 
  12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  13  * See the License for the specific language governing permissions and
 
  14  * limitations under the License.
 
  16 package org.openo.commontosca.catalog.model.parser.yaml.aria.entity;
 
  18 import java.util.HashMap;
 
  20 import java.util.Map.Entry;
 
  22 import lombok.AllArgsConstructor;
 
  24 import lombok.NoArgsConstructor;
 
  29 public class AriaParserResult {
 
  30   private Issue[] issues;
 
  31   private Instance instance = new Instance();
 
  32 //  private Type[] types;
 
  33 //  private Model model;
 
  36 //  public class Type {
 
  39 //  public class Model {
 
  44     private String message;
 
  45     private String location;
 
  47     private String column;
 
  48     private String snippet;
 
  49     private String exception;
 
  53   public class Instance {
 
  54     private String description;
 
  55     private Map<String, String> metadata;
 
  57     private Group[] groups;
 
  58     private Policy[] policies;
 
  59     private Substitution substitution;
 
  60     private Map<String, Input> inputs;
 
  61     private Map<String, Output> outpus;
 
  63     public Map<String, String> getMetadata() {
 
  64       if (this.metadata == null) {
 
  65         return new HashMap<>();
 
  74       private String type_name;
 
  75       private String template_name;
 
  76       private Map<String, Property> properties;
 
  77       private Interface[] interfaces;
 
  78       private Artifact[] artifacts;
 
  79       private Capability[] capabilities;
 
  80       private Relationship[] relationships;
 
  83       public class Artifact {
 
  85         private String type_name;
 
  86         private String source_path;
 
  87         private String target_path;
 
  88         private String repository_url;
 
  89         private Credential repository_credential;
 
  90         private Map<String, Property> properties;
 
  93         public class Credential {
 
  94           private String protocol;
 
  95           private String token_type;
 
  96           private Map<String, String> keys;
 
 102       public class Capability {
 
 104         private String type_name;
 
 105         private Map<String, Property> properties;
 
 109       public class Relationship {
 
 110         private String target_node_id;
 
 111         private String target_capability_name;
 
 112         private String type_name;
 
 113         private String template_name;
 
 114         private Map<String, Property> properties;
 
 115         private Interface[] source_interfaces;
 
 116         private Interface[] target_interfaces;
 
 122       public Map<String, Object> getPropertyAssignments() {
 
 123         if (this.properties == null || this.properties.isEmpty()) {
 
 124           return new HashMap<String, Object>();
 
 127         Map<String, Object> ret = new HashMap<String, Object>();
 
 128         for (Entry<String, Property> e : this.properties.entrySet()) {
 
 129           ret.put(e.getKey(), e.getValue().getValue());
 
 139       private String type_name;
 
 140       private String template_name;
 
 141       private Map<String, Property> properties;
 
 142       private Interface[] interfaces;
 
 143       private GroupPolicy[] policies;
 
 144       private String[] member_node_ids;
 
 147       public class GroupPolicy {
 
 149         private String type_name;
 
 150         private Map<String, Property> properties;
 
 151         private Trigger[] triggers;
 
 154         public class Trigger {
 
 156           private String implementation;
 
 157           private Map<String, Property> properties;
 
 165     public class Policy {
 
 167       private String type_name;
 
 168       private Map<String, Property> properties;
 
 169       private String[] target_node_ids;
 
 170       private String[] target_group_ids;
 
 174     public class Substitution {
 
 175       private String node_type_name;
 
 176       private Mapping[] requirement;
 
 177       private Mapping[] capabilities;
 
 180       public class Mapping {
 
 181         private String mapped_name;
 
 182         private String node_id;
 
 190       private String type_name;
 
 191       private Object value;
 
 192       private String description;
 
 196     public class Output {
 
 197       private String type_name;
 
 198       private Object value;
 
 199       private String description;
 
 208   private String type_name;
 
 209   private Object value;
 
 210   private String description;
 
 216   private String type_name;
 
 217   private Map<String, Property> inputs;
 
 218   private Operation[] operation;
 
 223     private String implementation;
 
 224     private String[] dependencies;
 
 225     private String executor;
 
 226     private int max_retries;
 
 227     private int retry_interval;
 
 228     private Map<String, Property> inputs;