Commit 05ed035b authored by Yiming Liu's avatar Yiming Liu

Update Entity

parent 6888ff73
package com.ctrip.apollo.biz.entity; package com.ctrip.apollo.biz.entity;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Entity @Entity
@Where(clause = "isDeleted = 0") public class App extends BaseEntity{
@SQLDelete(sql = "Update ReleaseSnapShot set isDeleted = 1 where id = ?")
public class ReleaseSnapshot {
@Id @Id
@GeneratedValue @GeneratedValue
private long id; private long id;
@Column(nullable = false) @Column(nullable = false)
private long releaseId; private String name;
@Column(nullable = false) @Column(nullable = false)
private String clusterName; private String appId;
@Column(nullable = false) @Column(nullable = false)
private String configurations; private String owner;
private boolean isDeleted; public String getAppId() {
return appId;
public ReleaseSnapshot() {
} }
public long getId() { public long getId() {
return id; return id;
} }
public void setId(long id) { public String getName() {
this.id = id; return name;
}
public long getReleaseId() {
return releaseId;
} }
public void setReleaseId(long releaseId) { public String getOwner() {
this.releaseId = releaseId; return owner;
} }
public String getClusterName() { public void setAppId(String appId) {
return clusterName; this.appId = appId;
} }
public void setClusterName(String clusterName) { public void setId(long id) {
this.clusterName = clusterName; this.id = id;
}
public String getConfigurations() {
return configurations;
}
public void setConfigurations(String configurations) {
this.configurations = configurations;
} }
public boolean isDeleted() { public void setName(String name) {
return isDeleted; this.name = name;
} }
public void setDeleted(boolean deleted) { public void setOwner(String owner) {
isDeleted = deleted; this.owner = owner;
} }
} }
package com.ctrip.apollo.biz.entity;
import java.util.Date;
import javax.persistence.Column;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@Where(clause = "isDeleted = 0")
@SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?")
public abstract class BaseEntity {
private boolean isDeleted;
@Column(name = "DataChange_CreatedBy")
private String dataChangeCreatedBy;
@Column(name = "DataChange_CreatedTime")
private Date dataChangeCreatedTime;
@Column(name = "DataChange_LastModifiedBy")
private String dataChangeLastModifiedBy;
@Column(name = "DataChange_LastTime")
private Date dataChangeLastModifiedTime;
public String getDataChangeCreatedBy() {
return dataChangeCreatedBy;
}
public Date getDataChangeCreatedTime() {
return dataChangeCreatedTime;
}
public String getDataChangeLastModifiedBy() {
return dataChangeLastModifiedBy;
}
public Date getDataChangeLastModifiedTime() {
return dataChangeLastModifiedTime;
}
public boolean isDeleted() {
return isDeleted;
}
public void setDataChangeCreatedBy(String dataChangeCreatedBy) {
this.dataChangeCreatedBy = dataChangeCreatedBy;
}
public void setDataChangeCreatedTime(Date dataChangeCreatedTime) {
this.dataChangeCreatedTime = dataChangeCreatedTime;
}
public void setDataChangeLastModifiedBy(String dataChangeLastModifiedBy) {
this.dataChangeLastModifiedBy = dataChangeLastModifiedBy;
}
public void setDataChangeLastModifiedTime(Date dataChangeLastModifiedTime) {
this.dataChangeLastModifiedTime = dataChangeLastModifiedTime;
}
public void setDeleted(boolean deleted) {
isDeleted = deleted;
}
}
package com.ctrip.apollo.biz.entity; package com.ctrip.apollo.biz.entity;
import com.ctrip.apollo.core.dto.ClusterDTO;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
...@@ -14,9 +9,8 @@ import javax.persistence.Id; ...@@ -14,9 +9,8 @@ import javax.persistence.Id;
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@Entity @Entity
@Where(clause = "isDeleted = 0") public class Cluster extends BaseEntity{
@SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?")
public class Cluster {
@Id @Id
@GeneratedValue @GeneratedValue
private long id; private long id;
...@@ -27,8 +21,9 @@ public class Cluster { ...@@ -27,8 +21,9 @@ public class Cluster {
@Column(nullable = false) @Column(nullable = false)
private String appId; private String appId;
private boolean isDeleted; @Column
private long clusterVersionId;
public Cluster() { public Cluster() {
} }
...@@ -56,19 +51,12 @@ public class Cluster { ...@@ -56,19 +51,12 @@ public class Cluster {
this.appId = appId; this.appId = appId;
} }
public boolean isDeleted() { public long getClusterVersionId() {
return isDeleted; return clusterVersionId;
} }
public void setDeleted(boolean deleted) { public void setClusterVersionId(long clusterVersionId) {
isDeleted = deleted; this.clusterVersionId = clusterVersionId;
} }
public ClusterDTO toDTO() {
ClusterDTO dto = new ClusterDTO();
dto.setAppId(appId);
dto.setId(id);
dto.setName(name);
return dto;
}
} }
package com.ctrip.apollo.biz.entity; package com.ctrip.apollo.biz.entity;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
@Entity @Entity
@Where(clause = "isDeleted = 0") public class ConfigItem extends BaseEntity {
@SQLDelete(sql = "Update ConfigItem set isDeleted = 1 where id = ?")
public class ConfigItem {
@Id @Id
@GeneratedValue @GeneratedValue
private long id; private long id;
@Column(nullable = false) @Column(nullable = false)
private long clusterId; private long groupId;
@Column(nullable = false)
private String clusterName;
@Column(nullable = false)
private String appId;
@Column(nullable = false) @Column(nullable = false)
private String key; private String key;
...@@ -37,21 +24,6 @@ public class ConfigItem { ...@@ -37,21 +24,6 @@ public class ConfigItem {
@Column @Column
private String comment; private String comment;
@Column(name = "DataChange_CreatedBy")
private String dataChangeCreatedBy;
@Column(name = "DataChange_CreatedTime")
private Date dataChangeCreatedTime;
@Column(name = "DataChange_LastModifiedBy")
private String dataChangeLastModifiedBy;
@Column(name = "DataChange_LastTime")
private Date dataChangeLastModifiedTime;
@Column
private boolean IsDeleted;
public long getId() { public long getId() {
return id; return id;
} }
...@@ -60,28 +32,12 @@ public class ConfigItem { ...@@ -60,28 +32,12 @@ public class ConfigItem {
this.id = id; this.id = id;
} }
public long getClusterId() { public long getGroupId() {
return clusterId; return groupId;
}
public void setClusterId(long clusterId) {
this.clusterId = clusterId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getAppId() {
return appId;
} }
public void setAppId(String appId) { public void setGroupId(long groupId) {
this.appId = appId; this.groupId = groupId;
} }
public String getKey() { public String getKey() {
...@@ -108,44 +64,4 @@ public class ConfigItem { ...@@ -108,44 +64,4 @@ public class ConfigItem {
this.comment = comment; this.comment = comment;
} }
public String getDataChangeCreatedBy() {
return dataChangeCreatedBy;
}
public void setDataChangeCreatedBy(String dataChangeCreatedBy) {
this.dataChangeCreatedBy = dataChangeCreatedBy;
}
public Date getDataChangeCreatedTime() {
return dataChangeCreatedTime;
}
public void setDataChangeCreatedTime(Date dataChangeCreatedTime) {
this.dataChangeCreatedTime = dataChangeCreatedTime;
}
public String getDataChangeLastModifiedBy() {
return dataChangeLastModifiedBy;
}
public void setDataChangeLastModifiedBy(String dataChangeLastModifiedBy) {
this.dataChangeLastModifiedBy = dataChangeLastModifiedBy;
}
public boolean isDeleted() {
return IsDeleted;
}
public void setDeleted(boolean isDeleted) {
IsDeleted = isDeleted;
}
public Date getDataChangeLastModifiedTime() {
return dataChangeLastModifiedTime;
}
public void setDataChangeLastModifiedTime(Date dataChangeLastModifiedTime) {
this.dataChangeLastModifiedTime = dataChangeLastModifiedTime;
}
} }
package com.ctrip.apollo.biz.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Group extends BaseEntity{
@Id
@GeneratedValue
private long id;
@Column(nullable = false)
private long clusterId;
@Column(nullable = false)
private long namespaceId;
public long getClusterId() {
return clusterId;
}
public long getId() {
return id;
}
public long getNamespaceId() {
return namespaceId;
}
public void setClusterId(long clusterId) {
this.clusterId = clusterId;
}
public void setId(long id) {
this.id = id;
}
public void setNamespaceId(long namespaceId) {
this.namespaceId = namespaceId;
}
}
package com.ctrip.apollo.biz.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Namespace extends BaseEntity{
@Id
@GeneratedValue
private long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String appId;
@Column
private String comment;
public String getAppId() {
return appId;
}
public String getComment() {
return comment;
}
public long getId() {
return id;
}
public String getName() {
return name;
}
public void setAppId(String appId) {
this.appId = appId;
}
public void setComment(String comment) {
this.comment = comment;
}
public void setId(long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
}
package com.ctrip.apollo.biz.entity; package com.ctrip.apollo.biz.entity;
import org.hibernate.annotations.SQLDelete; import javax.persistence.Column;
import org.hibernate.annotations.Where;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Lob;
/** /**
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@Entity @Entity
@Where(clause = "isDeleted = 0") public class Release extends BaseEntity{
@SQLDelete(sql = "Update Release set isDeleted = 1 where id = ?")
public class Release {
@Id @Id
@GeneratedValue @GeneratedValue
private long id; private long id;
@Column(nullable = false)
private String name; private String name;
private String appId;
@Column(nullable = false)
private long groupId;
@Column(nullable = false)
@Lob
private String configurations;
@Column(nullable = false)
private String comment; private String comment;
private boolean isDeleted;
public Release() { public Release() {
} }
public long getId() { public long getGroupId() {
return id; return groupId;
}
public void setId(long id) {
this.id = id;
} }
public String getName() { public String getComment() {
return name; return comment;
} }
public void setName(String name) { public String getConfigurations() {
this.name = name; return configurations;
} }
public String getAppId() { public long getId() {
return appId; return id;
} }
public void setAppId(String appId) { public String getName() {
this.appId = appId; return name;
} }
public String getComment() { public void setGroupId(long groupId) {
return comment; this.groupId = groupId;
} }
public void setComment(String comment) { public void setComment(String comment) {
this.comment = comment; this.comment = comment;
} }
public boolean isDeleted() { public void setConfigurations(String configurations) {
return isDeleted; this.configurations = configurations;
} }
public void setDeleted(boolean deleted) { public void setId(long id) {
isDeleted = deleted; this.id = id;
}
public void setName(String name) {
this.name = name;
} }
} }
package com.ctrip.apollo.biz.entity; package com.ctrip.apollo.biz.entity;
import org.hibernate.annotations.SQLDelete; import java.util.List;
import org.hibernate.annotations.Where;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -12,9 +11,7 @@ import javax.persistence.Id; ...@@ -12,9 +11,7 @@ import javax.persistence.Id;
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@Entity @Entity
@Where(clause = "isDeleted = 0") public class Version extends BaseEntity {
@SQLDelete(sql = "Update Version set isDeleted = 1 where id = ?")
public class Version {
@Id @Id
@GeneratedValue @GeneratedValue
private long id; private long id;
...@@ -23,63 +20,54 @@ public class Version { ...@@ -23,63 +20,54 @@ public class Version {
private String name; private String name;
@Column(nullable = false) @Column(nullable = false)
private String appId; private String clusterId;
@Column(nullable = false) // parent version could be null
private long releaseId; @Column
//parent version could be null
private Long parentVersion; private Long parentVersion;
private boolean isDeleted;
public Version() { private List<Release> releases;
public Version() {}
public String getClusterId() {
return clusterId;
} }
public long getId() { public long getId() {
return id; return id;
} }
public void setId(long id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) { public Long getParentVersion() {
this.name = name; return parentVersion;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public long getReleaseId() {
return releaseId;
} }
public void setReleaseId(long releaseId) { public List<Release> getReleases() {
this.releaseId = releaseId; return releases;
} }
public boolean isDeleted() { public void setClusterId(String clusterId) {
return isDeleted; this.clusterId = clusterId;
} }
public void setDeleted(boolean deleted) { public void setId(long id) {
isDeleted = deleted; this.id = id;
} }
public Long getParentVersion() { public void setName(String name) {
return parentVersion; this.name = name;
} }
public void setParentVersion(Long parentVersion) { public void setParentVersion(Long parentVersion) {
this.parentVersion = parentVersion; this.parentVersion = parentVersion;
} }
public void setReleases(List<Release> releases) {
this.releases = releases;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment