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);
}
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;
}
}
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;
}
}
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);
}
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();
}
Aggregations