5075f485aa3669851f88a1b4cac296929e099518
[vfc/nfvo/catalog.git] /
1 /**\r
2  * Copyright 2016 [ZTE] and others.\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 package org.openo.commontosca.catalog.model.parser.yaml.entity;\r
18 \r
19 import com.google.gson.Gson;\r
20 import com.google.gson.JsonArray;\r
21 import com.google.gson.JsonElement;\r
22 import com.google.gson.JsonObject;\r
23 import com.google.gson.annotations.SerializedName;\r
24 \r
25 import java.util.ArrayList;\r
26 import java.util.HashMap;\r
27 import java.util.Iterator;\r
28 import java.util.List;\r
29 import java.util.Map;\r
30 import java.util.Map.Entry;\r
31 \r
32 \r
33 public class ParseYamlResult {\r
34   private String toscaDefinitionsVersion;\r
35   private String description;\r
36   private JsonObject nodeTypes;\r
37   private JsonObject capabilityTypes;\r
38   private JsonObject relationshipTypes;\r
39   private JsonObject policyTypes;\r
40   private TopologyTemplate topologyTemplate;\r
41   private Map<String, String> metadata;\r
42   private JsonObject plans;\r
43 \r
44 \r
45   public String getToscaDefinitionsVersion() {\r
46     return toscaDefinitionsVersion;\r
47   }\r
48 \r
49   public void setToscaDefinitionsVersion(String toscaDefinitionsVersion) {\r
50     this.toscaDefinitionsVersion = toscaDefinitionsVersion;\r
51   }\r
52 \r
53   public String getDescription() {\r
54     return description;\r
55   }\r
56 \r
57   public void setDescription(String description) {\r
58     this.description = description;\r
59   }\r
60 \r
61   public JsonObject getNodeTypes() {\r
62     return nodeTypes;\r
63   }\r
64 \r
65   public void setNodeTypes(JsonObject nodeTypes) {\r
66     this.nodeTypes = nodeTypes;\r
67   }\r
68 \r
69   public List<NodeType> getNodeTypeList() {\r
70     return jsonObject2NodeTypes(nodeTypes);\r
71   }\r
72 \r
73   private ArrayList<NodeType> jsonObject2NodeTypes(JsonObject nodeTypes) {\r
74     ArrayList<NodeType> nodeTypeList = new ArrayList<NodeType>();\r
75     Iterator<Entry<String, JsonElement>> iterator = nodeTypes.entrySet().iterator();\r
76     while (iterator.hasNext()) {\r
77       NodeType type = new NodeType();\r
78       Entry<String, JsonElement> next = iterator.next();\r
79       type.setType(next.getKey());\r
80       type.setValue(new Gson().fromJson(next.getValue(), NodeType.NodeTypeValue.class));\r
81       nodeTypeList.add(type);\r
82     }\r
83     return nodeTypeList;\r
84   }\r
85 \r
86   public JsonObject getCapabilityTypes() {\r
87     return capabilityTypes;\r
88   }\r
89 \r
90   public void setCapabilityTypes(JsonObject capabilityTypes) {\r
91     this.capabilityTypes = capabilityTypes;\r
92   }\r
93 \r
94   public JsonObject getRelationshipTypes() {\r
95     return relationshipTypes;\r
96   }\r
97 \r
98   public void setRelationshipTypes(JsonObject relationshipTypes) {\r
99     this.relationshipTypes = relationshipTypes;\r
100   }\r
101 \r
102   public List<RelationshipType> getRelationshipTypeList() {\r
103     return jsonObject2RelationshipTypes(relationshipTypes);\r
104   }\r
105 \r
106   private ArrayList<RelationshipType> jsonObject2RelationshipTypes(JsonObject relationshipTypes) {\r
107     ArrayList<RelationshipType> relationshipTypeList = new ArrayList<RelationshipType>();\r
108     Iterator<Entry<String, JsonElement>> iterator = relationshipTypes.entrySet().iterator();\r
109     while (iterator.hasNext()) {\r
110       RelationshipType type = new RelationshipType();\r
111       Entry<String, JsonElement> next = iterator.next();\r
112       type.setType(next.getKey());\r
113       type.setValue(new Gson().fromJson(next.getValue(), RelationshipType.RelationshipValue.class));\r
114       relationshipTypeList.add(type);\r
115     }\r
116     return relationshipTypeList;\r
117   }\r
118 \r
119   public JsonObject getPolicyTypes() {\r
120     return policyTypes;\r
121   }\r
122 \r
123   public void setPolicyTypes(JsonObject policyTypes) {\r
124     this.policyTypes = policyTypes;\r
125   }\r
126 \r
127   public TopologyTemplate getTopologyTemplate() {\r
128     return topologyTemplate;\r
129   }\r
130 \r
131   public void setTopologyTemplate(TopologyTemplate topologyTemplate) {\r
132     this.topologyTemplate = topologyTemplate;\r
133   }\r
134 \r
135   public Map<String, String> getMetadata() {\r
136     return metadata;\r
137   }\r
138 \r
139   public void setMetadata(Map<String, String> metadata) {\r
140     this.metadata = metadata;\r
141   }\r
142 \r
143   public JsonObject getPlans() {\r
144     return plans;\r
145   }\r
146 \r
147   public void setPlans(JsonObject plans) {\r
148     this.plans = plans;\r
149   }\r
150 \r
151   public List<Plan> getPlanList() {\r
152     return jsonObject2PlanList(this.plans);\r
153   }\r
154 \r
155   private List<Plan> jsonObject2PlanList(JsonObject plans) {\r
156     List<Plan> retList = new ArrayList<Plan>();\r
157     Iterator<Entry<String, JsonElement>> iterator = plans.entrySet().iterator();\r
158     while (iterator.hasNext()) {\r
159       Plan ret = new Plan();\r
160       Entry<String, JsonElement> next = iterator.next();\r
161       ret.setName(next.getKey());\r
162       ret.setValue(new Gson().fromJson(next.getValue(), Plan.PlanValue.class));\r
163       retList.add(ret);\r
164     }\r
165     return retList;\r
166   }\r
167 \r
168   public class TopologyTemplate {\r
169     private String description;\r
170     private List<Input> inputs;\r
171     private List<Output> outputs;\r
172     private List<NodeTemplate> nodeTemplates;\r
173     private SubstitutionMapping substitutionMappings;\r
174 \r
175     public String getDescription() {\r
176       return description;\r
177     }\r
178 \r
179     public void setDescription(String description) {\r
180       this.description = description;\r
181     }\r
182 \r
183     public List<Input> getInputs() {\r
184       return inputs;\r
185     }\r
186 \r
187     public void setInputs(List<Input> inputs) {\r
188       this.inputs = inputs;\r
189     }\r
190 \r
191     public List<Output> getOutputs() {\r
192       return outputs;\r
193     }\r
194 \r
195     public void setOutputs(List<Output> outputs) {\r
196       this.outputs = outputs;\r
197     }\r
198 \r
199     public List<NodeTemplate> getNodeTemplates() {\r
200       return nodeTemplates;\r
201     }\r
202 \r
203     public void setNodeTemplates(List<NodeTemplate> nodeTemplates) {\r
204       this.nodeTemplates = nodeTemplates;\r
205     }\r
206 \r
207     public SubstitutionMapping getSubstitutionMappings() {\r
208       return substitutionMappings;\r
209     }\r
210 \r
211     public void setSubstitutionMappings(SubstitutionMapping substitutionMappings) {\r
212       this.substitutionMappings = substitutionMappings;\r
213     }\r
214 \r
215     public class Input {\r
216       private String name;\r
217       private String type;\r
218       private String description;\r
219       private String defaultValue;\r
220       private boolean required;\r
221 \r
222       public String getName() {\r
223         return name;\r
224       }\r
225 \r
226       public void setName(String name) {\r
227         this.name = name;\r
228       }\r
229 \r
230       public String getType() {\r
231         return type;\r
232       }\r
233 \r
234       public void setType(String type) {\r
235         this.type = type;\r
236       }\r
237 \r
238       public String getDescription() {\r
239         return description;\r
240       }\r
241 \r
242       public void setDescription(String description) {\r
243         this.description = description;\r
244       }\r
245 \r
246       public String getDefault() {\r
247         return defaultValue;\r
248       }\r
249 \r
250       public void setDefault(String defaultValue) {\r
251         this.defaultValue = defaultValue;\r
252       }\r
253 \r
254       public boolean isRequired() {\r
255         return required;\r
256       }\r
257 \r
258       public void setRequired(boolean required) {\r
259         this.required = required;\r
260       }\r
261     }\r
262 \r
263     public class Output {\r
264       private String name;\r
265       private String description;\r
266       private Object value;\r
267 \r
268       public String getName() {\r
269         return name;\r
270       }\r
271 \r
272       public void setName(String name) {\r
273         this.name = name;\r
274       }\r
275 \r
276       public String getDescription() {\r
277         return description;\r
278       }\r
279 \r
280       public void setDescription(String description) {\r
281         this.description = description;\r
282       }\r
283 \r
284       public Object getValue() {\r
285         return value;\r
286       }\r
287 \r
288       public void setValue(Object value) {\r
289         this.value = value;\r
290       }\r
291     }\r
292 \r
293     public class NodeTemplate {\r
294       private String name;\r
295       private String nodeType;\r
296       private JsonObject properties;\r
297       private JsonObject[] requirements;\r
298       private JsonObject capabilities;\r
299       private List<Relationship> relationships;\r
300 \r
301       public String getName() {\r
302         return name;\r
303       }\r
304 \r
305       public void setName(String name) {\r
306         this.name = name;\r
307       }\r
308 \r
309       public String getNodeType() {\r
310         return nodeType;\r
311       }\r
312 \r
313       public void setNodeType(String nodeType) {\r
314         this.nodeType = nodeType;\r
315       }\r
316 \r
317       public JsonObject getProperties() {\r
318         return properties;\r
319       }\r
320 \r
321       public void setProperties(JsonObject properties) {\r
322         this.properties = properties;\r
323       }\r
324 \r
325       public Map<String, Object> getPropertyList() {\r
326         return jsonObject2Properties(properties);\r
327       }\r
328 \r
329       private Map<String, Object> jsonObject2Properties(JsonObject properties) {\r
330         Map<String, Object> ret = new HashMap<>();\r
331         Iterator<Entry<String, JsonElement>> iterator = properties.entrySet().iterator();\r
332         while (iterator.hasNext()) {\r
333           Entry<String, JsonElement> next = iterator.next();\r
334           ret.put(next.getKey(), next.getValue().getAsString());\r
335         }\r
336         return ret;\r
337       }\r
338 \r
339       public JsonObject[] getRequirements() {\r
340         return requirements;\r
341       }\r
342 \r
343       public void setRequirements(JsonObject[] requirements) {\r
344         this.requirements = requirements;\r
345       }\r
346 \r
347       public JsonObject getCapabilities() {\r
348         return capabilities;\r
349       }\r
350 \r
351       public void setCapabilities(JsonObject capabilities) {\r
352         this.capabilities = capabilities;\r
353       }\r
354 \r
355       public List<Relationship> getRelationships() {\r
356         return relationships;\r
357       }\r
358 \r
359       public void setRelationships(List<Relationship> relationships) {\r
360         this.relationships = relationships;\r
361       }\r
362 \r
363       /**\r
364        * get scalable.\r
365        * @return NodeTemplateScalable\r
366        */\r
367       public NodeTemplateScalable getScalable() {\r
368         if (capabilities == null) {\r
369           return null;\r
370         }\r
371         JsonElement scaleableJson = capabilities.get("scalable");\r
372         if (scaleableJson == null || !scaleableJson.isJsonObject()) {\r
373           return null;\r
374         }\r
375         JsonElement propertyJson = scaleableJson.getAsJsonObject().get("properties");\r
376         if (propertyJson == null || !propertyJson.isJsonObject()) {\r
377           return null;\r
378         }\r
379 \r
380         NodeTemplateScalable scalable = new NodeTemplateScalable();\r
381         scalable\r
382             .setMin_instances(propertyJson.getAsJsonObject().get("min_instances").getAsString());\r
383         scalable\r
384             .setMax_instances(propertyJson.getAsJsonObject().get("max_instances").getAsString());\r
385         scalable.setDefault_instances(\r
386             propertyJson.getAsJsonObject().get("default_instances").getAsString());\r
387         return scalable;\r
388       }\r
389 \r
390       public class Relationship {\r
391         private String targetNodeName;\r
392         private String type;\r
393         private String sourceNodeName;\r
394 \r
395         public String getTargetNodeName() {\r
396           return targetNodeName;\r
397         }\r
398 \r
399         public void setTargetNodeName(String targetNodeName) {\r
400           this.targetNodeName = targetNodeName;\r
401         }\r
402 \r
403         public String getType() {\r
404           return type;\r
405         }\r
406 \r
407         public void setType(String type) {\r
408           this.type = type;\r
409         }\r
410 \r
411         public String getSourceNodeName() {\r
412           return sourceNodeName;\r
413         }\r
414 \r
415         public void setSourceNodeName(String sourceNodeName) {\r
416           this.sourceNodeName = sourceNodeName;\r
417         }\r
418       }\r
419 \r
420       public class NodeTemplateScalable {\r
421         private String minInstances;\r
422         private String maxInstances;\r
423         private String defaultInstances;\r
424 \r
425         public String getMin_instances() {\r
426           return minInstances;\r
427         }\r
428 \r
429         public void setMin_instances(String minInstances) {\r
430           this.minInstances = minInstances;\r
431         }\r
432 \r
433         public String getMax_instances() {\r
434           return maxInstances;\r
435         }\r
436 \r
437         public void setMax_instances(String maxInstances) {\r
438           this.maxInstances = maxInstances;\r
439         }\r
440 \r
441         public String getDefault_instances() {\r
442           return defaultInstances;\r
443         }\r
444 \r
445         public void setDefault_instances(String defaultInstances) {\r
446           this.defaultInstances = defaultInstances;\r
447         }\r
448       }\r
449     }\r
450 \r
451     public class SubstitutionMapping {\r
452       private String nodeType;\r
453       private JsonObject requirements;\r
454       private JsonObject capabilities;\r
455       private JsonObject properties;\r
456 \r
457       public String getNodeType() {\r
458         return nodeType;\r
459       }\r
460 \r
461       public void setNodeType(String nodeType) {\r
462         this.nodeType = nodeType;\r
463       }\r
464 \r
465       public JsonObject getRequirements() {\r
466         return requirements;\r
467       }\r
468 \r
469       public void setRequirements(JsonObject requirements) {\r
470         this.requirements = requirements;\r
471       }\r
472 \r
473       public Map<String, String[]> getRequirementList() {\r
474         return jsonObjects2Requirements(this.requirements);\r
475       }\r
476 \r
477       private Map<String, String[]> jsonObjects2Requirements(JsonObject requirements) {\r
478         Map<String, String[]> ret = new HashMap<String, String[]>();\r
479 \r
480         Iterator<Entry<String, JsonElement>> iterator = requirements.entrySet().iterator();\r
481         while (iterator.hasNext()) {\r
482           Entry<String, JsonElement> next = iterator.next();\r
483           if (next.getValue().isJsonPrimitive() || next.getValue().isJsonObject()) {\r
484             ret.put(next.getKey(), new String[] {next.getValue().getAsString()});\r
485             continue;\r
486           }\r
487 \r
488           if (next.getValue().isJsonArray()) {\r
489             String[] value = parseListValue((JsonArray) next.getValue());\r
490             ret.put(next.getKey(), value);\r
491           }\r
492         }\r
493 \r
494         return ret;\r
495       }\r
496 \r
497       private String[] parseListValue(JsonArray jsonArray) {\r
498         String[] value = new String[jsonArray.size()];\r
499         for (int i = 0, size = jsonArray.size(); i < size; i++) {\r
500           value[i] = jsonArray.get(i).getAsString();\r
501         }\r
502         return value;\r
503       }\r
504 \r
505       public JsonObject getCapabilities() {\r
506         return capabilities;\r
507       }\r
508 \r
509       public void setCapabilities(JsonObject capabilities) {\r
510         this.capabilities = capabilities;\r
511       }\r
512 \r
513       public Map<String, String[]> getCapabilityList() {\r
514         return jsonObject2Capabilities(this.capabilities);\r
515       }\r
516 \r
517       private Map<String, String[]> jsonObject2Capabilities(JsonObject capabilities) {\r
518         Map<String, String[]> ret = new HashMap<String, String[]>();\r
519 \r
520         Iterator<Entry<String, JsonElement>> iterator = capabilities.entrySet().iterator();\r
521         while (iterator.hasNext()) {\r
522           Entry<String, JsonElement> next = iterator.next();\r
523 \r
524           if (next.getValue().isJsonPrimitive() || next.getValue().isJsonObject()) {\r
525             ret.put(next.getKey(), new String[] {next.getValue().getAsString()});\r
526             continue;\r
527           }\r
528 \r
529           if (next.getValue().isJsonArray()) {\r
530             String[] value = parseListValue((JsonArray) next.getValue());\r
531             ret.put(next.getKey(), value);\r
532           }\r
533         }\r
534 \r
535         return ret;\r
536       }\r
537 \r
538       public JsonObject getProperties() {\r
539         return properties;\r
540       }\r
541 \r
542       public void setProperties(JsonObject properties) {\r
543         this.properties = properties;\r
544       }\r
545 \r
546       public Map<String, Object> getPropertyList() {\r
547         return jsonObject2Properties(properties);\r
548       }\r
549 \r
550       private Map<String, Object> jsonObject2Properties(JsonObject properties) {\r
551         Map<String, Object> ret = new HashMap<>();\r
552         Iterator<Entry<String, JsonElement>> iterator = properties.entrySet().iterator();\r
553         while (iterator.hasNext()) {\r
554           Entry<String, JsonElement> next = iterator.next();\r
555           ret.put(next.getKey(), next.getValue().getAsString());\r
556         }\r
557         return ret;\r
558       }\r
559     }\r
560   }\r
561 \r
562 \r
563   public class RelationshipType {\r
564     private String type;\r
565     private RelationshipValue value;\r
566 \r
567     public String getType() {\r
568       return type;\r
569     }\r
570 \r
571     public void setType(String type) {\r
572       this.type = type;\r
573     }\r
574 \r
575     public RelationshipValue getValue() {\r
576       return value;\r
577     }\r
578 \r
579     public void setValue(RelationshipValue value) {\r
580       this.value = value;\r
581     }\r
582 \r
583     public class RelationshipValue {\r
584       private String derivedFrom;\r
585       private String[] validTargetTypes;\r
586 \r
587       public String getDerivedFrom() {\r
588         return derivedFrom;\r
589       }\r
590 \r
591       public void setDerivedFrom(String derivedFrom) {\r
592         this.derivedFrom = derivedFrom;\r
593       }\r
594 \r
595       public String[] getValid_target_types() {\r
596         return validTargetTypes;\r
597       }\r
598 \r
599       public void setValid_target_types(String[] validTargetTypes) {\r
600         this.validTargetTypes = validTargetTypes;\r
601       }\r
602     }\r
603   }\r
604 \r
605 \r
606   public class NodeType {\r
607     private String type;\r
608     private NodeTypeValue value;\r
609 \r
610     public String getType() {\r
611       return type;\r
612     }\r
613 \r
614     public void setType(String type) {\r
615       this.type = type;\r
616     }\r
617 \r
618     public NodeTypeValue getValue() {\r
619       return value;\r
620     }\r
621 \r
622     public void setValue(NodeTypeValue value) {\r
623       this.value = value;\r
624     }\r
625 \r
626     public class NodeTypeValue {\r
627       private String derivedFrom;\r
628       private JsonObject properties;\r
629       private JsonObject[] requirements;\r
630       private JsonObject capabilities;\r
631 \r
632       public String getDerivedFrom() {\r
633         return derivedFrom;\r
634       }\r
635 \r
636       public void setDerived_from(String derivedFrom) {\r
637         this.derivedFrom = derivedFrom;\r
638       }\r
639 \r
640       public JsonObject getProperties() {\r
641         return properties;\r
642       }\r
643 \r
644       public void setProperties(JsonObject properties) {\r
645         this.properties = properties;\r
646       }\r
647 \r
648       public List<NodeTypeProperty> getPropertyList() {\r
649         return jsonObject2Properties(properties);\r
650       }\r
651 \r
652       private List<NodeTypeProperty> jsonObject2Properties(JsonObject properties) {\r
653         List<NodeTypeProperty> propertieList = new ArrayList<NodeTypeProperty>();\r
654         Iterator<Entry<String, JsonElement>> iterator = properties.entrySet().iterator();\r
655         while (iterator.hasNext()) {\r
656           NodeTypeProperty type = new NodeTypeProperty();\r
657           Entry<String, JsonElement> next = iterator.next();\r
658           type.setKey(next.getKey());\r
659           type.setValue(new Gson().fromJson(next.getValue(), JsonObject.class));\r
660           propertieList.add(type);\r
661         }\r
662         return propertieList;\r
663       }\r
664 \r
665       public class NodeTypeProperty {\r
666         private String key;\r
667         private JsonObject value;\r
668 \r
669         public String getKey() {\r
670           return key;\r
671         }\r
672 \r
673         public void setKey(String key) {\r
674           this.key = key;\r
675         }\r
676 \r
677         /**\r
678          * get default value.\r
679          * @return default value\r
680          */\r
681         public String getDefaultValue() {\r
682           JsonElement defaultValue = value.get("default");\r
683           if (defaultValue == null || defaultValue.isJsonObject()) {\r
684             return "";\r
685           }\r
686 \r
687           return defaultValue.getAsString();\r
688         }\r
689 \r
690         public JsonObject getValue() {\r
691           return value;\r
692         }\r
693 \r
694         public void setValue(JsonObject value) {\r
695           this.value = value;\r
696         }\r
697       }\r
698 \r
699       public JsonObject[] getRequirements() {\r
700         return requirements;\r
701       }\r
702 \r
703       public void setRequirements(JsonObject[] requirements) {\r
704         this.requirements = requirements;\r
705       }\r
706 \r
707       public JsonObject getCapabilities() {\r
708         return capabilities;\r
709       }\r
710 \r
711       public void setCapabilities(JsonObject capabilities) {\r
712         this.capabilities = capabilities;\r
713       }\r
714     }\r
715   }\r
716 \r
717   public class Plan {\r
718     private String name;\r
719     private PlanValue value;\r
720 \r
721     public String getName() {\r
722       return name;\r
723     }\r
724 \r
725     public void setName(String name) {\r
726       this.name = name;\r
727     }\r
728 \r
729     public String getDescription() {\r
730       return value.getDescription();\r
731     }\r
732 \r
733     public String getReference() {\r
734       return value.getReference();\r
735     }\r
736 \r
737     public String getPlanLanguage() {\r
738       return value.getPlanLanguage();\r
739     }\r
740 \r
741     public List<PlanValue.PlanInput> getInputList() {\r
742       return value.getInputList();\r
743     }\r
744 \r
745     public PlanValue getValue() {\r
746       return value;\r
747     }\r
748 \r
749     public void setValue(PlanValue value) {\r
750       this.value = value;\r
751     }\r
752 \r
753     public class PlanValue {\r
754       private String description;\r
755       private String reference;\r
756       private String planLanguage;\r
757       private JsonObject inputs;\r
758 \r
759       public String getDescription() {\r
760         return description;\r
761       }\r
762 \r
763       public void setDescription(String description) {\r
764         this.description = description;\r
765       }\r
766 \r
767       public String getReference() {\r
768         return reference;\r
769       }\r
770 \r
771       public void setReference(String reference) {\r
772         this.reference = reference;\r
773       }\r
774 \r
775       public String getPlanLanguage() {\r
776         return planLanguage;\r
777       }\r
778 \r
779       public void setPlanLanguage(String planLanguage) {\r
780         this.planLanguage = planLanguage;\r
781       }\r
782 \r
783       public JsonObject getInputs() {\r
784         return inputs;\r
785       }\r
786 \r
787       public void setInputs(JsonObject inputs) {\r
788         this.inputs = inputs;\r
789       }\r
790 \r
791       public List<PlanInput> getInputList() {\r
792         return jsonObject2PlanInputList(inputs);\r
793 \r
794       }\r
795 \r
796       private List<PlanInput> jsonObject2PlanInputList(JsonObject inputs) {\r
797         List<PlanInput> retList = new ArrayList<PlanInput>();\r
798         Iterator<Entry<String, JsonElement>> iterator = inputs.entrySet().iterator();\r
799         while (iterator.hasNext()) {\r
800           PlanInput ret = new PlanInput();\r
801           Entry<String, JsonElement> next = iterator.next();\r
802           ret.setName(next.getKey());\r
803           ret.setValue(new Gson().fromJson(next.getValue(), PlanInput.PlanInputValue.class));\r
804           retList.add(ret);\r
805         }\r
806         return retList;\r
807       }\r
808 \r
809       public class PlanInput {\r
810         private String name;\r
811         private PlanInputValue value;\r
812 \r
813         public String getName() {\r
814           return name;\r
815         }\r
816 \r
817         public void setName(String name) {\r
818           this.name = name;\r
819         }\r
820 \r
821         public String getType() {\r
822           return value.getType();\r
823         }\r
824 \r
825         public String getDescription() {\r
826           return value.getDescription();\r
827         }\r
828 \r
829         public String getDefault() {\r
830           return value.getDefaultValue();\r
831         }\r
832 \r
833         public boolean isRequired() {\r
834           return value.isRequired();\r
835         }\r
836 \r
837         public PlanInputValue getValue() {\r
838           return value;\r
839         }\r
840 \r
841         public void setValue(PlanInputValue value) {\r
842           this.value = value;\r
843         }\r
844 \r
845         public class PlanInputValue {\r
846           private String type;\r
847           private String description;\r
848           @SerializedName("default")\r
849           private String defaultValue;\r
850           private boolean required;\r
851 \r
852           public String getType() {\r
853             return type;\r
854           }\r
855 \r
856           public void setType(String type) {\r
857             this.type = type;\r
858           }\r
859 \r
860           public String getDescription() {\r
861             return description;\r
862           }\r
863 \r
864           public void setDescription(String description) {\r
865             this.description = description;\r
866           }\r
867 \r
868           public String getDefaultValue() {\r
869             return defaultValue;\r
870           }\r
871 \r
872           public void setDefaultValue(String defaultValue) {\r
873             this.defaultValue = defaultValue;\r
874           }\r
875 \r
876           public boolean isRequired() {\r
877             return required;\r
878           }\r
879 \r
880           public void setRequired(boolean required) {\r
881             this.required = required;\r
882           }\r
883         }\r
884       }\r
885     }\r
886   }\r
887 }\r