2 * Copyright © 2019 Bell Canada
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.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import io.swagger.annotations.ApiModelProperty
21 import org.hibernate.annotations.Proxy
22 import org.springframework.data.annotation.LastModifiedDate
23 import org.springframework.data.jpa.domain.support.AuditingEntityListener
24 import java.io.Serializable
26 import javax.persistence.*
29 * ResourceConfigSnapshot model
30 * Stores RUNNING or CANDIDATE resource configuration snapshots, captured during the execution
31 * of blueprints. A resource is identified by an identifier and a type.
33 * @author Serge Simard
36 @EntityListeners(AuditingEntityListener::class)
38 @Table(name = "RESOURCE_CONFIG_SNAPSHOT")
40 class ResourceConfigSnapshot : Serializable {
42 @get:ApiModelProperty(value = "Resource type.", required = true, example = "ServiceInstance, VfModule, VNF, PNF")
43 @Column(name = "resource_type", nullable = false)
44 var resourceType: String? = null
46 @get:ApiModelProperty(value = "ID associated with the resource type in the inventory system.", required = true)
47 @Column(name = "resource_id", nullable = false)
48 var resourceId: String? = null
50 @get:ApiModelProperty(value = "Status of the snapshot, either running or candidate.", required = true)
51 @Column(name = "status", nullable = false)
52 var status: Status? = null
54 @get:ApiModelProperty(value = "Snapshot of the resource as retrieved from resource.", required = true)
56 @Column(name = "config_snapshot", nullable = false)
57 var config_snapshot: String? = null
60 @Column(name = "resource_config_snapshot_id")
61 var id: String? = null
63 @get:ApiModelProperty(value = "Creation date of the snapshot.", required = true)
64 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
66 @Temporal(TemporalType.TIMESTAMP)
67 @Column(name = "creation_date")
68 var createdDate = Date()
71 private const val serialVersionUID = 1L
74 enum class Status(val state: String) {
76 CANDIDATE("CANDIDATE")