c46d67307437a382f493b6e99c4b7aaa1dc98527
[portal/sdk.git] /
1 /*-
2  * ================================================================================
3  * eCOMP Portal SDK
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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  * ================================================================================
19  */
20 package org.openecomp.portalsdk.analytics.system.fusion.adapter;
21
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.Id;
26
27 import org.openecomp.portalsdk.core.domain.support.DomainVo;
28
29 /**
30  * <p>IdName.java</p>
31  * <p>Represents a id/name data object.</p>
32 */
33 @Entity
34 public class IdName extends DomainVo {
35
36     private String  name;
37     private   Long  id;
38
39     public IdName() {}
40
41     @Id
42     @GeneratedValue
43     @Column(name = "ID", unique = true, nullable = false)
44         public Long getId() {
45                 return id;
46         }
47
48         public void setId(Long id) {
49                 this.id = id;
50         }
51     
52     public String getName() {
53         return name;
54     }
55
56     public void setName(String name) {
57         this.name = name;
58     }
59
60     public int compareTo(Object obj){
61       String c1 = getName();
62       String c2 = ((IdName)obj).getName();
63
64       return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
65     }
66
67 }