Search in sources :

Example 1 with SysFormVO

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

the class SystemFormLogicServiceImpl method createMethod.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysFormMethodVO> createMethod(SysFormMethodVO formMethod, String formOid) throws ServiceException, Exception {
    if (null == formMethod || super.isBlank(formOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysFormVO form = this.findForm(formOid);
    super.setStringValueMaxLength(formMethod, "description", MAX_DESCRIPTION_LENGTH);
    formMethod.setFormId(form.getFormId());
    return this.sysFormMethodService.saveObject(formMethod);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysFormVO(com.netsteadfast.greenstep.vo.SysFormVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with SysFormVO

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

the class SystemFormSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysFormVO form = new SysFormVO();
    this.transformFields2ValueObject(form, new String[] { "oid", "formId", "name", "description" });
    DefaultResult<SysFormVO> result = this.systemFormLogicService.update(form, this.getFields().get("templateOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysFormVO(com.netsteadfast.greenstep.vo.SysFormVO)

Example 3 with SysFormVO

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

the class SystemFormSaveOrUpdateAction method save.

private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysFormVO form = new SysFormVO();
    this.transformFields2ValueObject(form, new String[] { "formId", "name", "description" });
    DefaultResult<SysFormVO> result = this.systemFormLogicService.create(form, this.getFields().get("templateOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysFormVO(com.netsteadfast.greenstep.vo.SysFormVO)

Example 4 with SysFormVO

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

the class SystemFormLogicServiceImpl method updateMethod.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysFormMethodVO> updateMethod(SysFormMethodVO formMethod, String formOid) throws ServiceException, Exception {
    if (null == formMethod || super.isBlank(formMethod.getOid()) || super.isBlank(formOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<SysFormMethodVO> oldResult = this.sysFormMethodService.findObjectByOid(formMethod);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    SysFormVO form = this.findForm(formOid);
    formMethod.setFormId(form.getFormId());
    // check UK(same "name" and "formId" ) is found. because can update formMethod's UK , so need to check it.
    DefaultResult<SysFormMethodVO> ukResult = this.sysFormMethodService.findByUK(formMethod);
    if (ukResult.getValue() != null) {
        if (!ukResult.getValue().getOid().equals(formMethod.getOid())) {
            // same UK found, but is another data.
            throw new ServiceException("Please change another name!");
        }
    }
    // clear blob expression
    oldResult.getValue().setExpression(null);
    this.sysFormMethodService.updateObject(oldResult.getValue());
    super.setStringValueMaxLength(formMethod, "description", MAX_DESCRIPTION_LENGTH);
    return this.sysFormMethodService.updateObject(formMethod);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysFormVO(com.netsteadfast.greenstep.vo.SysFormVO) SysFormMethodVO(com.netsteadfast.greenstep.vo.SysFormMethodVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with SysFormVO

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

the class SystemFormLogicServiceImpl method findForm.

private SysFormVO findForm(String formOid) throws ServiceException, Exception {
    SysFormVO form = new SysFormVO();
    form.setOid(formOid);
    DefaultResult<SysFormVO> formResult = this.sysFormService.findObjectByOid(form);
    if (formResult.getValue() == null) {
        throw new ServiceException(formResult.getSystemMessage().getValue());
    }
    return formResult.getValue();
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysFormVO(com.netsteadfast.greenstep.vo.SysFormVO)

Aggregations

SysFormVO (com.netsteadfast.greenstep.vo.SysFormVO)10 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)6 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)3 SysFormTemplateVO (com.netsteadfast.greenstep.vo.SysFormTemplateVO)3 Transactional (org.springframework.transaction.annotation.Transactional)3 SysFormMethodVO (com.netsteadfast.greenstep.vo.SysFormMethodVO)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1