syncope-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Patricelli (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SYNCOPE-1430) Transformer from A type different from String does not work
Date Mon, 28 Jan 2019 14:27:00 GMT

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

Andrea Patricelli updated SYNCOPE-1430:
---------------------------------------
    Description: 
# 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}

  was:
# 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:


> 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
>            Reporter: Andrea Patricelli
>            Priority: Major
>
> # 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)

Mime
View raw message