From 18361c6fd40f1cf9d2d2a14a87df151432efac4e Mon Sep 17 00:00:00 2001 From: Larry Gouger Date: Mon, 25 Apr 2016 09:43:30 -0700 Subject: [PATCH 1/2] added .slcache and .sha1 on zip file --- .gitignore | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39bf8dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Eclipse +.classpath +.project +.gradle +.slcache +build/ +.settings/ +target-eclipse/ + +# Intellij +.idea/ +*.iml +*.iws + +*.log +test/reports +target +/docs +.DS_Store +plugin.xml +*.zip +*.zip.sha1 +web-app +*~ From 7766e64213b13e43c246cefd489855d5c6324c46 Mon Sep 17 00:00:00 2001 From: Larry Gouger Date: Mon, 25 Apr 2016 09:55:03 -0700 Subject: [PATCH 2/2] it's ok if the field name doesn't exist as long a formatter with the name exists. --- .../export/exporter/AbstractExporter.groovy | 2 +- .../export/exporter/ExporterUtil.groovy | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/groovy/de/andreasschmitt/export/exporter/AbstractExporter.groovy b/src/groovy/de/andreasschmitt/export/exporter/AbstractExporter.groovy index b7e82f1..4157778 100644 --- a/src/groovy/de/andreasschmitt/export/exporter/AbstractExporter.groovy +++ b/src/groovy/de/andreasschmitt/export/exporter/AbstractExporter.groovy @@ -37,7 +37,7 @@ abstract class AbstractExporter implements Exporter { } protected Object getValue(Object domain, String field){ - return formatValue(domain, ExporterUtil.getNestedValue(domain, field), field) + return formatValue(domain, ExporterUtil.getNestedValue(domain, field, formatters?.containsKey(field)), field) } protected Writer getOutputStreamWriter(OutputStream outputStream) { diff --git a/src/groovy/de/andreasschmitt/export/exporter/ExporterUtil.groovy b/src/groovy/de/andreasschmitt/export/exporter/ExporterUtil.groovy index 8ebbc00..68eb61b 100644 --- a/src/groovy/de/andreasschmitt/export/exporter/ExporterUtil.groovy +++ b/src/groovy/de/andreasschmitt/export/exporter/ExporterUtil.groovy @@ -24,7 +24,7 @@ class ExporterUtil { throw new AssertionError() } - public static Object getNestedValue(Object domain, String field){ + public static Object getNestedValue(Object domain, String field, boolean hasFormatter){ try { // Doesn't work for dynamic properties such as tags used in taggable return PropertyUtils.getProperty(domain, field) @@ -35,13 +35,14 @@ class ExporterUtil { int i = 0 def lastProp + def lastE for(prop in subProps){ if(i == 0){ try { lastProp = domain?."$prop" } catch(Exception e){ - log.info("Couldn't retrieve property ${prop}", e) + lastE = e } } else { @@ -49,11 +50,15 @@ class ExporterUtil { lastProp = lastProp?."$prop" } catch(Exception e){ - log.info("Couldn't retrieve property ${prop}", e) + lastE = e } } i += 1 } + + if (lastE && !hasFormatter) { + log.info("Couldn't retrieve property ${field}", lastE) + } return lastProp }