[
https://issues.apache.org/jira/browse/CAMEL-12334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16409659#comment-16409659
]
ASF GitHub Bot commented on CAMEL-12334:
----------------------------------------
GitHub user zregvart opened a pull request:
https://github.com/apache/camel/pull/2263
CAMEL-12334: Allow customizations of date/time types in generated DTOs
This adds support for using any of the following date/time classes:
- java.util.Date
- java.time.Instant
- java.time.LocalDate
- java.time.ZonedDateTime
- java.time.OffsetDateTime
With this all usage of Jackson `ObjectMapper` and `XStream` instances
goes through the single utility method in `JsonUtils` or `XStreamUtils`
in order to register default serializers/deserializers/converters.
With this customized types can be used instead of default ones for
fields in generated Java DTO classes. The Salesforce Maven plugin now
supports specifying `customTypes` property, for instance:
```xml
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-salesforce-maven-plugin</artifactId>
<configuration>
<!-- ... -->
<customTypes>
<date>java.time.LocalDate</date>
</customTypes>
</configuration>
</plugin>
````
@hemangajmera I've opted to remain on defaults, a lot of client's code
would break otherwise, and allow type customizations instead. Can you have a
look?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zregvart/camel CAMEL-12334
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/2263.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2263
----
commit 23bea747a3b036c1b5ea85a1106719ea51eb21e9
Author: Ajmera, Hemang /External <hemang.ajmera@...>
Date: 2018-03-14T07:25:32Z
CAMEL-12334: Mapped date to LocalDate and time to LocalTime
commit 6f63c8828e94fabbc7b43f636d851c36ac530a55
Author: Ajmera, Hemang /External <hemang.ajmera@...>
Date: 2018-03-20T05:35:12Z
CAMEL-12334: Mapped date to LocalDate and time to OffsetTime. Added
properties to control the behavior
commit ff6b3246567e91bbc8f5f36320fa98e7f44745b1
Author: Zoran Regvart <zregvart@...>
Date: 2018-03-22T08:13:19Z
CAMEL-12334: unify date (de)serialization handling
This adds support for using any of the following date/time classes:
- java.util.Date
- java.time.Instant
- java.time.LocalDate
- java.time.ZonedDateTime
- java.time.OffsetDateTime
With this all usage of Jackson `ObjectMapper` and `XStream` instances
goes through the single utility method in `JsonUtils` or `XStreamUtils`
in order to register default serializers/deserializers/converters.
commit 1cbfa569d1f49ef18323d112a068c0e6d44f19e0
Author: Zoran Regvart <zregvart@...>
Date: 2018-03-22T14:31:44Z
CAMEL-12334: allow customization of types in ge...
...nerated source files
With this customized types can be used instead of default ones for
fields in generated Java DTO classes. The Salesforce Maven plugin now
supports specifying `customTypes` property, for instance:
```xml
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-salesforce-maven-plugin</artifactId>
<configuration>
<!-- ... -->
<customTypes>
<date>java.time.LocalDateTime</date>
</customTypes>
</configuration>
</plugin>
````
----
> Salesforce DTO does not use correct datatype for "date" and "time" field
> ------------------------------------------------------------------------
>
> Key: CAMEL-12334
> URL: https://issues.apache.org/jira/browse/CAMEL-12334
> Project: Camel
> Issue Type: Improvement
> Components: camel-salesforce
> Affects Versions: 2.20.2
> Reporter: Hemang Ajmera
> Assignee: Zoran Regvart
> Priority: Major
> Labels: maven
> Fix For: 2.22.0
>
>
> The DTO classes generated by the Maven plugin uses ZonedDateTime for all three
> * datetime
> * date
> * time
> The generation works fine, but is is not able to marshal/unmarshal correctly.
> The DTO should use different kind of field. My suggestion is to use
> * ZonedDateTime for datetime
> * LocalDate for date
> * LocalTime for time
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)