Search in sources :

Example 1 with ApplicationActionDO

use of com.orion.ops.entity.domain.ApplicationActionDO in project orion-ops by lijiahangmax.

the class ApplicationActionServiceImpl method copyAppAction.

@Override
@Transactional(rollbackFor = Exception.class)
public void copyAppAction(Long appId, Long targetAppId) {
    // 查询
    LambdaQueryWrapper<ApplicationActionDO> queryWrapper = new LambdaQueryWrapper<ApplicationActionDO>().eq(ApplicationActionDO::getAppId, appId);
    List<ApplicationActionDO> actions = applicationActionDAO.selectList(queryWrapper);
    // 插入
    for (ApplicationActionDO action : actions) {
        action.setId(null);
        action.setAppId(targetAppId);
        action.setCreateTime(null);
        action.setUpdateTime(null);
        applicationActionDAO.insert(action);
    }
}
Also used : ApplicationActionDO(com.orion.ops.entity.domain.ApplicationActionDO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with ApplicationActionDO

use of com.orion.ops.entity.domain.ApplicationActionDO in project orion-ops by lijiahangmax.

the class ApplicationActionServiceImpl method configAppAction.

@Override
@Transactional(rollbackFor = Exception.class)
public void configAppAction(ApplicationConfigRequest request) {
    Long appId = request.getAppId();
    Long profileId = request.getProfileId();
    StageType stageType = StageType.of(request.getStageType());
    // 删除
    LambdaQueryWrapper<ApplicationActionDO> deleteWrapper = new LambdaQueryWrapper<ApplicationActionDO>().eq(ApplicationActionDO::getAppId, appId).eq(ApplicationActionDO::getProfileId, profileId).eq(ApplicationActionDO::getStageType, stageType.getType());
    applicationActionDAO.delete(deleteWrapper);
    // 插入
    List<ApplicationConfigActionRequest> actions;
    if (StageType.BUILD.equals(stageType)) {
        actions = request.getBuildActions();
    } else if (StageType.RELEASE.equals(stageType)) {
        actions = request.getReleaseActions();
    } else {
        throw Exceptions.unsupported();
    }
    for (ApplicationConfigActionRequest action : actions) {
        ApplicationActionDO insert = new ApplicationActionDO();
        insert.setAppId(appId);
        insert.setProfileId(profileId);
        insert.setActionName(action.getName());
        insert.setActionType(action.getType());
        insert.setStageType(stageType.getType());
        insert.setActionCommand(action.getCommand());
        applicationActionDAO.insert(insert);
    }
}
Also used : ApplicationConfigActionRequest(com.orion.ops.entity.request.ApplicationConfigActionRequest) StageType(com.orion.ops.consts.app.StageType) ApplicationActionDO(com.orion.ops.entity.domain.ApplicationActionDO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with ApplicationActionDO

use of com.orion.ops.entity.domain.ApplicationActionDO in project orion-ops by lijiahangmax.

the class ApplicationActionServiceImpl method syncAppProfileAction.

@Override
@Transactional(rollbackFor = Exception.class)
public void syncAppProfileAction(Long appId, Long sourceProfileId, Long targetProfileId) {
    // 删除
    LambdaQueryWrapper<ApplicationActionDO> deleteWrapper = new LambdaQueryWrapper<ApplicationActionDO>().eq(ApplicationActionDO::getAppId, appId).eq(ApplicationActionDO::getProfileId, targetProfileId);
    applicationActionDAO.delete(deleteWrapper);
    // 查询
    LambdaQueryWrapper<ApplicationActionDO> queryWrapper = new LambdaQueryWrapper<ApplicationActionDO>().eq(ApplicationActionDO::getAppId, appId).eq(ApplicationActionDO::getProfileId, sourceProfileId);
    List<ApplicationActionDO> actions = applicationActionDAO.selectList(queryWrapper);
    // 新增
    for (ApplicationActionDO action : actions) {
        action.setId(null);
        action.setCreateTime(null);
        action.setUpdateTime(null);
        action.setProfileId(targetProfileId);
        applicationActionDAO.insert(action);
    }
}
Also used : ApplicationActionDO(com.orion.ops.entity.domain.ApplicationActionDO) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ApplicationActionDO (com.orion.ops.entity.domain.ApplicationActionDO)3 Transactional (org.springframework.transaction.annotation.Transactional)3 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 StageType (com.orion.ops.consts.app.StageType)1 ApplicationConfigActionRequest (com.orion.ops.entity.request.ApplicationConfigActionRequest)1