use of com.netsteadfast.greenstep.vo.SysFormVO in project bamboobsc by billchen198318.
the class SystemFormLogicServiceImpl method update.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysFormVO> update(SysFormVO form, String templateOid) throws ServiceException, Exception {
if (null == form || super.isBlank(templateOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<SysFormVO> oldResult = this.sysFormService.findObjectByOid(form);
if (oldResult.getValue() == null) {
throw new ServiceException(oldResult.getSystemMessage().getValue());
}
form.setFormId(oldResult.getValue().getFormId());
super.setStringValueMaxLength(form, "description", MAX_DESCRIPTION_LENGTH);
SysFormTemplateVO template = this.findTemplate(templateOid);
form.setTemplateId(template.getTplId());
return this.sysFormService.updateObject(form);
}
use of com.netsteadfast.greenstep.vo.SysFormVO in project bamboobsc by billchen198318.
the class SystemFormUtils method processExpression.
public static Map<String, String> processExpression(SysFormMethodVO formMethod, Object actionObj, Map<String, Object> actionDatas, PageOf pageOf, SearchValue searchValue, List<Map<String, String>> items, Map<String, String> fields, List<String> fieldsId, Map<String, String> fieldsMessage, HttpServletRequest request) throws ControllerException, ServiceException, Exception {
Map<String, String> resultMap = new HashMap<String, String>();
SysFormVO form = findForm(formMethod.getFormId());
String expression = new String(formMethod.getExpression(), Constants.BASE_ENCODING);
Map<String, Object> paramMap = getParameters(formMethod, actionObj, actionDatas, pageOf, searchValue, items, fields, fieldsId, fieldsMessage);
ScriptExpressionUtils.execute(formMethod.getType(), expression, null, paramMap);
if (FormResultType.DEFAULT.equals(formMethod.getResultType())) {
SysFormTemplateVO template = findTemplate(form.getTemplateId());
setViewPage(resultMap, FORM_PAGE_PATH + template.getFileName());
String pageFileFullPath = request.getSession().getServletContext().getRealPath("/");
pageFileFullPath += FORM_PAGE_PATH + template.getFileName();
File file = new File(pageFileFullPath);
if (!file.exists() || getEnableTemplateFileReWriteAlways()) {
if (!file.exists()) {
logger.warn("no template file: " + pageFileFullPath);
}
file = null;
writePage(template, request);
}
file = null;
}
if (FormResultType.JSON.equals(formMethod.getResultType())) {
setJsonValue(resultMap, (String) ((Map<String, Object>) paramMap.get("datas")).get("jsonMessage"), (String) ((Map<String, Object>) paramMap.get("datas")).get("jsonSuccess"));
}
if (FormResultType.REDIRECT.equals(formMethod.getResultType())) {
setRedirectUrl(resultMap, (String) ((Map<String, Object>) paramMap.get("datas")).get("redirectUrl"));
}
return resultMap;
}
use of com.netsteadfast.greenstep.vo.SysFormVO in project bamboobsc by billchen198318.
the class SystemFormUtils method findForm.
public static SysFormVO findForm(String formId) throws ServiceException, Exception {
SysFormVO form = new SysFormVO();
form.setFormId(formId);
DefaultResult<SysFormVO> result = sysFormService.findByUK(form);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
form = result.getValue();
return form;
}
use of com.netsteadfast.greenstep.vo.SysFormVO in project bamboobsc by billchen198318.
the class SystemFormSaveOrUpdateAction method delete.
private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
SysFormVO form = new SysFormVO();
this.transformFields2ValueObject(form, new String[] { "oid" });
DefaultResult<Boolean> result = this.systemFormLogicService.delete(form);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null && result.getValue()) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.SysFormVO in project bamboobsc by billchen198318.
the class SystemFormManagementAction method loadFormData.
private void loadFormData() throws ServiceException, Exception {
this.transformFields2ValueObject(this.form, new String[] { "oid" });
DefaultResult<SysFormVO> result = this.sysFormService.findObjectByOid(form);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.form = result.getValue();
SysFormTemplateVO template = new SysFormTemplateVO();
template.setTplId(this.form.getTemplateId());
DefaultResult<SysFormTemplateVO> tplResult = this.sysFormTemplateService.findByUK(template);
if (tplResult.getValue() != null) {
this.getFields().put("templateOid", tplResult.getValue().getOid());
}
}
Aggregations