Search in sources :

Example 6 with EnvViewType

use of com.orion.ops.consts.env.EnvViewType in project orion-ops by lijiahangmax.

the class ApplicationEnvController method viewSave.

/**
 * 视图保存
 */
@RequestMapping("/view-save")
public Integer viewSave(@RequestBody ApplicationEnvRequest request) {
    Long appId = Valid.notNull(request.getAppId());
    Long profileId = Valid.notNull(request.getProfileId());
    EnvViewType viewType = Valid.notNull(EnvViewType.of(request.getViewType()));
    String value = Valid.notBlank(request.getValue());
    try {
        MutableLinkedHashMap<String, String> result = viewType.toMap(value);
        applicationEnvService.saveEnv(appId, profileId, result);
        return result.size();
    } catch (Exception e) {
        throw Exceptions.argument(MessageConst.PARSE_ERROR, e);
    }
}
Also used : EnvViewType(com.orion.ops.consts.env.EnvViewType) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EnvViewType (com.orion.ops.consts.env.EnvViewType)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 EventLog (com.orion.ops.annotation.EventLog)1