From 668f370f73683032a6bf72696de69a9c26d79c8c Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Fri, 2 Mar 2012 13:59:54 -0800 Subject: [PATCH] NOJIRA - some diagnostic logging to determine how Nuxeo handles xs:date vs. xs:datetime. --- .../common/document/DocumentUtils.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java index 25ae83614..3037f290b 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java @@ -588,7 +588,23 @@ public class DocumentUtils { parent.appendChild(element); // extract the element content if (type.isSimpleType()) { - element.setTextContent(type.encode(value)); + String encodedVal = type.encode(value); + /* + * We need a way to produce just a Date when the specified data + * type is an xs:date vs. xs:datetime. Nuxeo maps both to a Calendar. Sigh. + if(logger.isTraceEnabled() && isDateType(type)) { + String dateValType = "unknown"; + if (value instanceof java.util.Date) { + dateValType = "java.util.Date"; + } else if (value instanceof java.util.Calendar) { + dateValType = "java.util.Calendar"; + } + logger.trace("building XML for date type: "+type.getName() + +" value type: "+dateValType + +" encoded: "+encodedVal); + } + */ + element.setTextContent(encodedVal); } else if (type.isComplexType()) { ComplexType ctype = (ComplexType) type; if (ctype.getName().equals(TypeConstants.CONTENT)) { -- 2.47.3