コード例 #1
0
 private static void fillRequirementsMap(
     Map<String, Requirement> map,
     List<RequirementDefinition> elements,
     Collection<CSARDependency> dependencies,
     Map<String, Requirement> mapToMerge,
     IToscaElementFinder toscaElementFinder) {
   if (elements == null) {
     return;
   }
   for (RequirementDefinition requirement : elements) {
     Requirement toAddRequirement = MapUtils.getObject(mapToMerge, requirement.getId());
     if (toAddRequirement == null) {
       toAddRequirement = new Requirement();
       toAddRequirement.setType(requirement.getType());
       IndexedCapabilityType indexedReq =
           toscaElementFinder.getElementInDependencies(
               IndexedCapabilityType.class, requirement.getType(), dependencies);
       if (indexedReq != null && indexedReq.getProperties() != null) {
         toAddRequirement.setProperties(
             PropertyUtil.getDefaultPropertyValuesFromPropertyDefinitions(
                 indexedReq.getProperties()));
       }
     }
     map.put(requirement.getId(), toAddRequirement);
   }
 }
コード例 #2
0
 private static void fillCapabilitiesMap(
     Map<String, Capability> map,
     List<CapabilityDefinition> elements,
     Collection<CSARDependency> dependencies,
     Map<String, Capability> mapToMerge,
     IToscaElementFinder toscaElementFinder) {
   if (elements == null) {
     return;
   }
   for (CapabilityDefinition capa : elements) {
     Capability toAddCapa = MapUtils.getObject(mapToMerge, capa.getId());
     if (toAddCapa == null) {
       toAddCapa = new Capability();
       toAddCapa.setType(capa.getType());
       IndexedCapabilityType indexedCapa =
           toscaElementFinder.getElementInDependencies(
               IndexedCapabilityType.class, capa.getType(), dependencies);
       if (indexedCapa != null && indexedCapa.getProperties() != null) {
         toAddCapa.setProperties(
             PropertyUtil.getDefaultPropertyValuesFromPropertyDefinitions(
                 indexedCapa.getProperties()));
       }
     }
     map.put(capa.getId(), toAddCapa);
   }
 }