package org.zstack.header.storage.primary; import org.zstack.header.cluster.ClusterEO; import org.zstack.header.cluster.ClusterVO; import org.zstack.header.vo.ForeignKey; import org.zstack.header.vo.ForeignKey.ReferenceOption; import org.zstack.header.vo.SoftDeletionCascade; import org.zstack.header.vo.SoftDeletionCascades; import javax.persistence.*; import java.sql.Timestamp; @Entity @Table @SoftDeletionCascades({ @SoftDeletionCascade(parent = PrimaryStorageVO.class, joinColumn = "primaryStorageUuid"), @SoftDeletionCascade(parent = ClusterVO.class, joinColumn = "clusterUuid") }) public class PrimaryStorageClusterRefVO { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column private long id; @Column @ForeignKey(parentEntityClass = ClusterEO.class, onDeleteAction = ReferenceOption.CASCADE) private String clusterUuid; @Column @ForeignKey(parentEntityClass = PrimaryStorageEO.class, onDeleteAction = ReferenceOption.CASCADE) private String primaryStorageUuid; @Column private Timestamp createDate; @Column private Timestamp lastOpDate; @PreUpdate private void preUpdate() { lastOpDate = null; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getClusterUuid() { return clusterUuid; } public void setClusterUuid(String clusterUuid) { this.clusterUuid = clusterUuid; } public String getPrimaryStorageUuid() { return primaryStorageUuid; } public void setPrimaryStorageUuid(String primaryStorageUuid) { this.primaryStorageUuid = primaryStorageUuid; } public Timestamp getCreateDate() { return createDate; } public void setCreateDate(Timestamp createDate) { this.createDate = createDate; } public Timestamp getLastOpDate() { return lastOpDate; } public void setLastOpDate(Timestamp lastOpDate) { this.lastOpDate = lastOpDate; } }