2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 package org.onap.clamp.clds.model;
26 import java.math.BigDecimal;
27 import java.util.logging.Logger;
29 public class CldsAsdcServiceInfo implements Comparable<CldsAsdcServiceInfo> {
30 private static final Logger logger = Logger.getLogger(CldsAsdcServiceInfo.class.getName());
33 private String invariantUUID;
35 private String version;
36 private String toscaModelURL;
37 private String category;
38 private String lifecycleState;
39 private String lastUpdaterUserId;
40 private String distributionStatus;
42 public String getUuid() {
46 public void setUuid(String uuid) {
50 public String getInvariantUUID() {
54 public void setInvariantUUID(String invariantUUID) {
55 this.invariantUUID = invariantUUID;
58 public String getName() {
62 public void setName(String name) {
66 public String getVersion() {
70 public void setVersion(String version) {
71 this.version = version;
74 public String getToscaModelURL() {
78 public void setToscaModelURL(String toscaModelURL) {
79 this.toscaModelURL = toscaModelURL;
82 public String getCategory() {
86 public void setCategory(String category) {
87 this.category = category;
90 public String getLifecycleState() {
91 return lifecycleState;
94 public void setLifecycleState(String lifecycleState) {
95 this.lifecycleState = lifecycleState;
98 public String getLastUpdaterUserId() {
99 return lastUpdaterUserId;
102 public void setLastUpdaterUserId(String lastUpdaterUserId) {
103 this.lastUpdaterUserId = lastUpdaterUserId;
106 public String getDistributionStatus() {
107 return distributionStatus;
110 public void setDistributionStatus(String distributionStatus) {
111 this.distributionStatus = distributionStatus;
115 * Compare using name and then version. Version is converted to a decimal.
118 public int compareTo(CldsAsdcServiceInfo in) {
119 // Compares this object with the specified object for order.
120 // Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
121 // first compare based on name
122 int rtn = name.compareToIgnoreCase(in.name);
125 BigDecimal myVersion = convertVersion(version);
126 BigDecimal inVersion = convertVersion(in.version);
127 rtn = myVersion.compareTo(inVersion);
134 * Convert version String into a BigDecimal
139 private BigDecimal convertVersion(String versionText) {
141 return new BigDecimal(versionText);
142 } catch (NumberFormatException nfe) {
143 logger.warning("ASDC version=" + versionText + " is not decimal for name=" + name);
145 return new BigDecimal(0.0);