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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
28 import java.math.BigDecimal;
29 import java.util.logging.Logger;
31 @JsonIgnoreProperties(ignoreUnknown = true)
32 public class CldsAsdcResourceBasicInfo implements Comparable<CldsAsdcResourceBasicInfo> {
33 private static final Logger logger = Logger.getLogger(CldsAsdcServiceInfo.class.getName());
36 private String invariantUUID;
38 private String version;
39 private String toscaModelURL;
40 private String category;
41 private String subCategory;
42 private String resourceType;
43 private String lifecycleState;
44 private String lastUpdaterUserId;
47 public int compareTo(CldsAsdcResourceBasicInfo in) {
48 // Compares this object with the specified object for order.
49 // Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
50 // first compare based on name
51 int rtn = name.compareToIgnoreCase(in.name);
54 BigDecimal myVersion = convertVersion(version);
55 BigDecimal inVersion = convertVersion(in.version);
56 rtn = myVersion.compareTo(inVersion);
62 * Convert version String into a BigDecimal
67 private BigDecimal convertVersion(String version) {
68 BigDecimal rtn = new BigDecimal(0.0);
70 rtn = new BigDecimal(version);
71 } catch (NumberFormatException nfe) {
72 logger.warning("ASDC version=" + version + " is not decimal for name=" + name);
77 public String getUuid() {
81 public void setUuid(String uuid) {
85 public String getInvariantUUID() {
89 public void setInvariantUUID(String invariantUUID) {
90 this.invariantUUID = invariantUUID;
93 public String getName() {
97 public void setName(String name) {
101 public String getVersion() {
105 public void setVersion(String version) {
106 this.version = version;
109 public String getToscaModelURL() {
110 return toscaModelURL;
113 public void setToscaModelURL(String toscaModelURL) {
114 this.toscaModelURL = toscaModelURL;
117 public String getCategory() {
121 public void setCategory(String category) {
122 this.category = category;
125 public String getSubCategory() {
129 public void setSubCategory(String subCategory) {
130 this.subCategory = subCategory;
133 public String getResourceType() {
137 public void setResourceType(String resourceType) {
138 this.resourceType = resourceType;
141 public String getLifecycleState() {
142 return lifecycleState;
145 public void setLifecycleState(String lifecycleState) {
146 this.lifecycleState = lifecycleState;
149 public String getLastUpdaterUserId() {
150 return lastUpdaterUserId;
153 public void setLastUpdaterUserId(String lastUpdaterUserId) {
154 this.lastUpdaterUserId = lastUpdaterUserId;
157 public Logger getLOGGER() {