On 14/07/24 18:44, Bergmann, Clemens wrote:
Hi, I am currently working on a source with the csvdir connid connector but I have troubles mapping multiple external attributes to one internal attribute. There are two different use cases that I both can’t get to work. 1. In use one case the source is delivering multiple values of the same kind in different attributes (let’s say “name1”, “name2”, “name3”) that I want to map to multiple values in one internal attribute. 2. The other use case is combining the values of multiple attributes (let’s say “street”, “zipcode”, “city”) into one value of one internal attribute “address” in the form “street + ‘;’ zipcode + ‘;’ + city ”. It seems that JEXL [1] or other ItemTransformers [2] can only access the values of the mapped source attribute and all attributes of the internal EntityTO but not other external attributes. I also tried to add multiple mapping rules with the same internal attribute but different external ones. That seems to work on the first reconciliation and the internal attribute has multiple values but on the second reconciliation all but one are deleted. I know that a mapping like this would be hard to do in reverse but in this case we only pull from the source so this would be no practical problem. Nevertheless this could be the reason why this is not easy from a conceptual point of view. The only other way I can think about is mapping the values one on one and then combining the values with a derived attribute after importing. This however would result in duplicate attributes which I would prefer to not do. Is there another way?
Hi Clemens, when you need to customize the pull process with something that only real code can do, the Pull Actions [3] implementations are there to help. Just add to your generated Maven project the new Java or Groovy class following the provided samples and you will have the chance to do more than bare mapping can do. I'd think that implementing only the beforeProvision() method should be enough for your purpose. HTH Regards
[1] https://github.com/apache/syncope/blob/master/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java#L178 [2] https://github.com/apache/syncope/blob/master/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ItemTransformer.java#L63
[3] https://syncope.apache.org/docs/3.0/reference-guide.html#pullactions -- Francesco Chicchiriccò Tirasa - Open Source Excellence http://www.tirasa.net/ Member at The Apache Software Foundation Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail http://home.apache.org/~ilgrosso/