diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties index 22d0426b4b..d315370d7b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties @@ -7,5 +7,4 @@ module.aliases=org_alfresco_module_dod5015 module.title=Records Management module.description=Alfresco Record Management Extension module.version=${rm.module.version} - -module.repo.version.min=6.0 \ No newline at end of file +module.repo.version.min=${rm.module.repo.version.min} \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml index 31ae1964ff..900c93fba3 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml @@ -215,4 +215,20 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomDateTimeSerializer.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomDateTimeSerializer.java new file mode 100644 index 0000000000..2d75f5ec5d --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomDateTimeSerializer.java @@ -0,0 +1,73 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rm.rest.api.util; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +/** + * Custom Date Time serializer for formatting org.joda.time.DateTime + * + * @author Rodica Sutu + * @since 3.0 + */ +public class CustomDateTimeSerializer extends StdSerializer +{ + /** Date time format */ + private final static DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + + public CustomDateTimeSerializer() + { + super(DateTime.class); + } + + protected CustomDateTimeSerializer(Class t) + { + super(t); + } + + /** + * Custom serialize method to convert the org.joda.time.DateTime into string value using the DATE_TIME_FORMAT + * + * @param value datetime value + * @param jgen + * @param provider + * @throws IOException + */ + @Override + public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException + { + jgen.writeString(DATE_TIME_FORMAT.print(value)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateSerializer.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateSerializer.java new file mode 100644 index 0000000000..f10fd69cd4 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateSerializer.java @@ -0,0 +1,73 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rm.rest.api.util; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +/** + * Custom Local Date serializer for formatting org.joda.time.LocalDate + * + * @author Rodica Sutu + * @since 3.0 + */ +public class CustomLocalDateSerializer extends StdSerializer +{ + /** Local date format */ + private final static DateTimeFormatter DATE_FORMAT = DateTimeFormat.forPattern("yyyy-MM-dd"); + + public CustomLocalDateSerializer() + { + super(LocalDate.class); + } + + protected CustomLocalDateSerializer(Class t) + { + super(t); + } + + /** + * Custom serialize method to convert the org.joda.time.LocalDate into string value using the DATE_FORMAT + * + * @param value local date value + * @param jgen + * @param provider + * @throws IOException + */ + @Override + public void serialize(LocalDate value, JsonGenerator jgen, SerializerProvider provider) throws IOException + { + jgen.writeString(DATE_FORMAT.print(value)); + } +} \ No newline at end of file