Search in sources :

Example 41 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class DegreeFeedbackLogicServiceImpl method startProcess.

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DegreeFeedbackProjectVO> startProcess(DegreeFeedbackProjectVO project) throws ServiceException, Exception {
    if (null == project || super.isBlank(project.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<DegreeFeedbackProjectVO> result = this.degreeFeedbackProjectService.findObjectByOid(project);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    project = result.getValue();
    if (YesNo.YES.equals(project.getPublishFlag())) {
        throw new ServiceException("The project is published, cannot start audit processing!");
    }
    List<BusinessProcessManagementTaskVO> tasks = this.queryTaskByVariableProjectOid(project.getOid());
    if (null != tasks && tasks.size() > 0) {
        throw new ServiceException("Audit processing has been started!");
    }
    this.startProcess(this.getProcessFlowParam(project.getOid(), YesNo.YES, "start apply." + project.getName()));
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : BusinessProcessManagementTaskVO(com.netsteadfast.greenstep.vo.BusinessProcessManagementTaskVO) SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DegreeFeedbackProjectVO(com.netsteadfast.greenstep.vo.DegreeFeedbackProjectVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 42 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class AnalyticsMDXLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<OlapMdxVO> update(OlapMdxVO olapMdx, String configOid, String catalogOid) throws ServiceException, Exception {
    if (null == olapMdx || super.isNoSelectId(configOid) || super.isNoSelectId(catalogOid) || super.isBlank(olapMdx.getName()) || super.isBlank(olapMdx.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<OlapMdxVO> oldResult = this.olapMdxService.findObjectByOid(olapMdx);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    // 查資料是否存在
    OlapConfVO config = this.loadOlapConfig(configOid);
    // 查資料是否存在
    OlapCatalogVO catalog = this.loadOlapCatalog(catalogOid);
    olapMdx.setConfOid(config.getOid());
    olapMdx.setCatalogOid(catalog.getOid());
    if (olapMdx.getName().equals(oldResult.getValue().getName()) && !olapMdx.getOid().equals(oldResult.getValue().getOid())) {
        // 存在別筆資料但UK相同 , 所以不能 UPDATE
        throw new ServiceException("Please change another name!");
    }
    oldResult.getValue().setExpression(null);
    // 先把BLOB 資料清掉
    this.olapMdxService.updateObject(oldResult.getValue());
    return this.olapMdxService.updateObject(olapMdx);
}
Also used : OlapConfVO(com.netsteadfast.greenstep.vo.OlapConfVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO) OlapMdxVO(com.netsteadfast.greenstep.vo.OlapMdxVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 43 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class AnalyticsMDXLogicServiceImpl method create.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<OlapMdxVO> create(OlapMdxVO olapMdx, String configOid, String catalogOid) throws ServiceException, Exception {
    if (null == olapMdx || super.isNoSelectId(configOid) || super.isNoSelectId(catalogOid) || super.isBlank(olapMdx.getName())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    // 查資料是否存在
    OlapConfVO config = this.loadOlapConfig(configOid);
    // 查資料是否存在
    OlapCatalogVO catalog = this.loadOlapCatalog(catalogOid);
    olapMdx.setConfOid(config.getOid());
    olapMdx.setCatalogOid(catalog.getOid());
    return this.olapMdxService.saveObject(olapMdx);
}
Also used : OlapConfVO(com.netsteadfast.greenstep.vo.OlapConfVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 44 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class DataQueryMapperLogicServiceImpl method updateMapper.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DataQueryMapperVO> updateMapper(DataQueryMapperVO queryMapper, List<Map<String, String>> fieldsData) throws ServiceException, Exception {
    if (null == queryMapper || super.isBlank(queryMapper.getOid()) || null == fieldsData || fieldsData.size() < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    // name 是 UK , 修改之前要檢查是否重復
    DataQueryMapperVO checkQueryMapper = new DataQueryMapperVO();
    checkQueryMapper.setName(queryMapper.getName());
    DefaultResult<DataQueryMapperVO> checkResult = this.dataQueryMapperService.findByUK(checkQueryMapper);
    if (checkResult.getValue() != null) {
        checkQueryMapper = checkResult.getValue();
        if (!checkQueryMapper.getOid().equals(queryMapper.getOid())) {
            // 有別筆資料的 name (UK) 相同
            throw new ServiceException("Please change name!");
        }
    }
    this.deleteMapperSet(queryMapper);
    this.createMapperSet(queryMapper, fieldsData);
    return this.dataQueryMapperService.updateObject(queryMapper);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DataQueryMapperVO(com.netsteadfast.greenstep.vo.DataQueryMapperVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 45 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class DataSourceLogicServiceImpl method updateConf.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DataSourceConfVO> updateConf(String driverOid, DataSourceConfVO dataSourceConf) throws ServiceException, Exception {
    if (super.isBlank(driverOid) || null == dataSourceConf) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<DataSourceConfVO> oldResult = this.dataSourceConfService.findObjectByOid(dataSourceConf);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    // ID 是 UK, 不允許變動
    dataSourceConf.setId(oldResult.getValue().getId());
    DataSourceDriverVO driver = new DataSourceDriverVO();
    driver.setOid(driverOid);
    DefaultResult<DataSourceDriverVO> dResult = this.dataSourceDriverService.findObjectByOid(driver);
    if (dResult.getValue() == null) {
        throw new ServiceException(dResult.getSystemMessage().getValue());
    }
    driver = dResult.getValue();
    dataSourceConf.setDriverId(driver.getId());
    if (super.defaultString(dataSourceConf.getJdbcUrl()).length() > MAX_JDBC_URL_LENGTH) {
        throw new ServiceException("jdbc-url Only allows " + String.valueOf(MAX_JDBC_URL_LENGTH) + " characters!");
    }
    if (null == dataSourceConf.getDescription()) {
        dataSourceConf.setDescription("");
    }
    this.setStringValueMaxLength(dataSourceConf, "description", MAX_DESCRIPTION_LENGTH);
    return dataSourceConfService.updateObject(dataSourceConf);
}
Also used : DataSourceConfVO(com.netsteadfast.greenstep.vo.DataSourceConfVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DataSourceDriverVO(com.netsteadfast.greenstep.vo.DataSourceDriverVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)95 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)91 Transactional (org.springframework.transaction.annotation.Transactional)84 HashMap (java.util.HashMap)32 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)31 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)29 SysVO (com.netsteadfast.greenstep.vo.SysVO)13 LinkedHashMap (java.util.LinkedHashMap)13 Map (java.util.Map)12 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)7 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)6 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)6 IOException (java.io.IOException)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)5 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)5 UserRoleVO (com.netsteadfast.greenstep.vo.UserRoleVO)5 BbReportRoleView (com.netsteadfast.greenstep.po.hbm.BbReportRoleView)4