Search in sources :

Example 36 with DefaultResult

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

the class BaseService method ibatisSelectListByParams.

// ------------------------------------------------------------------------------------
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public DefaultResult<List<E>> ibatisSelectListByParams(Map<String, Object> params) throws ServiceException, Exception {
    if (params == null) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
    }
    DefaultResult<List<E>> result = new DefaultResult<List<E>>();
    List<E> searchList = (List<E>) this.getBaseDataAccessObject().ibatisSelectListByParams(params);
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ArrayList(java.util.ArrayList) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) Transactional(org.springframework.transaction.annotation.Transactional)

Example 37 with DefaultResult

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

the class BaseService method deleteObject.

@SuppressWarnings({ "unchecked", "rawtypes" })
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
public DefaultResult<Boolean> deleteObject(T object) throws ServiceException, Exception {
    if (object == null || !(object instanceof BaseValueObj)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1);
    E entityObject = entityObjectClass.newInstance();
    ((BaseEntity) entityObject).setOid(((BaseValueObj) object).getOid());
    boolean status = false;
    if (this.countByOid(entityObject) > 0) {
        this.delete(entityObject);
        status = true;
    }
    result.setValue(status);
    if (status) {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.DELETE_SUCCESS)));
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.DELETE_FAIL)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BaseEntity(com.netsteadfast.greenstep.base.model.BaseEntity) BaseValueObj(com.netsteadfast.greenstep.base.model.BaseValueObj) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 38 with DefaultResult

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

the class DegreeFeedbackScoreServiceImpl method findResultsByProjectAndOwner.

@Override
public DefaultResult<List<BbDegreeFeedbackScore>> findResultsByProjectAndOwner(String projectOid, String ownerId) throws Exception {
    if (StringUtils.isBlank(projectOid) || StringUtils.isBlank(ownerId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    List<BbDegreeFeedbackScore> searchList = this.degreeFeedbackScoreDAO.findForListByProjectAndOwner(projectOid, ownerId);
    DefaultResult<List<BbDegreeFeedbackScore>> result = new DefaultResult<List<BbDegreeFeedbackScore>>();
    if (null != searchList && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BbDegreeFeedbackScore(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 39 with DefaultResult

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

the class AggregationMethodServiceImpl method findSimpleByOid.

@Override
public DefaultResult<AggregationMethodVO> findSimpleByOid(String aggrOid) throws ServiceException, Exception {
    if (StringUtils.isBlank(aggrOid) || super.isNoSelectId(aggrOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    AggregationMethodVO aggr = this.aggregationMethodDAO.findSimpleByOid(aggrOid);
    DefaultResult<AggregationMethodVO> result = new DefaultResult<AggregationMethodVO>();
    if (aggr != null && !StringUtils.isBlank(aggr.getOid())) {
        result.setValue(aggr);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) AggregationMethodVO(com.netsteadfast.greenstep.vo.AggregationMethodVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 40 with DefaultResult

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

the class AggregationMethodServiceImpl method findForSimple.

@Override
public DefaultResult<List<AggregationMethodVO>> findForSimple() throws ServiceException, Exception {
    DefaultResult<List<AggregationMethodVO>> result = new DefaultResult<List<AggregationMethodVO>>();
    List<AggregationMethodVO> searchList = this.aggregationMethodDAO.findForSimple();
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) AggregationMethodVO(com.netsteadfast.greenstep.vo.AggregationMethodVO) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Aggregations

DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)52 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)50 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)48 Transactional (org.springframework.transaction.annotation.Transactional)32 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)29 HashMap (java.util.HashMap)13 List (java.util.List)12 Map (java.util.Map)9 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 ArrayList (java.util.ArrayList)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 IOException (java.io.IOException)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 AggregationMethodVO (com.netsteadfast.greenstep.vo.AggregationMethodVO)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 MeasureDataVO (com.netsteadfast.greenstep.vo.MeasureDataVO)3 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)3 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)3