* ]
* },
*/
private static void setTableAttribute(final JSONObject attributes,
final PJsonObject oldRequest, final Template template) throws JSONException {
final TableProcessor tableProcessor = getTableProcessor(template);
PJsonObject oldTablePage = (PJsonObject) getOldTablePage(oldRequest);
if (tableProcessor == null) {
if (oldTablePage == null) {
// no table, no work
return;
} else {
LOGGER.warn("The request json data has attribute information for creating the map but config does not have a" +
"map attribute. Check that the request and the config.yaml are correct.");
return;
}
} else if (oldTablePage == null) {
LOGGER.warn("Configuration expects a table, but no table data is defined in the request");
oldTablePage = new PJsonObject(oldRequest, new JSONObject(), "generated");
}
String tableAttributeName = "table";
if (tableProcessor.getInputMapperBiMap().containsValue("table")) {
tableAttributeName = tableProcessor.getInputMapperBiMap().inverse().get("table");
}
final JSONObject table = new JSONObject();
attributes.put(tableAttributeName, table);