diff --git a/apollo-adminservice/pom.xml b/apollo-adminservice/pom.xml
index 621a1c90dbb2aef456f9bbbb568b4b1a204ac96b..9e7f1813b1bb606f08ce3846e61d7335019e866b 100644
--- a/apollo-adminservice/pom.xml
+++ b/apollo-adminservice/pom.xml
@@ -1,45 +1,45 @@
-
- com.ctrip.apollo
- apollo
- 0.0.1-SNAPSHOT
- ../pom.xml
-
- 4.0.0
- apollo-adminservice
- Apollo AdminService
-
-
-
- com.ctrip.apollo
- apollo-biz
-
-
-
-
- org.springframework.data
- spring-data-redis
-
-
- redis.clients
- jedis
-
-
-
-
- org.springframework.cloud
- spring-cloud-starter-eureka-server
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ com.ctrip.apollo
+ apollo
+ 0.0.1-SNAPSHOT
+ ../pom.xml
+
+ 4.0.0
+ apollo-adminservice
+ Apollo AdminService
+
+
+
+ com.ctrip.apollo
+ apollo-biz
+
+
+
+
+ org.springframework.data
+ spring-data-redis
+
+
+ redis.clients
+ jedis
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-eureka-server
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
diff --git a/apollo-adminservice/src/main/java/com/ctrip/apollo/AdminServiceApplication.java b/apollo-adminservice/src/main/java/com/ctrip/apollo/AdminServiceApplication.java
index ee2a3b9ffd74fe64e0e585b5eab683b54036ea9f..910cdf043fcc3f891eeeb17267a6552b806faa26 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/apollo/AdminServiceApplication.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/apollo/AdminServiceApplication.java
@@ -2,13 +2,12 @@ package com.ctrip.apollo;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
//@EnableEurekaClient
public class AdminServiceApplication {
- public static void main(String[] args) {
- new SpringApplicationBuilder(AdminServiceApplication.class).web(true).run(args);
- }
+ public static void main(String[] args) {
+ new SpringApplicationBuilder(AdminServiceApplication.class).web(true).run(args);
+ }
}
diff --git a/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ClusterController.java b/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ClusterController.java
index 960d501a3b85dc757f191de2850d00a5262ec2d7..7dc8743224f6eea692c97c0b0aa2f86d63b8af36 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ClusterController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ClusterController.java
@@ -2,6 +2,7 @@ package com.ctrip.apollo.adminservice.controller;
import com.ctrip.apollo.biz.service.AdminConfigService;
import com.ctrip.apollo.core.dto.ClusterDTO;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -13,11 +14,11 @@ import java.util.List;
@RequestMapping("/cluster")
public class ClusterController {
- @Autowired
- private AdminConfigService adminConfigService;
+ @Autowired
+ private AdminConfigService adminConfigService;
- @RequestMapping("/app/{appId}")
- public List findClustersByApp(@PathVariable long appId){
- return adminConfigService.findClustersByApp(appId);
- }
+ @RequestMapping("/app/{appId}")
+ public List findClustersByApp(@PathVariable long appId) {
+ return adminConfigService.findClustersByApp(appId);
+ }
}
diff --git a/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ConfigController.java b/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ConfigController.java
index b9a9b55e547ebe0ff611145b23b70ac0037cf227..85c97edd8d8d2ddc64343fa511ee0725ebeb2f16 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ConfigController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ConfigController.java
@@ -3,31 +3,34 @@ package com.ctrip.apollo.adminservice.controller;
import com.ctrip.apollo.biz.service.AdminConfigService;
import com.ctrip.apollo.core.dto.ConfigItemDTO;
import com.ctrip.apollo.core.dto.ReleaseSnapshotDTO;
+
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import javax.annotation.Resource;
import java.util.List;
+import javax.annotation.Resource;
+
@RestController
@RequestMapping("/configs")
public class ConfigController {
- @Resource(name = "adminConfigService")
- private AdminConfigService adminConfigService;
+ @Resource(name = "adminConfigService")
+ private AdminConfigService adminConfigService;
- @RequestMapping("/release/{releaseId}")
- public List getRelaseSnapshot(@PathVariable long releaseId){
- return adminConfigService.findReleaseSnapshotByReleaseId(releaseId);
- }
+ @RequestMapping("/release/{releaseId}")
+ public List getRelaseSnapshot(@PathVariable long releaseId) {
+ return adminConfigService.findReleaseSnapshotByReleaseId(releaseId);
+ }
- @RequestMapping("/latest")
- public List findConfigItemsByClusters(@RequestParam(value = "clusterIds") List clusterIds){
- return adminConfigService.findConfigItemsByClusters(clusterIds);
- }
+ @RequestMapping("/latest")
+ public List findConfigItemsByClusters(
+ @RequestParam(value = "clusterIds") List clusterIds) {
+ return adminConfigService.findConfigItemsByClusters(clusterIds);
+ }
}
diff --git a/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/VersionController.java b/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/VersionController.java
index de5161f08ca815ed2ac97b0b54ba896212b1f510..0686299efc1b3b5699982a7b73f17e79a52e75fe 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/VersionController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/VersionController.java
@@ -2,6 +2,7 @@ package com.ctrip.apollo.adminservice.controller;
import com.ctrip.apollo.biz.service.AdminConfigService;
import com.ctrip.apollo.core.dto.VersionDTO;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -13,21 +14,19 @@ import java.util.List;
@RequestMapping("/version")
public class VersionController {
- @Autowired
- private AdminConfigService adminConfigService;
-
- @RequestMapping("/app/{appId}")
- public List versions(@PathVariable long appId){
-
- return adminConfigService.findVersionsByApp(appId);
- }
+ @Autowired
+ private AdminConfigService adminConfigService;
- @RequestMapping("/{versionId}")
- public VersionDTO version(@PathVariable long versionId){
- return adminConfigService.loadVersionById(versionId);
- }
+ @RequestMapping("/app/{appId}")
+ public List versions(@PathVariable long appId) {
+ return adminConfigService.findVersionsByApp(appId);
+ }
+ @RequestMapping("/{versionId}")
+ public VersionDTO version(@PathVariable long versionId) {
+ return adminConfigService.loadVersionById(versionId);
+ }
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Cluster.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Cluster.java
index d60173f53a99a054c9199c6a012d1041b3f6ed45..2a86c285f5fa80f275ef389b88295ceba05a0bca 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Cluster.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Cluster.java
@@ -1,6 +1,7 @@
package com.ctrip.apollo.biz.entity;
import com.ctrip.apollo.core.dto.ClusterDTO;
+
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@@ -16,58 +17,58 @@ import javax.persistence.Id;
@Where(clause = "isDeleted = 0")
@SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?")
public class Cluster {
- @Id
- @GeneratedValue
- private long id;
+ @Id
+ @GeneratedValue
+ private long id;
- @Column(nullable = false)
- private String name;
+ @Column(nullable = false)
+ private String name;
- @Column(nullable = false)
- private long appId;
+ @Column(nullable = false)
+ private long appId;
- private boolean isDeleted;
+ private boolean isDeleted;
- public Cluster() {
- }
+ public Cluster() {
+ }
- public long getId() {
- return id;
- }
+ public long getId() {
+ return id;
+ }
- public void setId(long id) {
- this.id = id;
- }
+ public void setId(long id) {
+ this.id = id;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName(String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public long getAppId() {
- return appId;
- }
+ public long getAppId() {
+ return appId;
+ }
- public void setAppId(long appId) {
- this.appId = appId;
- }
+ public void setAppId(long appId) {
+ this.appId = appId;
+ }
- public boolean isDeleted() {
- return isDeleted;
- }
+ public boolean isDeleted() {
+ return isDeleted;
+ }
- public void setDeleted(boolean deleted) {
- isDeleted = deleted;
- }
+ public void setDeleted(boolean deleted) {
+ isDeleted = deleted;
+ }
- public ClusterDTO toDTO(){
- ClusterDTO dto = new ClusterDTO();
- dto.setAppId(appId);
- dto.setId(id);
- dto.setName(name);
- return dto;
- }
+ public ClusterDTO toDTO() {
+ ClusterDTO dto = new ClusterDTO();
+ dto.setAppId(appId);
+ dto.setId(id);
+ dto.setName(name);
+ return dto;
+ }
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ConfigItem.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ConfigItem.java
index 2c6208b69f0a3a47af0e235b9d79870881ed2c1d..2d9d5bda9297b52d523b162d5e63cf16ff4ab6a0 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ConfigItem.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ConfigItem.java
@@ -1,166 +1,168 @@
package com.ctrip.apollo.biz.entity;
import com.ctrip.apollo.core.dto.ConfigItemDTO;
+
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
+import java.util.Date;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import java.util.Date;
@Entity
@Where(clause = "isDeleted = 0")
@SQLDelete(sql = "Update ConfigItem set isDeleted = 1 where id = ?")
public class ConfigItem {
- @Id
- @GeneratedValue
- private long id;
+ @Id
+ @GeneratedValue
+ private long id;
- @Column(nullable = false)
- private long clusterId;
+ @Column(nullable = false)
+ private long clusterId;
- @Column(nullable = false)
- private String clusterName;
+ @Column(nullable = false)
+ private String clusterName;
- @Column(nullable = false)
- private long appId;
+ @Column(nullable = false)
+ private long appId;
- @Column(nullable = false)
- private String key;
+ @Column(nullable = false)
+ private String key;
- @Column
- private String value;
+ @Column
+ private String value;
- @Column
- private String comment;
+ @Column
+ private String comment;
- @Column
- private String dataChangeCreatedBy;
+ @Column
+ private String dataChangeCreatedBy;
- @Column
- private Date dataChangeCreatedTime;
+ @Column
+ private Date dataChangeCreatedTime;
- @Column
- private String dataChangeLastModifiedBy;
+ @Column
+ private String dataChangeLastModifiedBy;
- @Column
- private Date dataChangeLastModifiedTime;
+ @Column
+ private Date dataChangeLastModifiedTime;
- @Column
- private boolean IsDeleted;
+ @Column
+ private boolean IsDeleted;
- public long getId() {
- return id;
- }
+ public long getId() {
+ return id;
+ }
- public void setId(long id) {
- this.id = id;
- }
+ public void setId(long id) {
+ this.id = id;
+ }
- public long getClusterId() {
- return clusterId;
- }
+ public long getClusterId() {
+ return clusterId;
+ }
- public void setClusterId(long clusterId) {
- this.clusterId = clusterId;
- }
+ public void setClusterId(long clusterId) {
+ this.clusterId = clusterId;
+ }
- public String getClusterName() {
- return clusterName;
- }
+ public String getClusterName() {
+ return clusterName;
+ }
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
- }
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
- public long getAppId() {
- return appId;
- }
+ public long getAppId() {
+ return appId;
+ }
- public void setAppId(long appId) {
- this.appId = appId;
- }
+ public void setAppId(long appId) {
+ this.appId = appId;
+ }
- public String getKey() {
- return key;
- }
+ public String getKey() {
+ return key;
+ }
- public void setKey(String key) {
- this.key = key;
- }
+ public void setKey(String key) {
+ this.key = key;
+ }
- public String getValue() {
- return value;
- }
+ public String getValue() {
+ return value;
+ }
- public void setValue(String value) {
- this.value = value;
- }
+ public void setValue(String value) {
+ this.value = value;
+ }
- public String getComment() {
- return comment;
- }
+ public String getComment() {
+ return comment;
+ }
- public void setComment(String comment) {
- this.comment = comment;
- }
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
- public String getDataChangeCreatedBy() {
- return dataChangeCreatedBy;
- }
+ 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;
- }
-
- public ConfigItemDTO toDTO(){
- ConfigItemDTO dto = new ConfigItemDTO();
- dto.setAppId(appId);
- dto.setId(id);
- dto.setClusterId(clusterId);
- dto.setClusterName(clusterName);
- dto.setDataChangeCreatedBy(dataChangeCreatedBy);
- dto.setDataChangeLastModifiedBy(dataChangeLastModifiedBy);
- dto.setDataChangeCreatedTime(dataChangeCreatedTime);
- dto.setDataChangeLastModifiedTime(dataChangeLastModifiedTime);
- dto.setKey(key);
- dto.setValue(value);
- dto.setComment(comment);
- return dto;
- }
+ 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;
+ }
+
+ public ConfigItemDTO toDTO() {
+ ConfigItemDTO dto = new ConfigItemDTO();
+ dto.setAppId(appId);
+ dto.setId(id);
+ dto.setClusterId(clusterId);
+ dto.setClusterName(clusterName);
+ dto.setDataChangeCreatedBy(dataChangeCreatedBy);
+ dto.setDataChangeLastModifiedBy(dataChangeLastModifiedBy);
+ dto.setDataChangeCreatedTime(dataChangeCreatedTime);
+ dto.setDataChangeLastModifiedTime(dataChangeLastModifiedTime);
+ dto.setKey(key);
+ dto.setValue(value);
+ dto.setComment(comment);
+ return dto;
+ }
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Release.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Release.java
index 859b152b7f2b7e05c62fc3f576097295a3b67efd..380953bb5acabb654420849ae557576f12b46f12 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Release.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Release.java
@@ -14,55 +14,55 @@ import javax.persistence.Id;
@Where(clause = "isDeleted = 0")
@SQLDelete(sql = "Update Release set isDeleted = 1 where id = ?")
public class Release {
- @Id
- @GeneratedValue
- private long id;
+ @Id
+ @GeneratedValue
+ private long id;
- private String name;
- private long appId;
- private String comment;
- private boolean isDeleted;
+ private String name;
+ private long appId;
+ private String comment;
+ private boolean isDeleted;
- public Release() {
- }
+ public Release() {
+ }
- public long getId() {
- return id;
- }
+ public long getId() {
+ return id;
+ }
- public void setId(long id) {
- this.id = id;
- }
+ public void setId(long id) {
+ this.id = id;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName(String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public long getAppId() {
- return appId;
- }
+ public long getAppId() {
+ return appId;
+ }
- public void setAppId(long appId) {
- this.appId = appId;
- }
+ public void setAppId(long appId) {
+ this.appId = appId;
+ }
- public String getComment() {
- return comment;
- }
+ public String getComment() {
+ return comment;
+ }
- public void setComment(String comment) {
- this.comment = comment;
- }
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
- public boolean isDeleted() {
- return isDeleted;
- }
+ public boolean isDeleted() {
+ return isDeleted;
+ }
- public void setDeleted(boolean deleted) {
- isDeleted = deleted;
- }
+ public void setDeleted(boolean deleted) {
+ isDeleted = deleted;
+ }
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ReleaseSnapShot.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ReleaseSnapShot.java
index 1d7fbeaeb832108ebe984daef75bd8eecd102320..5bfeba1f916983080b98a774c3e4328cc6997dc1 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ReleaseSnapShot.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/ReleaseSnapShot.java
@@ -1,6 +1,7 @@
package com.ctrip.apollo.biz.entity;
import com.ctrip.apollo.core.dto.ReleaseSnapshotDTO;
+
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@@ -16,70 +17,70 @@ import javax.persistence.Id;
@Where(clause = "isDeleted = 0")
@SQLDelete(sql = "Update ReleaseSnapShot set isDeleted = 1 where id = ?")
public class ReleaseSnapShot {
- @Id
- @GeneratedValue
- private long id;
+ @Id
+ @GeneratedValue
+ private long id;
- @Column(nullable = false)
- private long releaseId;
+ @Column(nullable = false)
+ private long releaseId;
- @Column(nullable = false)
- private String clusterName;
+ @Column(nullable = false)
+ private String clusterName;
- @Column(nullable = false)
- private String configurations;
+ @Column(nullable = false)
+ private String configurations;
- private boolean isDeleted;
+ private boolean isDeleted;
- public ReleaseSnapShot() {
- }
+ public ReleaseSnapShot() {
+ }
- public long getId() {
- return id;
- }
+ public long getId() {
+ return id;
+ }
- public void setId(long id) {
- this.id = id;
- }
+ public void setId(long id) {
+ this.id = id;
+ }
- public long getReleaseId() {
- return releaseId;
- }
+ public long getReleaseId() {
+ return releaseId;
+ }
- public void setReleaseId(long releaseId) {
- this.releaseId = releaseId;
- }
+ public void setReleaseId(long releaseId) {
+ this.releaseId = releaseId;
+ }
- public String getClusterName() {
- return clusterName;
- }
+ public String getClusterName() {
+ return clusterName;
+ }
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
- }
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
- public String getConfigurations() {
- return configurations;
- }
+ public String getConfigurations() {
+ return configurations;
+ }
- public void setConfigurations(String configurations) {
- this.configurations = configurations;
- }
+ public void setConfigurations(String configurations) {
+ this.configurations = configurations;
+ }
- public boolean isDeleted() {
- return isDeleted;
- }
+ public boolean isDeleted() {
+ return isDeleted;
+ }
- public void setDeleted(boolean deleted) {
- isDeleted = deleted;
- }
+ public void setDeleted(boolean deleted) {
+ isDeleted = deleted;
+ }
- public ReleaseSnapshotDTO toDTO(){
- ReleaseSnapshotDTO dto = new ReleaseSnapshotDTO();
- dto.setId(id);
- dto.setClusterName(clusterName);
- dto.setConfigurations(configurations);
- dto.setReleaseId(releaseId);
- return dto;
- }
+ public ReleaseSnapshotDTO toDTO() {
+ ReleaseSnapshotDTO dto = new ReleaseSnapshotDTO();
+ dto.setId(id);
+ dto.setClusterName(clusterName);
+ dto.setConfigurations(configurations);
+ dto.setReleaseId(releaseId);
+ return dto;
+ }
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Version.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Version.java
index 09ad4e8fd63595a4dc4c0fa07eeb10f37037b613..dc65a9ec1cab045af1b410a5445f09045cb1f047 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Version.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Version.java
@@ -1,6 +1,7 @@
package com.ctrip.apollo.biz.entity;
import com.ctrip.apollo.core.dto.VersionDTO;
+
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@@ -16,80 +17,80 @@ import javax.persistence.Id;
@Where(clause = "isDeleted = 0")
@SQLDelete(sql = "Update Version set isDeleted = 1 where id = ?")
public class Version {
- @Id
- @GeneratedValue
- private long id;
-
- @Column(nullable = false)
- private String name;
-
- @Column(nullable = false)
- private long appId;
-
- @Column(nullable = false)
- private long releaseId;
- //parent version could be null
- private Long parentVersion;
- private boolean isDeleted;
-
- public Version() {
- }
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public long getAppId() {
- return appId;
- }
-
- public void setAppId(long appId) {
- this.appId = appId;
- }
-
- public long getReleaseId() {
- return releaseId;
- }
-
- public void setReleaseId(long releaseId) {
- this.releaseId = releaseId;
- }
-
- public boolean isDeleted() {
- return isDeleted;
- }
-
- public void setDeleted(boolean deleted) {
- isDeleted = deleted;
- }
-
- public Long getParentVersion() {
- return parentVersion;
- }
-
- public void setParentVersion(Long parentVersion) {
- this.parentVersion = parentVersion;
- }
-
- public VersionDTO toDTO() {
- VersionDTO dto = new VersionDTO();
- dto.setAppId(this.appId);
- dto.setId(this.id);
- dto.setName(this.name);
- dto.setParentVersion(this.parentVersion);
- dto.setReleaseId(this.releaseId);
- return dto;
- }
+ @Id
+ @GeneratedValue
+ private long id;
+
+ @Column(nullable = false)
+ private String name;
+
+ @Column(nullable = false)
+ private long appId;
+
+ @Column(nullable = false)
+ private long releaseId;
+ //parent version could be null
+ private Long parentVersion;
+ private boolean isDeleted;
+
+ public Version() {
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public long getAppId() {
+ return appId;
+ }
+
+ public void setAppId(long appId) {
+ this.appId = appId;
+ }
+
+ public long getReleaseId() {
+ return releaseId;
+ }
+
+ public void setReleaseId(long releaseId) {
+ this.releaseId = releaseId;
+ }
+
+ public boolean isDeleted() {
+ return isDeleted;
+ }
+
+ public void setDeleted(boolean deleted) {
+ isDeleted = deleted;
+ }
+
+ public Long getParentVersion() {
+ return parentVersion;
+ }
+
+ public void setParentVersion(Long parentVersion) {
+ this.parentVersion = parentVersion;
+ }
+
+ public VersionDTO toDTO() {
+ VersionDTO dto = new VersionDTO();
+ dto.setAppId(this.appId);
+ dto.setId(this.id);
+ dto.setName(this.name);
+ dto.setParentVersion(this.parentVersion);
+ dto.setReleaseId(this.releaseId);
+ return dto;
+ }
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ClusterRepository.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ClusterRepository.java
index 0150e078d22c63982c77af45131fb4a6512c10c2..3de21a2cc687898dc3393c58ff313f71095a76b2 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ClusterRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ClusterRepository.java
@@ -2,12 +2,13 @@ package com.ctrip.apollo.biz.repository;
import com.ctrip.apollo.biz.entity.Cluster;
+
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface ClusterRepository extends PagingAndSortingRepository {
- List findByAppId(long appId);
+ List findByAppId(long appId);
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ConfigItemRepository.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ConfigItemRepository.java
index ef398d38b2fc9de3a06b5795a0b0555a2a2962b7..3b3b3b0bb5cdb9f66dcdeb9f868880403de205a2 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ConfigItemRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ConfigItemRepository.java
@@ -1,12 +1,13 @@
package com.ctrip.apollo.biz.repository;
import com.ctrip.apollo.biz.entity.ConfigItem;
+
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface ConfigItemRepository extends PagingAndSortingRepository {
- List findByClusterIdIsIn(List clusterIds);
+ List findByClusterIdIsIn(List clusterIds);
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ReleaseSnapShotRepository.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ReleaseSnapShotRepository.java
index b0c7011d41a9a829fe1a1f5e18822b6cbac15e42..fe3dcd4dff202e3343713630938df7fe5bd88147 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ReleaseSnapShotRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/ReleaseSnapShotRepository.java
@@ -1,6 +1,7 @@
package com.ctrip.apollo.biz.repository;
import com.ctrip.apollo.biz.entity.ReleaseSnapShot;
+
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@@ -8,8 +9,9 @@ import java.util.List;
/**
* @author Jason Song(song_s@ctrip.com)
*/
-public interface ReleaseSnapShotRepository extends PagingAndSortingRepository {
- ReleaseSnapShot findByReleaseIdAndClusterName(long releaseId, String clusterName);
+public interface ReleaseSnapShotRepository
+ extends PagingAndSortingRepository {
+ ReleaseSnapShot findByReleaseIdAndClusterName(long releaseId, String clusterName);
- List findByReleaseId(long releaseId);
+ List findByReleaseId(long releaseId);
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/VersionRepository.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/VersionRepository.java
index 0e71ffbffa7a555b18ad3155dce208eb0c2a772e..7fef5fd7ddd749ce1ef4053351febe062a174f13 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/VersionRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/repository/VersionRepository.java
@@ -1,6 +1,7 @@
package com.ctrip.apollo.biz.repository;
import com.ctrip.apollo.biz.entity.Version;
+
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@@ -9,9 +10,9 @@ import java.util.List;
* @author Jason Song(song_s@ctrip.com)
*/
public interface VersionRepository extends PagingAndSortingRepository {
- Version findByAppIdAndName(long appId, String name);
+ Version findByAppIdAndName(long appId, String name);
- Version findById(long id);
+ Version findById(long id);
- List findByAppId(long appId);
+ List findByAppId(long appId);
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/AdminConfigService.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/AdminConfigService.java
index c732fa875bb1153211b16b37cc7bcffecdc2fa0f..12b26ebefb36420c13f5466c2a4f6cc171791acf 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/AdminConfigService.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/AdminConfigService.java
@@ -1,6 +1,9 @@
package com.ctrip.apollo.biz.service;
-import com.ctrip.apollo.core.dto.*;
+import com.ctrip.apollo.core.dto.ClusterDTO;
+import com.ctrip.apollo.core.dto.ConfigItemDTO;
+import com.ctrip.apollo.core.dto.ReleaseSnapshotDTO;
+import com.ctrip.apollo.core.dto.VersionDTO;
import java.util.List;
@@ -9,14 +12,14 @@ import java.util.List;
*/
public interface AdminConfigService {
- List findReleaseSnapshotByReleaseId(long releaseId);
+ List findReleaseSnapshotByReleaseId(long releaseId);
- List findVersionsByApp(long appId);
+ List findVersionsByApp(long appId);
- VersionDTO loadVersionById(long versionId);
+ VersionDTO loadVersionById(long versionId);
- List findClustersByApp(long appId);
+ List findClustersByApp(long appId);
- List findConfigItemsByClusters(List clusterIds);
+ List findConfigItemsByClusters(List clusterIds);
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/ConfigService.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/ConfigService.java
index 5355757f9d2003c5bf0d3483dd4bf23f7a14aa17..b67777bca6a0af090c0f1823e459223ff95c23cb 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/ConfigService.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/ConfigService.java
@@ -5,31 +5,22 @@ import com.ctrip.apollo.core.dto.ApolloConfig;
/**
* Config Service
+ *
* @author Jason Song(song_s@ctrip.com)
*/
public interface ConfigService {
- /**
- * Load configuration from database
- * @param appId
- * @param clusterName
- * @param versionName
- * @return
- */
- ApolloConfig loadConfig(long appId, String clusterName, String versionName);
+ /**
+ * Load configuration from database
+ */
+ ApolloConfig loadConfig(long appId, String clusterName, String versionName);
- /**
- * Load Version by appId and versionName from database
- * @param appId
- * @param versionName
- * @return
- */
- Version loadVersionByAppIdAndVersionName(long appId, String versionName);
+ /**
+ * Load Version by appId and versionName from database
+ */
+ Version loadVersionByAppIdAndVersionName(long appId, String versionName);
- /**
- * Load Config by version and clusterName from database
- * @param version
- * @param clusterName
- * @return
- */
- ApolloConfig loadConfigByVersionAndClusterName(Version version, String clusterName);
+ /**
+ * Load Config by version and clusterName from database
+ */
+ ApolloConfig loadConfigByVersionAndClusterName(Version version, String clusterName);
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/AdminConfigServiceImpl.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/AdminConfigServiceImpl.java
index a8b8053eedba788d3e22f39867cb35157445ba41..ad095a0dd50244670ab36fe9fb375417a8c457e5 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/AdminConfigServiceImpl.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/AdminConfigServiceImpl.java
@@ -9,103 +9,109 @@ import com.ctrip.apollo.biz.repository.ConfigItemRepository;
import com.ctrip.apollo.biz.repository.ReleaseSnapShotRepository;
import com.ctrip.apollo.biz.repository.VersionRepository;
import com.ctrip.apollo.biz.service.AdminConfigService;
-import com.ctrip.apollo.core.dto.*;
+import com.ctrip.apollo.core.dto.ClusterDTO;
+import com.ctrip.apollo.core.dto.ConfigItemDTO;
+import com.ctrip.apollo.core.dto.ReleaseSnapshotDTO;
+import com.ctrip.apollo.core.dto.VersionDTO;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
@Service("adminConfigService")
public class AdminConfigServiceImpl implements AdminConfigService {
- @Autowired
- private VersionRepository versionRepository;
- @Autowired
- private ReleaseSnapShotRepository releaseSnapShotRepository;
- @Autowired
- private ClusterRepository clusterRepository;
- @Autowired
- private ConfigItemRepository configItemRepository;
-
- @Override
- public List findReleaseSnapshotByReleaseId(long releaseId) {
- if (releaseId <= 0){
- return Collections.EMPTY_LIST;
- }
-
- List releaseSnapShots = releaseSnapShotRepository.findByReleaseId(releaseId);
-
- if (releaseSnapShots == null || releaseSnapShots.size() == 0){
- return Collections.EMPTY_LIST;
- }
-
- List result = new ArrayList<>(releaseSnapShots.size());
- for (ReleaseSnapShot releaseSnapShot: releaseSnapShots){
- result.add(releaseSnapShot.toDTO());
- }
- return result;
+ @Autowired
+ private VersionRepository versionRepository;
+ @Autowired
+ private ReleaseSnapShotRepository releaseSnapShotRepository;
+ @Autowired
+ private ClusterRepository clusterRepository;
+ @Autowired
+ private ConfigItemRepository configItemRepository;
+
+ @Override
+ public List findReleaseSnapshotByReleaseId(long releaseId) {
+ if (releaseId <= 0) {
+ return Collections.EMPTY_LIST;
}
+ List releaseSnapShots = releaseSnapShotRepository.findByReleaseId(releaseId);
+
+ if (releaseSnapShots == null || releaseSnapShots.size() == 0) {
+ return Collections.EMPTY_LIST;
+ }
- @Override
- public List findVersionsByApp(long appId) {
- if (appId <= 0) {
- return Collections.EMPTY_LIST;
- }
+ List result = new ArrayList<>(releaseSnapShots.size());
+ for (ReleaseSnapShot releaseSnapShot : releaseSnapShots) {
+ result.add(releaseSnapShot.toDTO());
+ }
+ return result;
+ }
- List versions = versionRepository.findByAppId(appId);
- if (versions == null || versions.size() == 0) {
- return Collections.EMPTY_LIST;
- }
- List result = new ArrayList<>(versions.size());
- for (Version version : versions) {
- result.add(version.toDTO());
- }
- return result;
+ @Override
+ public List findVersionsByApp(long appId) {
+ if (appId <= 0) {
+ return Collections.EMPTY_LIST;
}
- @Override
- public VersionDTO loadVersionById(long versionId) {
- if (versionId <= 0){
- return null;
- }
- Version version = versionRepository.findById(versionId);
- return version.toDTO();
+ List versions = versionRepository.findByAppId(appId);
+ if (versions == null || versions.size() == 0) {
+ return Collections.EMPTY_LIST;
}
- @Override
- public List findClustersByApp(long appId) {
- if (appId <= 0){
- return Collections.EMPTY_LIST;
- }
- List clusters = clusterRepository.findByAppId(appId);
- if (clusters == null || clusters.size() == 0){
- return Collections.EMPTY_LIST;
- }
-
- List result = new ArrayList<>(clusters.size());
- for (Cluster cluster: clusters){
- result.add(cluster.toDTO());
- }
- return result;
+ List result = new ArrayList<>(versions.size());
+ for (Version version : versions) {
+ result.add(version.toDTO());
+ }
+ return result;
+ }
+
+ @Override
+ public VersionDTO loadVersionById(long versionId) {
+ if (versionId <= 0) {
+ return null;
+ }
+ Version version = versionRepository.findById(versionId);
+ return version.toDTO();
+ }
+
+ @Override
+ public List findClustersByApp(long appId) {
+ if (appId <= 0) {
+ return Collections.EMPTY_LIST;
+ }
+ List clusters = clusterRepository.findByAppId(appId);
+ if (clusters == null || clusters.size() == 0) {
+ return Collections.EMPTY_LIST;
+ }
+
+ List result = new ArrayList<>(clusters.size());
+ for (Cluster cluster : clusters) {
+ result.add(cluster.toDTO());
+ }
+ return result;
+ }
+
+ @Override
+ public List findConfigItemsByClusters(List clusterIds) {
+ if (clusterIds == null || clusterIds.size() == 0) {
+ return Collections.EMPTY_LIST;
+ }
+ List configItems = configItemRepository.findByClusterIdIsIn(clusterIds);
+ if (configItems == null || configItems.size() == 0) {
+ return Collections.EMPTY_LIST;
}
- @Override
- public List findConfigItemsByClusters(List clusterIds) {
- if (clusterIds == null || clusterIds.size() == 0){
- return Collections.EMPTY_LIST;
- }
- List configItems = configItemRepository.findByClusterIdIsIn(clusterIds);
- if (configItems == null || configItems.size() == 0){
- return Collections.EMPTY_LIST;
- }
-
- List result = new ArrayList<>(configItems.size());
- for (ConfigItem configItem: configItems){
- result.add(configItem.toDTO());
- }
- return result;
+ List result = new ArrayList<>(configItems.size());
+ for (ConfigItem configItem : configItems) {
+ result.add(configItem.toDTO());
}
+ return result;
+ }
}
diff --git a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/ConfigServiceImpl.java b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/ConfigServiceImpl.java
index 981b7cf9478225c607f03ce382e666d99a577151..9272ebf8e1b097d1433569f7b1e459de6f147d44 100644
--- a/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/ConfigServiceImpl.java
+++ b/apollo-biz/src/main/java/com/ctrip/apollo/biz/service/impl/ConfigServiceImpl.java
@@ -1,5 +1,7 @@
package com.ctrip.apollo.biz.service.impl;
+import com.google.common.collect.Maps;
+
import com.ctrip.apollo.biz.entity.ReleaseSnapShot;
import com.ctrip.apollo.biz.entity.Version;
import com.ctrip.apollo.biz.repository.ReleaseSnapShotRepository;
@@ -8,7 +10,7 @@ import com.ctrip.apollo.biz.service.ConfigService;
import com.ctrip.apollo.core.dto.ApolloConfig;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Maps;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -20,56 +22,58 @@ import java.util.Map;
*/
@Service("configService")
public class ConfigServiceImpl implements ConfigService {
- @Autowired
- private VersionRepository versionRepository;
- @Autowired
- private ReleaseSnapShotRepository releaseSnapShotRepository;
- @Autowired
- private ObjectMapper objectMapper;
- private TypeReference