Search in sources :

Example 1 with NamespaceLockDTO

use of com.ctrip.framework.apollo.common.dto.NamespaceLockDTO 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 NamespaceLockDTO

use of com.ctrip.framework.apollo.common.dto.NamespaceLockDTO 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 NamespaceLockDTO

use of com.ctrip.framework.apollo.common.dto.NamespaceLockDTO in project apollo by ctripcorp.

the class NamespaceLockService method getNamespaceLockInfo.

public LockInfo getNamespaceLockInfo(String appId, Env env, String clusterName, String namespaceName) {
    LockInfo lockInfo = new LockInfo();
    NamespaceLockDTO namespaceLockDTO = namespaceLockAPI.getNamespaceLockOwner(appId, env, clusterName, namespaceName);
    String lockOwner = namespaceLockDTO == null ? "" : namespaceLockDTO.getDataChangeCreatedBy();
    lockInfo.setLockOwner(lockOwner);
    lockInfo.setEmergencyPublishAllowed(portalConfig.isEmergencyPublishAllowed(env));
    return lockInfo;
}
Also used : NamespaceLockDTO(com.ctrip.framework.apollo.common.dto.NamespaceLockDTO) LockInfo(com.ctrip.framework.apollo.portal.entity.vo.LockInfo)

Aggregations

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