use of com.netsteadfast.greenstep.vo.SysFormMethodVO in project bamboobsc by billchen198318.
the class SystemFormMethodSaveOrUpdateAction method delete.
private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
SysFormMethodVO method = new SysFormMethodVO();
this.transformFields2ValueObject(method, new String[] { "oid" });
DefaultResult<Boolean> result = this.systemFormLogicService.deleteMethod(method);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null && result.getValue()) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.SysFormMethodVO 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.SysFormMethodVO in project bamboobsc by billchen198318.
the class CommonLoadFormAction method execute.
@JSON(serialize = false)
@SystemForm
public String execute() throws Exception {
String resultName = RESULT_SEARCH_NO_DATA;
if (StringUtils.isBlank(form_id) || StringUtils.isBlank(form_method)) {
this.message = "no settings data to init form!";
this.setErrorMessage(this.message);
return resultName;
}
try {
SysFormMethodVO formMethod = SystemFormUtils.findFormMethod(this.form_id, this.form_method);
resultName = formMethod.getResultType();
this.processExpression(formMethod);
} catch (ControllerException ce) {
this.message = ce.getMessage().toString();
this.setErrorMessage(this.message);
} catch (AuthorityException ae) {
this.message = ae.getMessage().toString();
this.setErrorMessage(this.message);
if (FormResultType.DEFAULT.equals(resultName)) {
resultName = RESULT_NO_AUTHORITH;
}
} catch (ServiceException se) {
this.message = se.getMessage().toString();
this.setErrorMessage(this.message);
} catch (Exception e) {
// 因為是 JSON 所以不用拋出 throw e 了
e.printStackTrace();
if (e.getMessage() == null) {
this.message = e.toString();
this.logger.error(e.toString());
} else {
this.message = e.getMessage().toString();
this.logger.error(e.getMessage());
}
this.setErrorMessage(this.message);
this.success = IS_EXCEPTION;
if (FormResultType.DEFAULT.equals(resultName)) {
resultName = ERROR;
}
}
return resultName;
}
use of com.netsteadfast.greenstep.vo.SysFormMethodVO in project bamboobsc by billchen198318.
the class SystemFormUtils method findFormMethod.
public static SysFormMethodVO findFormMethod(String formId, String methodName) throws ServiceException, Exception {
SysFormMethodVO formMethod = new SysFormMethodVO();
formMethod.setFormId(formId);
formMethod.setName(methodName);
DefaultResult<SysFormMethodVO> result = sysFormMethodService.findByUK(formMethod);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
formMethod = result.getValue();
return formMethod;
}
use of com.netsteadfast.greenstep.vo.SysFormMethodVO in project bamboobsc by billchen198318.
the class SystemFormMethodSaveOrUpdateAction method save.
private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
SysFormMethodVO method = new SysFormMethodVO();
method.setExpression(this.getFields().get("expression").getBytes());
this.transformFields2ValueObject(method, new String[] { "name", "resultType", "type", "description" });
DefaultResult<SysFormMethodVO> result = this.systemFormLogicService.createMethod(method, this.getFields().get("formOid"));
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
Aggregations