NIHVIVO-3628 Minor tweaks.

This commit is contained in:
j2blake 2012-02-22 20:33:52 +00:00
parent 1f96d551f5
commit 0b18650ac4

View file

@ -368,7 +368,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
configFilePath = getConfigFilePath(DEFAULT_CONFIG_FILE_NAME); configFilePath = getConfigFilePath(DEFAULT_CONFIG_FILE_NAME);
// Should we test for the existence of the default, and throw an error if it doesn't exist? // Should we test for the existence of the default, and throw an error if it doesn't exist?
} }
setValuesFromConfigFile(configFilePath, op, vreq.getWebappDaoFactory(), editing); setValuesFromConfigFile(configFilePath, vreq.getWebappDaoFactory(), editing);
} catch (Exception e) { } catch (Exception e) {
log.error("Error processing config file " + configFilePath + " for object property " + op.getURI(), e); log.error("Error processing config file " + configFilePath + " for object property " + op.getURI(), e);
@ -388,7 +388,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
" in " + configFilePath + ":\n" + " in " + configFilePath + ":\n" +
configError + " Using default config instead."); configError + " Using default config instead.");
configFilePath = getConfigFilePath(DEFAULT_CONFIG_FILE_NAME); configFilePath = getConfigFilePath(DEFAULT_CONFIG_FILE_NAME);
setValuesFromConfigFile(configFilePath, op, vreq.getWebappDaoFactory(), editing); setValuesFromConfigFile(configFilePath, vreq.getWebappDaoFactory(), editing);
} }
} }
@ -427,12 +427,12 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
return null; return null;
} }
private void setValuesFromConfigFile(String configFilePath, ObjectProperty op, WebappDaoFactory wdf, private void setValuesFromConfigFile(String configFilePath, WebappDaoFactory wdf,
boolean editing) { boolean editing) {
try { try {
FileReader reader = new FileReader(configFilePath); FileReader reader = new FileReader(configFilePath);
CustomListViewConfigFile configFileContents = new CustomListViewConfigFile(reader); CustomListViewConfigFile configFileContents = new CustomListViewConfigFile(reader);
boolean collated = ObjectPropertyTemplateModel.this instanceof CollatedObjectPropertyTemplateModel; boolean collated = ObjectPropertyTemplateModel.this instanceof CollatedObjectPropertyTemplateModel;
selectQuery = configFileContents.getSelectQuery(collated, editing); selectQuery = configFileContents.getSelectQuery(collated, editing);
@ -459,25 +459,25 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
Constructor<?> constructor = clazz.getConstructor(ObjectPropertyTemplateModel.class, WebappDaoFactory.class); Constructor<?> constructor = clazz.getConstructor(ObjectPropertyTemplateModel.class, WebappDaoFactory.class);
return (ObjectPropertyDataPostProcessor) constructor.newInstance(optm, wdf); return (ObjectPropertyDataPostProcessor) constructor.newInstance(optm, wdf);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
log.error("Error processing config file '" + configFilePath log.warn("Error processing config file '" + configFilePath
+ "': can't load postprocessor class '" + className + "': can't load postprocessor class '" + className
+ "'. " + "Using default postprocessor.", e); + "'. " + "Using default postprocessor.", e);
return new DefaultObjectPropertyDataPostProcessor(optm, wdf); return new DefaultObjectPropertyDataPostProcessor(optm, wdf);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
log.error("Error processing config file '" + configFilePath log.warn("Error processing config file '" + configFilePath
+ "': postprocessor class '" + className + "': postprocessor class '" + className
+ "' does not have a constructor that takes " + "' does not have a constructor that takes "
+ "ObjectPropertyTemplateModel and WebappDaoFactory. " + "ObjectPropertyTemplateModel and WebappDaoFactory. "
+ "Using default postprocessor.", e); + "Using default postprocessor.", e);
return new DefaultObjectPropertyDataPostProcessor(optm, wdf); return new DefaultObjectPropertyDataPostProcessor(optm, wdf);
} catch (ClassCastException e) { } catch (ClassCastException e) {
log.error("Error processing config file '" + configFilePath log.warn("Error processing config file '" + configFilePath
+ "': postprocessor class '" + className + "' does " + "': postprocessor class '" + className + "' does "
+ "not implement ObjectPropertyDataPostProcessor. " + "not implement ObjectPropertyDataPostProcessor. "
+ "Using default postprocessor.", e); + "Using default postprocessor.", e);
return new DefaultObjectPropertyDataPostProcessor(optm, wdf); return new DefaultObjectPropertyDataPostProcessor(optm, wdf);
} catch (Exception e) { } catch (Exception e) {
log.error("Error processing config file '" + configFilePath log.warn("Error processing config file '" + configFilePath
+ "': can't create postprocessor instance of class '" + "': can't create postprocessor instance of class '"
+ className + "'. " + "Using default postprocessor.", e); + className + "'. " + "Using default postprocessor.", e);
return new DefaultObjectPropertyDataPostProcessor(optm, wdf); return new DefaultObjectPropertyDataPostProcessor(optm, wdf);