Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
877 additions
and
656 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...lo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/AppController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.ctrip.apollo.adminservice.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
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 com.ctrip.apollo.biz.entity.App; | ||
import com.ctrip.apollo.biz.service.AppService; | ||
import com.ctrip.apollo.biz.utils.BeanUtils; | ||
import com.ctrip.apollo.core.dto.AppDTO; | ||
|
||
@RestController | ||
public class AppController { | ||
|
||
@Autowired | ||
private AppService appService; | ||
|
||
@RequestMapping("/apps/{appId}") | ||
public AppDTO findByAppId(@PathVariable("appId") String appId) { | ||
App app = appService.findByAppId(appId); | ||
return BeanUtils.transfrom(AppDTO.class, app); | ||
} | ||
|
||
@RequestMapping("/apps") | ||
public List<AppDTO> findByName(@RequestParam("name") String name) { | ||
List<App> app = appService.findByName(name); | ||
return BeanUtils.batchTransform(AppDTO.class, app); | ||
} | ||
} |
18 changes: 10 additions & 8 deletions
18
...dminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ClusterController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
package com.ctrip.apollo.adminservice.controller; | ||
|
||
import com.ctrip.apollo.biz.service.AdminConfigService; | ||
import com.ctrip.apollo.core.dto.ClusterDTO; | ||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
import com.ctrip.apollo.biz.entity.Cluster; | ||
import com.ctrip.apollo.biz.service.ViewService; | ||
import com.ctrip.apollo.biz.utils.BeanUtils; | ||
import com.ctrip.apollo.core.dto.ClusterDTO; | ||
|
||
@RestController | ||
@RequestMapping("/cluster") | ||
public class ClusterController { | ||
|
||
@Autowired | ||
private AdminConfigService adminConfigService; | ||
private ViewService viewService; | ||
|
||
@RequestMapping("/app/{appId}") | ||
public List<ClusterDTO> findClustersByApp(@PathVariable String appId) { | ||
return adminConfigService.findClustersByApp(appId); | ||
@RequestMapping("/apps/{appId}/clusters") | ||
public List<ClusterDTO> findClusters(@PathVariable("appId") String appId) { | ||
List<Cluster> clusters = viewService.findClusters(appId); | ||
return BeanUtils.batchTransform(ClusterDTO.class, clusters); | ||
} | ||
} |
37 changes: 0 additions & 37 deletions
37
...adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ConfigController.java
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/GroupController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.ctrip.apollo.adminservice.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.ctrip.apollo.biz.entity.Group; | ||
import com.ctrip.apollo.biz.service.GroupService; | ||
import com.ctrip.apollo.biz.service.ViewService; | ||
import com.ctrip.apollo.biz.utils.BeanUtils; | ||
import com.ctrip.apollo.core.dto.GroupDTO; | ||
|
||
@RestController | ||
public class GroupController { | ||
|
||
@Autowired | ||
private ViewService viewService; | ||
|
||
@Autowired | ||
private GroupService groupService; | ||
|
||
@RequestMapping("/apps/{appId}/clusters/{clusterId}/groups") | ||
public List<GroupDTO> findGroups(@PathVariable("clusterId") Long clusterId) { | ||
List<Group> groups = viewService.findGroups(clusterId); | ||
return BeanUtils.batchTransform(GroupDTO.class, groups); | ||
} | ||
|
||
@RequestMapping("/groups/{groupId}") | ||
public GroupDTO findOne(@PathVariable("groupId") Long groupId){ | ||
Group group = groupService.findOne(groupId); | ||
return BeanUtils.transfrom(GroupDTO.class, group); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...o-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ItemController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.ctrip.apollo.adminservice.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.ctrip.apollo.biz.entity.Item; | ||
import com.ctrip.apollo.biz.service.ViewService; | ||
import com.ctrip.apollo.biz.utils.BeanUtils; | ||
import com.ctrip.apollo.core.dto.ItemDTO; | ||
|
||
@RestController | ||
public class ItemController { | ||
|
||
@Autowired | ||
private ViewService viewService; | ||
|
||
@RequestMapping("/apps/{appId}/clusters/{clusterId}/groups/{groupId}/items") | ||
public List<ItemDTO> findItems( | ||
@PathVariable("groupId") Long groupId) { | ||
List<Item> items = viewService.findItems(groupId); | ||
return BeanUtils.batchTransform(ItemDTO.class, items); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...dminservice/src/main/java/com/ctrip/apollo/adminservice/controller/ReleaseController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.ctrip.apollo.adminservice.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.ctrip.apollo.biz.entity.Release; | ||
import com.ctrip.apollo.biz.service.ReleaseService; | ||
import com.ctrip.apollo.biz.service.ViewService; | ||
import com.ctrip.apollo.biz.utils.BeanUtils; | ||
import com.ctrip.apollo.core.dto.ReleaseDTO; | ||
|
||
@RestController | ||
public class ReleaseController { | ||
|
||
@Autowired | ||
private ViewService viewSerivce; | ||
|
||
@Autowired | ||
private ReleaseService releaseService; | ||
|
||
@RequestMapping("/release/{releaseId}") | ||
public ReleaseDTO findOne(@PathVariable("releaseId") long releaseId) { | ||
Release release = releaseService.findOne(releaseId); | ||
return BeanUtils.transfrom(ReleaseDTO.class, release); | ||
} | ||
|
||
@RequestMapping("/apps/{appId}/clusters/{clusterId}/groups/{groupId}/releases") | ||
public List<ReleaseDTO> findReleases(@PathVariable("groupId") Long groupId){ | ||
List<Release> releases = viewSerivce.findReleases(groupId); | ||
return BeanUtils.batchTransform(ReleaseDTO.class, releases); | ||
} | ||
} |
29 changes: 18 additions & 11 deletions
29
...dminservice/src/main/java/com/ctrip/apollo/adminservice/controller/VersionController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,36 @@ | ||
package com.ctrip.apollo.adminservice.controller; | ||
|
||
import com.ctrip.apollo.biz.service.AdminReleaseService; | ||
import com.ctrip.apollo.core.dto.VersionDTO; | ||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
import com.ctrip.apollo.biz.entity.Version; | ||
import com.ctrip.apollo.biz.service.VersionService; | ||
import com.ctrip.apollo.biz.service.ViewService; | ||
import com.ctrip.apollo.biz.utils.BeanUtils; | ||
import com.ctrip.apollo.core.dto.VersionDTO; | ||
|
||
@RestController | ||
@RequestMapping("/version") | ||
public class VersionController { | ||
|
||
@Autowired | ||
private AdminReleaseService adminReleaseService; | ||
private ViewService viewService; | ||
|
||
@RequestMapping("/app/{appId}") | ||
public List<VersionDTO> versions(@PathVariable String appId) { | ||
return adminReleaseService.findVersionsByApp(appId); | ||
@Autowired | ||
private VersionService versionService; | ||
|
||
@RequestMapping("/app/{appId}/clusters/{clusterId}/versions") | ||
public List<VersionDTO> findVersions(@PathVariable("appId") String appId, @PathVariable("clusterId") Long clusterId) { | ||
List<Version> versions = viewService.findVersions(clusterId); | ||
return BeanUtils.batchTransform(VersionDTO.class, versions); | ||
} | ||
|
||
@RequestMapping("/{versionId}") | ||
public VersionDTO version(@PathVariable long versionId) { | ||
return adminReleaseService.loadVersionById(versionId); | ||
@RequestMapping("/versions/{versionId}") | ||
public VersionDTO findOne(@PathVariable("versionId") long versionId) { | ||
Version version = versionService.findOne(versionId); | ||
return BeanUtils.transfrom(VersionDTO.class, version); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.