this question is a carbon copy of the one in Alfresco Community.
In our company we use Alfresco where we added new TestModel and ListDate property.
Next we use CMIS Apache Chemistry connector that returns list of choices:
When one of these values is chosen for update, error appears. For instance, if we choose the first one (2001-01-05 == 5 of January 2001)
HTTP Status 409 - constraint
Constraint violation: 0418520046 Found 1 integrity violations:
Invalid property value:
Node: workspace://SpacesStore/eaf740b4-d22a-415a-9ca7-f58a8e115dbb
Name: vzv_diff
Type: {TestModel}DiffProperties
Property: {TestModel}ListDate
Constraint: 0418520045 The value is not an allowed value: 1/5/01 12:00 AM
First value in details:
java.util.GregorianCalendar[
time=978681600000,
areFieldsSet=true,
areAllFieldsSet=true,
lenient=true,
zone=sun.util.calendar.ZoneInfo[id="GMT-08:00",offset=-28800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],
firstDayOfWeek=1,
minimalDaysInFirstWeek=1,
ERA=1,
YEAR=2001,
MONTH=0,
WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,
DAY_OF_MONTH=5,DAY_OF_YEAR=5,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=1,
AM_PM=0,
HOUR=0,HOUR_OF_DAY=0,
MINUTE=0,
SECOND=0,
MILLISECOND=0,
ZONE_OFFSET=-28800000,DST_OFFSET=0]
It worth noting that on "Client machine" time adjusted with utc +3, whereas on "Server (where Alfresco is actually installed)" - utc -8.
Our assumption is that Alfresco expected 0:00 am or 0:00 pm and that 12 am is summarized from UTCs scales. Despite the fact that this situation is already weird, adjusting time of that value in any way before update didn't help at all. Let's say, setting hours
calendar.add(Calendar.HOUR_OF_DAY, 12);
results in
HTTP Status 409 - constraint
Constraint violation: 0418520818 Found 1 integrity violations:
Invalid property value:
Node: workspace://SpacesStore/eaf740b4-d22a-415a-9ca7-f58a8e115dbb
Name: vzv_diff
Type: {TestModel}DiffProperties
Property: {TestModel}ListDate
Constraint: 0418520817 The value is not an allowed value: 1/5/01 12:00 PM
Apache Workbench behaves the same way (but it has no choices though): None of variants are suited here.
We have been struggling with this issue for number of days without success.
Please help. Thanks.
The property is having constraint a List of values.You have a wrong understanding of constraints.If you are adding a list constraint , you won't be able to add values which are not listed.
So you won't be able to add date values except the values which you have listed.You need to remove constraints and only need to select the datatype as date.
Adding constraint in d:date type will defiantly give error.Below is the reason for same.
Updated:
First thing , it will check while saving values is list of values, If you pass 2001-01-05 as value than it will allow in case of constraint,but as it is a string value it will not allow to save in d:date.Second thing, if you pass date object of java , than equality comparison on the applied constraint will fail.So you have 2 option in this case.