Search in sources :

Example 1 with SysCtxBeanVO

use of com.netsteadfast.greenstep.vo.SysCtxBeanVO in project bamboobsc by billchen198318.

the class SystemContextBeanSaveOrUpdateAction method delete.

private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
    SysCtxBeanVO ctxBean = new SysCtxBeanVO();
    this.transformFields2ValueObject(ctxBean, new String[] { "oid" });
    DefaultResult<Boolean> result = this.systemContextBeanLogicService.delete(ctxBean);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null && result.getValue()) {
        this.success = IS_YES;
    }
}
Also used : SysCtxBeanVO(com.netsteadfast.greenstep.vo.SysCtxBeanVO)

Example 2 with SysCtxBeanVO

use of com.netsteadfast.greenstep.vo.SysCtxBeanVO in project bamboobsc by billchen198318.

the class SystemContextBeanManagmentAction method loadSysCtxBeanData.

private void loadSysCtxBeanData() throws ServiceException, Exception {
    this.transformFields2ValueObject(sysCtxBean, new String[] { "oid" });
    DefaultResult<SysCtxBeanVO> result = this.sysCtxBeanService.findObjectByOid(sysCtxBean);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysCtxBean = result.getValue();
    SysVO sys = new SysVO();
    sys.setSysId(this.sysCtxBean.getSystem());
    DefaultResult<SysVO> sResult = this.sysService.findByUK(sys);
    if (sResult.getValue() != null) {
        this.selectValue = sResult.getValue().getOid();
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysCtxBeanVO(com.netsteadfast.greenstep.vo.SysCtxBeanVO) SysVO(com.netsteadfast.greenstep.vo.SysVO)

Example 3 with SysCtxBeanVO

use of com.netsteadfast.greenstep.vo.SysCtxBeanVO in project bamboobsc by billchen198318.

the class SystemContextBeanSaveOrUpdateAction method save.

private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysCtxBeanVO ctxBean = new SysCtxBeanVO();
    this.transformFields2ValueObject(ctxBean, new String[] { "className", "type", "description" });
    DefaultResult<SysCtxBeanVO> result = this.systemContextBeanLogicService.create(ctxBean, this.getFields().get("systemOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysCtxBeanVO(com.netsteadfast.greenstep.vo.SysCtxBeanVO)

Example 4 with SysCtxBeanVO

use of com.netsteadfast.greenstep.vo.SysCtxBeanVO in project bamboobsc by billchen198318.

the class SystemContextBeanLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysCtxBeanVO> update(SysCtxBeanVO ctxBean, String systemOid) throws ServiceException, Exception {
    if (ctxBean == null || super.isBlank(ctxBean.getOid()) || super.isBlank(systemOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysVO sys = new SysVO();
    sys.setOid(systemOid);
    DefaultResult<SysVO> sResult = this.sysService.findObjectByOid(sys);
    if (sResult.getValue() == null) {
        throw new ServiceException(sResult.getSystemMessage().getValue());
    }
    sys = sResult.getValue();
    ctxBean.setSystem(sys.getSysId());
    DefaultResult<SysCtxBeanVO> anotherResult = this.sysCxtBeanService.findByUK(ctxBean);
    if (anotherResult.getValue() != null) {
        // 有另一筆相同UK的資料, 但OID不同, 所以這次update 是不允許的
        if (!anotherResult.getValue().getOid().equals(ctxBean.getOid())) {
            throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_IS_EXIST));
        }
    }
    if (super.defaultString(ctxBean.getDescription()).length() > MAX_DESCRIPTION_LENGTH) {
        ctxBean.setDescription(ctxBean.getDescription().substring(0, MAX_DESCRIPTION_LENGTH));
    }
    return this.sysCxtBeanService.updateObject(ctxBean);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysCtxBeanVO(com.netsteadfast.greenstep.vo.SysCtxBeanVO) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with SysCtxBeanVO

use of com.netsteadfast.greenstep.vo.SysCtxBeanVO in project bamboobsc by billchen198318.

the class SystemContextBeanSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysCtxBeanVO ctxBean = new SysCtxBeanVO();
    this.transformFields2ValueObject(ctxBean, new String[] { "oid", "className", "type", "description" });
    DefaultResult<SysCtxBeanVO> result = this.systemContextBeanLogicService.update(ctxBean, this.getFields().get("systemOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysCtxBeanVO(com.netsteadfast.greenstep.vo.SysCtxBeanVO)

Aggregations

SysCtxBeanVO (com.netsteadfast.greenstep.vo.SysCtxBeanVO)5 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)2 SysVO (com.netsteadfast.greenstep.vo.SysVO)2 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 Transactional (org.springframework.transaction.annotation.Transactional)1