Search in sources :

Example 11 with OpenItemDTO

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

the class ServerItemOpenApiService method updateItem.

@Override
public void updateItem(String appId, String env, String clusterName, String namespaceName, OpenItemDTO itemDTO) {
    ItemDTO toUpdateItem = itemService.loadItem(Env.valueOf(env), appId, clusterName, namespaceName, itemDTO.getKey());
    // protect. only value,comment,lastModifiedBy can be modified
    toUpdateItem.setComment(itemDTO.getComment());
    toUpdateItem.setValue(itemDTO.getValue());
    toUpdateItem.setDataChangeLastModifiedBy(itemDTO.getDataChangeLastModifiedBy());
    itemService.updateItem(appId, Env.valueOf(env), clusterName, namespaceName, toUpdateItem);
}
Also used : OpenItemDTO(com.ctrip.framework.apollo.openapi.dto.OpenItemDTO) ItemDTO(com.ctrip.framework.apollo.common.dto.ItemDTO)

Aggregations

OpenItemDTO (com.ctrip.framework.apollo.openapi.dto.OpenItemDTO)11 Test (org.junit.Test)6 ItemDTO (com.ctrip.framework.apollo.common.dto.ItemDTO)4 BadRequestException (com.ctrip.framework.apollo.common.exception.BadRequestException)2 HttpPut (org.apache.http.client.methods.HttpPut)2 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 OpenNamespaceDTO (com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO)1 ItemBO (com.ctrip.framework.apollo.portal.entity.bo.ItemBO)1 LinkedList (java.util.LinkedList)1 HttpPost (org.apache.http.client.methods.HttpPost)1 StringEntity (org.apache.http.entity.StringEntity)1