From ece106d1d80a8b1109704fa76d85dacd4e1cd3c8 Mon Sep 17 00:00:00 2001 From: Frederik Heremans Date: Mon, 21 May 2012 12:40:09 +0000 Subject: [PATCH] ALF-10243: form-service date-control now allows configuring only to send date-component of "date-only" formfields (timezone and time-component is reset server-side to prevent unnecesairy timezone-issues) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@36623 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../processor/workflow/TypedPropertyValueGetter.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/java/org/alfresco/repo/forms/processor/workflow/TypedPropertyValueGetter.java b/source/java/org/alfresco/repo/forms/processor/workflow/TypedPropertyValueGetter.java index ac31a647b4..37a1f30f5b 100644 --- a/source/java/org/alfresco/repo/forms/processor/workflow/TypedPropertyValueGetter.java +++ b/source/java/org/alfresco/repo/forms/processor/workflow/TypedPropertyValueGetter.java @@ -23,11 +23,13 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.TimeZone; import org.alfresco.repo.forms.FormException; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; +import org.alfresco.util.ISO8601DateFormat; import org.json.JSONArray; import org.json.JSONException; import org.springframework.extensions.surf.util.I18NUtil; @@ -64,6 +66,11 @@ public class TypedPropertyValueGetter { return processLocaleValue(value); } + else if(isDateProperty(propDef) && value instanceof String && !ISO8601DateFormat.isTimeComponentDefined((String) value)) + { + // Special handling for day-only date storage (ALF-10243) + return ISO8601DateFormat.parseDayOnly((String) value, TimeZone.getDefault()); + } else if (value instanceof String) { String valStr = (String) value; @@ -119,6 +126,11 @@ public class TypedPropertyValueGetter { return propDef.getDataType().getName().equals(DataTypeDefinition.BOOLEAN); } + + private boolean isDateProperty(PropertyDefinition propDef) + { + return propDef.getDataType().getName().equals(DataTypeDefinition.DATE); + } private Serializable processLocaleValue(Object value) {