a5025e5de86edb5f623e7e55d76543337cb24a20
[sdc.git] /
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.dao.types;
22
23 import com.datastax.driver.mapping.annotations.Column;
24 import com.datastax.driver.mapping.annotations.PartitionKey;
25 import com.datastax.driver.mapping.annotations.Table;
26 import org.openecomp.sdc.action.types.OpenEcompComponent;
27
28 @Table(keyspace = "dox", name = "EcompComponent")
29 public class OpenEcompComponentEntity {
30
31   @PartitionKey
32   @Column(name = "id")
33   private String id;
34
35   @Column(name = "name")
36   private String name;
37
38   /**
39    * Every entity class must have a default constructor according to
40    * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
41    * Definition of mapped classes</a>.
42    */
43   public OpenEcompComponentEntity() {
44     // Don't delete! Default constructor is required by DataStax driver
45   }
46
47   public OpenEcompComponentEntity(String id, String name) {
48     this.id = id;
49     this.name = name;
50   }
51
52   public String getId() {
53     return id;
54   }
55
56   public void setId(String id) {
57     this.id = id;
58   }
59
60   public String getName() {
61     return name;
62   }
63
64   public void setName(String name) {
65     this.name = name;
66   }
67
68   /**
69    * To dto OPENECOMP component.
70    *
71    * @return the OPENECOMP component
72    */
73   public OpenEcompComponent toDto() {
74     OpenEcompComponent destination = new OpenEcompComponent();
75     destination.setId(this.getId());
76     destination.setName(this.getName());
77     return destination;
78   }
79 }