2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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=========================================================
21 package org.openecomp.sdc.be.components.distribution.engine;
23 import java.util.List;
24 import java.util.Optional;
26 import org.openecomp.sdc.be.model.GroupDefinition;
27 import org.openecomp.sdc.be.model.GroupProperty;
28 import org.openecomp.sdc.common.api.Constants;
30 public class VfModuleArtifactPayload {
31 public VfModuleArtifactPayload(GroupDefinition group) {
32 vfModuleModelName = group.getName();
33 vfModuleModelInvariantUUID = group.getInvariantUUID();
34 vfModuleModelVersion = group.getVersion();
35 vfModuleModelUUID = group.getGroupUUID();
36 vfModuleModelDescription = group.getDescription();
38 artifacts = group.getArtifactsUuid();
39 // Base Value is set from properties
44 private void setBaseValue(GroupDefinition group) {
45 if (group.getProperties() != null) {
46 Optional<GroupProperty> findBaseProperty = group.getProperties().stream().filter(p -> p.getName().equals(Constants.IS_BASE)).findAny();
47 if (findBaseProperty.isPresent()) {
48 isBase = Boolean.valueOf(findBaseProperty.get().getValue());
54 private String vfModuleModelName, vfModuleModelInvariantUUID, vfModuleModelVersion, vfModuleModelUUID, vfModuleModelDescription;
55 private Boolean isBase;
56 private List<String> artifacts;
58 public List<String> getArtifacts() {
62 public void setArtifacts(List<String> artifacts) {
63 this.artifacts = artifacts;
66 public static int compareByGroupName(VfModuleArtifactPayload art1, VfModuleArtifactPayload art2) {
67 Integer thisCounter = Integer.parseInt(art1.vfModuleModelName.split(Constants.MODULE_NAME_DELIMITER)[1]);
68 Integer otherCounter = Integer.parseInt(art2.vfModuleModelName.split(Constants.MODULE_NAME_DELIMITER)[1]);
69 return thisCounter.compareTo(otherCounter);