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.be.resources.data;
23 import com.datastax.driver.mapping.annotations.Column;
24 import com.datastax.driver.mapping.annotations.PartitionKey;
25 import com.datastax.driver.mapping.annotations.Table;
27 import java.nio.ByteBuffer;
28 import java.util.Date;
30 @Table(keyspace = "sdccomponent", name = "componentcache")
31 public class ComponentCacheData {
32 public final static String RRESOURCE_ID_FIELD = "resourceId";
34 public final static String SERVICE_NAME_FIELD = "serviceName";
35 public final static String SERVICE_VERSION_FIELD = "serviceVersion";
36 public final static String ARTIFACT_NAME_FIELD = "artifactName";
38 public final static String delim = ":";
45 private ByteBuffer data;
47 @Column(name = "modification_time")
48 private Date modificationTime;
53 @Column(name = "is_dirty")
54 private boolean isDirty;
56 @Column(name = "is_zipped")
57 private boolean isZipped;
59 public ComponentCacheData() {
63 public ComponentCacheData(String id, byte[] data, Date modificationTime, String type, boolean isDirty,
68 this.data = ByteBuffer.wrap(data.clone());
70 this.modificationTime = modificationTime;
72 this.isDirty = isDirty;
73 this.isZipped = isZipped;
76 public ComponentCacheData(String id) {
81 public ComponentCacheData(String artifactId, byte[] data) {
85 this.data = ByteBuffer.wrap(data.clone());
86 // this.data = data.clone();
90 public byte[] getDataAsArray() {
97 public void setDataAsArray(byte[] data) {
99 this.data = ByteBuffer.wrap(data.clone());
103 public ByteBuffer getData() {
107 public void setData(ByteBuffer data) {
109 this.data = data.duplicate();
113 public String getId() {
117 public void setId(String id) {
121 public Date getModificationTime() {
122 return modificationTime;
125 public void setModificationTime(Date modificationTime) {
126 this.modificationTime = modificationTime;
129 public String getType() {
133 public void setType(String type) {
137 public boolean getIsDirty() {
141 public void setIsDirty(boolean isDirty) {
142 this.isDirty = isDirty;
145 public boolean getIsZipped() {
149 public void setIsZipped(boolean isZipped) {
150 this.isZipped = isZipped;