Fixing RDF edit on session experation. VIVO-186

This commit is contained in:
Brian Caruso 2013-07-17 15:03:28 -04:00
parent 68284acd99
commit 38e6146390
2 changed files with 30 additions and 1 deletions

View file

@ -61,7 +61,7 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
//get the EditConfiguration //get the EditConfiguration
EditConfigurationVTwo configuration = EditConfigurationUtils.getEditConfiguration(vreq); EditConfigurationVTwo configuration = EditConfigurationUtils.getEditConfiguration(vreq);
if(configuration == null) if(configuration == null)
throw new Error("No edit configuration found."); return handleMissingConfiguration(vreq);
//get the EditSubmission //get the EditSubmission
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq.getParameterMap(), configuration); MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq.getParameterMap(), configuration);
@ -178,6 +178,17 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
return null; //no errors return null; //no errors
} }
/**
* If the edit configuration cannot be found in the Session,
* show a message and display any request parameters so that the user's
* efforts won't be lost.
*/
protected ResponseValues handleMissingConfiguration(VitroRequest vreq){
Map<String,Object> map = new HashMap<String,Object>();
map.put("params",vreq.getParameterMap());
return new TemplateResponseValues( "missingEditConfig.ftl", map );
}
//Move to EditN3Utils but keep make new uris here //Move to EditN3Utils but keep make new uris here
public static class Utilities { public static class Utilities {
@ -313,4 +324,5 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
} }
} }

View file

@ -0,0 +1,17 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<p>Unable to process the edit, possibly due to session experation.</p>
<#list params?keys as key>
<#if key != "editKey">
<div id=${key}>
<h2>${key}</h2>
<#list params[key] as value>
<p>${value}</p>
</#list>
</div>
</#if>
</#list>