2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.vendorsoftwareproduct.dao.type;
23 import com.datastax.driver.mapping.annotations.*;
24 import lombok.EqualsAndHashCode;
26 import lombok.NoArgsConstructor;
28 import org.openecomp.core.utilities.json.JsonUtil;
29 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId;
30 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
31 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
32 import org.openecomp.sdc.versioning.dao.types.Version;
38 @Table(keyspace = "dox", name = "vsp_network")
39 public class NetworkEntity implements CompositionEntity {
40 private static final String ENTITY_TYPE = "Vendor Software Product Network";
43 @Column(name = "vsp_id")
45 @PartitionKey(value = 1)
47 private Version version;
49 @Column(name = "network_id")
51 @Column(name = "composition_data")
52 private String compositionData;
53 @Column(name = "questionnaire_data")
54 private String questionnaireData;
58 * Instantiates a new Network entity.
60 * @param vspId the vsp id
61 * @param version the version
64 public NetworkEntity(String vspId, Version version, String id) {
66 this.version = version;
71 public CompositionEntityType getType() {
72 return CompositionEntityType.network;
76 public CompositionEntityId getCompositionEntityId() {
77 return new CompositionEntityId(getId(), new CompositionEntityId(getVspId(), null));
81 public String getEntityType() {
86 public String getFirstClassCitizenId() {
90 public Network getNetworkCompositionData() {
91 return compositionData == null ? null : JsonUtil.json2Object(compositionData, Network.class);
94 public void setNetworkCompositionData(Network network) {
95 this.compositionData = network == null ? null : JsonUtil.object2Json(network);