Search in sources :

Example 1 with OpenNamespaceLockDTO

use of com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO in project apollo by ctripcorp.

the class NamespaceController method getNamespaceLock.

@RequestMapping(value = "/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/lock", method = RequestMethod.GET)
public OpenNamespaceLockDTO getNamespaceLock(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName) {
    NamespaceDTO namespace = namespaceService.loadNamespaceBaseInfo(appId, Env.fromString(env), clusterName, namespaceName);
    NamespaceLockDTO lockDTO = namespaceLockService.getNamespaceLock(appId, Env.fromString(env), clusterName, namespaceName);
    return OpenApiBeanUtils.transformFromNamespaceLockDTO(namespace.getNamespaceName(), lockDTO);
}
Also used : OpenAppNamespaceDTO(com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO) NamespaceDTO(com.ctrip.framework.apollo.common.dto.NamespaceDTO) OpenNamespaceDTO(com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO) NamespaceLockDTO(com.ctrip.framework.apollo.common.dto.NamespaceLockDTO) OpenNamespaceLockDTO(com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with OpenNamespaceLockDTO

use of com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO in project apollo by ctripcorp.

the class ServerNamespaceOpenApiService method getNamespaceLock.

@Override
public OpenNamespaceLockDTO getNamespaceLock(String appId, String env, String clusterName, String namespaceName) {
    NamespaceDTO namespace = namespaceService.loadNamespaceBaseInfo(appId, Env.valueOf(env), clusterName, namespaceName);
    NamespaceLockDTO lockDTO = namespaceLockService.getNamespaceLock(appId, Env.valueOf(env), clusterName, namespaceName);
    return OpenApiBeanUtils.transformFromNamespaceLockDTO(namespace.getNamespaceName(), lockDTO);
}
Also used : OpenAppNamespaceDTO(com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO) NamespaceDTO(com.ctrip.framework.apollo.common.dto.NamespaceDTO) OpenNamespaceDTO(com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO) NamespaceLockDTO(com.ctrip.framework.apollo.common.dto.NamespaceLockDTO) OpenNamespaceLockDTO(com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO)

Example 3 with OpenNamespaceLockDTO

use of com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO in project apollo by ctripcorp.

the class OpenApiBeanUtils method transformFromNamespaceLockDTO.

public static OpenNamespaceLockDTO transformFromNamespaceLockDTO(String namespaceName, NamespaceLockDTO namespaceLock) {
    OpenNamespaceLockDTO lock = new OpenNamespaceLockDTO();
    lock.setNamespaceName(namespaceName);
    if (namespaceLock == null) {
        lock.setLocked(false);
    } else {
        lock.setLocked(true);
        lock.setLockedBy(namespaceLock.getDataChangeCreatedBy());
    }
    return lock;
}
Also used : OpenNamespaceLockDTO(com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO)

Aggregations

OpenNamespaceLockDTO (com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO)3 NamespaceDTO (com.ctrip.framework.apollo.common.dto.NamespaceDTO)2 NamespaceLockDTO (com.ctrip.framework.apollo.common.dto.NamespaceLockDTO)2 OpenAppNamespaceDTO (com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO)2 OpenNamespaceDTO (com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1