2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.action.dao.types;
19 import com.datastax.driver.mapping.annotations.Column;
20 import com.datastax.driver.mapping.annotations.Frozen;
21 import com.datastax.driver.mapping.annotations.PartitionKey;
22 import com.datastax.driver.mapping.annotations.Table;
24 import java.util.Date;
26 import java.util.stream.Collectors;
29 import lombok.NoArgsConstructor;
31 import org.openecomp.core.utilities.json.JsonUtil;
32 import org.openecomp.sdc.action.types.Action;
33 import org.openecomp.sdc.versioning.dao.types.Version;
38 @Table(keyspace = "dox", name = "Action")
39 public class ActionEntity {
41 @Column(name = "actionUuId")
42 private String actionUuId;
43 @PartitionKey(value = 0)
44 @Column(name = "actionInvariantUuId")
45 private String actionInvariantUuId;
46 @PartitionKey(value = 1)
48 @Column(name = "version")
49 private Version version;
50 @Column(name = "status")
51 private String status;
52 @Column(name = "name")
54 @Column(name = "vendor_list")
55 private Set<String> vendorList;
56 @Column(name = "category_list")
57 private Set<String> categoryList;
58 @Column(name = "timestamp")
59 private Date timestamp;
60 @Column(name = "user")
62 @Column(name = "supportedModels")
63 private Set<String> supportedModels;
64 @Column(name = "supportedComponents")
65 private Set<String> supportedComponents;
66 @Column(name = "data")
69 public ActionEntity(String actionInvariantUuId, Version version) {
70 this.actionInvariantUuId = actionInvariantUuId;
71 this.version = version;
77 * @param vendorList the vendor list
79 public void setVendorList(Set<String> vendorList) {
80 this.vendorList = vendorList != null && !vendorList.isEmpty() ?
81 vendorList.stream().map(String::toLowerCase).collect(Collectors.toSet()) : vendorList;
87 * @param categoryList the category list
89 public void setCategoryList(Set<String> categoryList) {
90 this.categoryList = categoryList != null && !categoryList.isEmpty() ?
91 categoryList.stream().map(String::toLowerCase).collect(Collectors.toSet()) :
100 public Action toDto() {
101 Action destination = JsonUtil.json2Object(this.getData(), Action.class);
102 destination.setData(this.getData());
103 destination.setTimestamp(this.getTimestamp());
104 destination.setUser(this.getUser());
105 destination.setData(this.getData());