use of com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO in project apollo by ctripcorp.
the class OpenApiBeanUtils method transformFromReleaseDTO.
public static OpenReleaseDTO transformFromReleaseDTO(ReleaseDTO release) {
Preconditions.checkArgument(release != null);
OpenReleaseDTO openReleaseDTO = BeanUtils.transform(OpenReleaseDTO.class, release);
Map<String, String> configs = GSON.fromJson(release.getConfigurations(), TYPE);
openReleaseDTO.setConfigurations(configs);
return openReleaseDTO;
}
use of com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO in project apollo by ctripcorp.
the class ReleaseController method merge.
@PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)")
@PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/merge")
public OpenReleaseDTO merge(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @PathVariable String branchName, @RequestParam(value = "deleteBranch", defaultValue = "true") boolean deleteBranch, @RequestBody NamespaceReleaseDTO model, HttpServletRequest request) {
RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model.getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty");
if (userService.findByUserId(model.getReleasedBy()) == null) {
throw new BadRequestException("user(releaseBy) not exists");
}
ReleaseDTO mergedRelease = namespaceBranchService.merge(appId, Env.valueOf(env.toUpperCase()), clusterName, namespaceName, branchName, model.getReleaseTitle(), model.getReleaseComment(), model.isEmergencyPublish(), deleteBranch, model.getReleasedBy());
return OpenApiBeanUtils.transformFromReleaseDTO(mergedRelease);
}
Aggregations