Search in sources :

Example 76 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class SystemTwitterSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysTwitterVO oldSysTwitter = new SysTwitterVO();
    oldSysTwitter.setOid(this.getFields().get("oid"));
    DefaultResult<SysTwitterVO> oldResult = this.sysTwitterService.findObjectByOid(oldSysTwitter);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    oldSysTwitter = oldResult.getValue();
    SysTwitterVO sysTwitter = new SysTwitterVO();
    sysTwitter.setOid(oldSysTwitter.getOid());
    sysTwitter.setSystem(oldSysTwitter.getSystem());
    sysTwitter.setTitle(this.getFields().get("title"));
    sysTwitter.setEnableFlag(("true".equals(this.getFields().get("enableFlag")) ? YesNo.YES : YesNo.NO));
    // 先清除之前的blob資料
    sysTwitter.setContent(null);
    // 先清除之前的blob資料		
    this.sysTwitterService.updateObject(sysTwitter);
    String content = StringEscapeUtils.unescapeEcmaScript(this.getFields().get("content"));
    sysTwitter.setContent(content.getBytes());
    DefaultResult<SysTwitterVO> result = this.sysTwitterService.updateObject(sysTwitter);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysTwitterVO(com.netsteadfast.greenstep.vo.SysTwitterVO)

Example 77 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class BscBaseLogicServiceCommonSupport method findOrganizationDataByUK.

public static OrganizationVO findOrganizationDataByUK(IOrganizationService<OrganizationVO, BbOrganization, String> service, String orgId) throws ServiceException, Exception {
    if (StringUtils.isBlank(orgId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    OrganizationVO organization = new OrganizationVO();
    organization.setOrgId(orgId);
    DefaultResult<OrganizationVO> orgResult = service.findByUK(organization);
    if (orgResult.getValue() == null) {
        throw new ServiceException(orgResult.getSystemMessage().getValue());
    }
    organization = orgResult.getValue();
    return organization;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO)

Example 78 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class ObjectiveLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<ObjectiveVO> update(ObjectiveVO objective, String perspectiveOid) throws ServiceException, Exception {
    if (null == objective || super.isBlank(objective.getOid()) || super.isBlank(perspectiveOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<ObjectiveVO> oldResult = this.objectiveService.findObjectByOid(objective);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    PerspectiveVO perspective = new PerspectiveVO();
    perspective.setOid(perspectiveOid);
    DefaultResult<PerspectiveVO> pResult = this.perspectiveService.findObjectByOid(perspective);
    if (pResult.getValue() == null) {
        throw new ServiceException(pResult.getSystemMessage().getValue());
    }
    perspective = pResult.getValue();
    objective.setObjId(oldResult.getValue().getObjId());
    objective.setPerId(perspective.getPerId());
    this.setStringValueMaxLength(objective, "description", MAX_DESCRIPTION_LENGTH);
    return this.objectiveService.updateObject(objective);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 79 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class OrganizationLogicServiceImpl method updateParent.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateParent(OrganizationVO organization, String parentOid) throws ServiceException, Exception {
    if (organization == null || super.isBlank(organization.getOid()) || super.isBlank(parentOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(Boolean.FALSE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
    organization = this.findOrganizationData(organization.getOid());
    this.deleteParent(organization);
    if ("root".equals(parentOid) || "r".equals(parentOid)) {
        this.createParent(organization, BscConstants.ORGANIZATION_ZERO_ID);
    } else {
        OrganizationVO newParOrganization = this.findOrganizationData(parentOid);
        // 找當前部門的子部門中的資料, 不因該存在要update的新父部門
        if (this.foundChild(organization.getOrgId(), newParOrganization.getOrgId())) {
            throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
        }
        this.createParent(organization, newParOrganization.getOrgId());
    }
    result.setValue(Boolean.TRUE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 80 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class OrganizationLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<OrganizationVO> update(OrganizationVO organization) throws ServiceException, Exception {
    if (organization == null || super.isBlank(organization.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    this.checkOrganizationIdIsZero(organization);
    OrganizationVO dbOrganization = this.findOrganizationData(organization.getOid());
    organization.setOrgId(dbOrganization.getOrgId());
    this.setStringValueMaxLength(organization, "description", MAX_DESCRIPTION_LENGTH);
    this.handlerLongitudeAndLatitude(organization);
    return this.getOrganizationService().updateObject(organization);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)291 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)91 Transactional (org.springframework.transaction.annotation.Transactional)89 HashMap (java.util.HashMap)65 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)49 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)48 SysVO (com.netsteadfast.greenstep.vo.SysVO)30 IOException (java.io.IOException)24 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)20 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)19 List (java.util.List)19 Map (java.util.Map)19 ArrayList (java.util.ArrayList)17 LinkedHashMap (java.util.LinkedHashMap)17 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)16 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)15 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)15 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)14 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)13 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)12