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);
}
}
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);
}
}
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);
}
}
Aggregations