Skip to content

Commit

Permalink
Fix QuickImport to enforce converter as declared (attribute->customer)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbb555 committed Jun 25, 2019
1 parent 9663f49 commit c358e46
Showing 1 changed file with 14 additions and 42 deletions.
Expand Up @@ -18,11 +18,6 @@
import org.skyve.domain.types.TimeOnly;
import org.skyve.domain.types.Timestamp;
import org.skyve.domain.types.converters.Converter;
import org.skyve.domain.types.converters.datetime.DD_MMM_YYYY_HH24_MI;
import org.skyve.domain.types.converters.datetime.DD_MM_YYYY_HH24_MI;
import org.skyve.domain.types.converters.timestamp.DD_MMM_YYYY_HH24_MI_SS;
import org.skyve.domain.types.converters.timestamp.DD_MM_YYYY_HH24_MI_SS;
import org.skyve.domain.types.converters.timestamp.DD_MM_YYYY_HH_MI_SS;
import org.skyve.impl.bizport.DataFileField.LoadAction;
import org.skyve.impl.metadata.model.document.field.ConvertableField;
import org.skyve.metadata.customer.Customer;
Expand Down Expand Up @@ -676,48 +671,25 @@ public <T extends Bean> T beanResult() throws Exception {
Util.LOGGER.info("Loading String value " + displayValue + " using Skyve converter " + field.getConverter().toString());
}
if (displayValue != null && displayValue.trim().length() > 0) {
if (this instanceof POISheetLoader) {
// handle rubbish values from Excel, ignore converter and use default constructor
switch (field.getAttribute().getAttributeType()) {
case date:
break;
case dateTime:
// process of elimination based on whatever excel thinks it should send in
DD_MM_YYYY_HH24_MI_SS c1 = new DD_MM_YYYY_HH24_MI_SS();
loadValue = c1.fromDisplayValue(displayValue);
if (loadValue == null) {
DD_MM_YYYY_HH_MI_SS c2 = new DD_MM_YYYY_HH_MI_SS();
loadValue = c2.fromDisplayValue(displayValue);
}
if (loadValue == null) {
DD_MM_YYYY_HH24_MI c2 = new DD_MM_YYYY_HH24_MI();
loadValue = c2.fromDisplayValue(displayValue);
}
if (loadValue == null) {
DD_MM_YYYY_HH_MI_SS c2 = new DD_MM_YYYY_HH_MI_SS();
loadValue = c2.fromDisplayValue(displayValue);
}
if (loadValue == null) {
DD_MMM_YYYY_HH24_MI_SS c2 = new DD_MMM_YYYY_HH24_MI_SS();
loadValue = c2.fromDisplayValue(displayValue);
}
if (loadValue == null) {
DD_MMM_YYYY_HH24_MI c2 = new DD_MMM_YYYY_HH24_MI();
loadValue = c2.fromDisplayValue(displayValue);
}

loadValue = new DateTime(getDateFieldValue(fieldIndex));
break;
default:
loadValue = field.getConverter().fromDisplayValue(displayValue.trim());
break;
try {
loadValue = field.getConverter().fromDisplayValue(displayValue);
} catch (Exception e) {
Util.LOGGER.info("Loading String value " + displayValue + " using Skyve converter " + field.getConverter().toString() + " FAILED");
}

if(loadValue==null) {
try {
Date d = getDateFieldValue(fieldIndex);
loadValue = new DateTime(d);
} catch (Exception e) {
Util.LOGGER.info("Loading String value " + displayValue + " using default conversion FAILED");
}
} else {
loadValue = field.getConverter().fromDisplayValue(displayValue.trim());
}
if (debugMode) {
Util.LOGGER.info("Converted value = " + loadValue);
}
} else {
Util.LOGGER.info("Null display value found");
}
} catch (Exception e) {
what.append(" The value ");
Expand Down

0 comments on commit c358e46

Please sign in to comment.