use of com.netsteadfast.greenstep.vo.SysFormTemplateVO 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.SysFormTemplateVO 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.SysFormTemplateVO in project bamboobsc by billchen198318.
the class SystemFormTemplateSaveOrUpdateAction method save.
private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
if (StringUtils.isBlank(this.getFields().get("uploadOid"))) {
super.throwMessage("uploadOid", this.getText("MESSAGE.CORE_PROG001D0012A_uploadOid"));
}
SysFormTemplateVO template = new SysFormTemplateVO();
this.transformFields2ValueObject(template, new String[] { "tplId", "name", "description" });
DefaultResult<SysFormTemplateVO> result = this.systemFormLogicService.createTmplate(template, this.getFields().get("uploadOid"));
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.SysFormTemplateVO in project bamboobsc by billchen198318.
the class SystemFormTemplateSaveOrUpdateAction method update.
private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
SysFormTemplateVO template = new SysFormTemplateVO();
this.transformFields2ValueObject(template, new String[] { "oid", "tplId", "name", "description" });
DefaultResult<SysFormTemplateVO> result = this.systemFormLogicService.updateTemplate(template, this.getFields().get("uploadOid"));
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.SysFormTemplateVO in project bamboobsc by billchen198318.
the class SystemFormTemplateSaveOrUpdateAction method copy2Upload.
private void copy2Upload() throws ControllerException, AuthorityException, ServiceException, Exception {
SysFormTemplateVO template = new SysFormTemplateVO();
this.transformFields2ValueObject(template, new String[] { "oid" });
DefaultResult<SysFormTemplateVO> result = this.sysFormTemplateService.findObjectByOid(template);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
template = result.getValue();
this.uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, template.getContent(), template.getFileName());
this.message = SysMessageUtil.get(GreenStepSysMsgConstants.INSERT_SUCCESS);
this.success = IS_YES;
}
Aggregations