[ 
https://issues.apache.org/jira/browse/SYNCOPE-1430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Patricelli updated SYNCOPE-1430:
---------------------------------------
    Affects Version/s: 2.0.12
                       2.1.3

> Transformer from A type different from String does not work 
> ------------------------------------------------------------
>
>                 Key: SYNCOPE-1430
>                 URL: https://issues.apache.org/jira/browse/SYNCOPE-1430
>             Project: Syncope
>          Issue Type: Bug
>    Affects Versions: 2.0.12, 2.1.3
>            Reporter: Andrea Patricelli
>            Priority: Major
>             Fix For: 2.0.13, 2.1.4, 3.0.0
>
>
> # Login as admin to console
>  2. Define a connector and a resource (say resource-ldap on embedded mode). 
>  3. Create a USER mapping and map, for example, a Date attribute (say 
> loginDate) with a string value on the resource (say street on ldap, does not 
> matter the meaning)
>  # Define a JEXL transformer for that mapping row like this 
> {code:java}
> value.toString().contains("T") ? 
> value.toString().split("T")[0].replaceAll("-", "") : value  {code}
> Or a Java/Groovy transformer with this beforePropagation:
> {code:java}
> @Override public List<PlainAttrValue> beforePropagation( final Item item, 
> final Entity entity, final List<PlainAttrValue> values) { if (values != null 
> && !values.isEmpty()) { values.forEach(value -> { Date originalValue = 
> value.getDateValue(); if (originalValue != null) { 
> value.setBinaryValue(null); value.setBooleanValue(null); 
> value.setDateValue(null); value.setDoubleValue(null); 
> value.setLongValue(null); 
> value.setStringValue(dateWithoutTimeConverter(values.get(0).getDateValue())); 
> } }); } return values; }{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to