Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If we need to grab the plugin's default properties or to inject appDef, request object, etc then these excerpts from the method "executePostFormSubmissionProccessor" is becomes necessary.

Code Block
linenumberstrue
Map propertiesMap = null;
                        
//get form json again to retrieve plugin properties
FormDefinitionDao formDefinitionDao = (FormDefinitionDao) FormUtil.getApplicationContext().getBean("formDefinitionDao");
FormDefinition formDefinition = formDefinitionDao.loadById(form.getPropertyString(FormUtil.PROPERTY_ID), appDef);
if (formDefinition != null) {
	String json = formDefinition.getJson();
	JSONObject obj = new JSONObject(json);
	JSONObject objProperty = obj.getJSONObject(FormUtil.PROPERTY_PROPERTIES);
	if (objProperty.has(FormUtil.PROPERTY_POST_PROCESSOR)) {
		JSONObject objProcessor = objProperty.getJSONObject(FormUtil.PROPERTY_POST_PROCESSOR);
		json = objProcessor.getString(FormUtil.PROPERTY_PROPERTIES);
		propertiesMap = AppPluginUtil.getDefaultProperties(p, json, appDef, ass);
	}
}
if (propertiesMap == null) {
	propertiesMap = AppPluginUtil.getDefaultProperties(p, (Map) temp.get(FormUtil.PROPERTY_PROPERTIES), appDef, ass);
}
if (ass != null) {
	propertiesMap.put("workflowAssignment", ass);
}
propertiesMap.put("recordId", formData.getPrimaryKeyValue());
propertiesMap.put("pluginManager", pluginManager);
propertiesMap.put("appDef", appDef);
// add HttpServletRequest into the property map
try {
	HttpServletRequest request = WorkflowUtil.getHttpServletRequest();
	if (request != null) {
		propertiesMap.put("request", request);
	}
} catch (Exception e) {
	// ignore if class is not found
}

...