summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java
blob: d4dc7e0c4b5c3523b7658046b9c70d05b10125c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;

import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;

import java.util.Objects;

class VspZusammenUtil {

  static ZusammenElement aggregateElements(ZusammenElement... elements) {
    ZusammenElement head = null;
    ZusammenElement father = null;
    for (ZusammenElement element : elements) {
      if (Objects.isNull(head)) {
        head = father = element;
      } else {
        if (father != null) {
          father.getSubElements().add(element);
          father = element;
        }
      }
    }

    return head;
  }
}