Search in sources :

Example 1 with SystemEnvService

use of com.orion.ops.service.api.SystemEnvService in project orion-ops by lijiahangmax.

the class SystemEnvServiceImpl method saveEnv.

@Override
@Transactional(rollbackFor = Exception.class)
public void saveEnv(Map<String, String> env) {
    SystemEnvService self = SpringHolder.getBean(SystemEnvService.class);
    // 倒排
    List<Map.Entry<String, String>> entries = Lists.newList(env.entrySet());
    int size = entries.size();
    for (int i = size - 1; i >= 0; i--) {
        // 更新
        Map.Entry<String, String> entry = entries.get(i);
        SystemEnvRequest request = new SystemEnvRequest();
        request.setKey(entry.getKey());
        request.setValue(entry.getValue());
        self.addEnv(request);
    }
    // 设置日志参数
    EventParamsHolder.addParam(EventKeys.COUNT, size);
}
Also used : SystemEnvService(com.orion.ops.service.api.SystemEnvService) Map(java.util.Map) MutableLinkedHashMap(com.orion.lang.collect.MutableLinkedHashMap) SystemEnvRequest(com.orion.ops.entity.request.SystemEnvRequest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

MutableLinkedHashMap (com.orion.lang.collect.MutableLinkedHashMap)1 SystemEnvRequest (com.orion.ops.entity.request.SystemEnvRequest)1 SystemEnvService (com.orion.ops.service.api.SystemEnvService)1 Map (java.util.Map)1 Transactional (org.springframework.transaction.annotation.Transactional)1