From c0062ce189df092990117ddb2fcdb35dd491817d Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Thu, 30 Aug 2012 20:59:48 +0000 Subject: [PATCH] handling editing in page management where one content type is deleted and another is added in its place (added code to force new uri for data getter variable for added content in editing situation) --- .../preprocessors/ManagePagePreprocessor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java index ec773cc94..85fb8629d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java @@ -255,13 +255,18 @@ public class ManagePagePreprocessor extends if(editConfiguration.isParamUpdate()) { //Although this is editing an existing page, new content might have been added which would not include //existing data getter URIs, so important to check whether the key exists within the json object in the first place + String dataGetterURISubmissionName = pn.getDataGetterVarName(counter); if(jsonObject.containsKey("URI")) { String URIValue = jsonObject.getString("URI"); if(URIValue != null) { log.debug("Existing URI for data getter found: " + URIValue); - String dataGetterURISubmissionName = pn.getDataGetterVarName(counter); submission.addUriToForm(editConfiguration, dataGetterURISubmissionName, new String[]{URIValue}); } + } else { + //if the URI is not included in the json object, this is a NEW data getter + //and as such as we must ensure the URI is created + submission.addUriToForm(editConfiguration, dataGetterURISubmissionName, new String[]{EditConfigurationConstants.NEW_URI_SENTINEL}); + } }