[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / lib / openecomp-sdc-action-lib / openecomp-sdc-action-api / src / main / java / org / openecomp / sdc / action / types / OpenEcompComponent.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.action.types;
22
23 import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
24
25 public class OpenEcompComponent {
26
27   private String id;
28   private String name;
29
30   public OpenEcompComponent() {
31     //Default constructor
32   }
33
34   public OpenEcompComponent(String name, String id) {
35     this.name = name;
36     this.id = id;
37   }
38
39   public String getId() {
40     return id;
41   }
42
43   public void setId(String id) {
44     this.id = id;
45   }
46
47   public String getName() {
48     return name;
49   }
50
51   public void setName(String name) {
52     this.name = name;
53   }
54
55   /**
56    * To entity OPENECOMP component entity.
57    *
58    * @return the OPENECOMP component entity
59    */
60   public OpenEcompComponentEntity toEntity() {
61     OpenEcompComponentEntity destination = new OpenEcompComponentEntity();
62     destination.setId(this.getId());
63     destination.setName(this.getName());
64     return destination;
65   }
66
67   @Override
68   public int hashCode() {
69     final int prime = 31;
70     int result = 1;
71     result = prime * result + ((id == null) ? 0 : id.hashCode());
72     result = prime * result + ((name == null) ? 0 : name.hashCode());
73     return result;
74   }
75
76   @Override
77   public boolean equals(Object object) {
78     if (this == object) {
79       return true;
80     }
81     if (object == null) {
82       return false;
83     }
84     if (this.getClass() != object.getClass()) {
85       return false;
86     }
87     OpenEcompComponent obj = (OpenEcompComponent) object;
88     if (id == null) {
89       if (obj.id != null) {
90         return false;
91       }
92     } else if (!id.equals(obj.id)) {
93       return false;
94     }
95     if (name == null) {
96       if (obj.name != null) {
97         return false;
98       }
99     } else if (!name.equals(obj.name)) {
100       return false;
101     }
102     return true;
103   }
104 }