Hi, thanks for the hint. For future reference here is how I solved my problem: I implemented the moreAttrsToGet and preprocess functions in a PULL_ACTION implementation (in my case in Groovy). In moreAttrsToGet I added the external attributes needed for calculations. In preprocess I built a new SyncDeltaBuilder with additional attributes and values. I then mapped this new external attribute to the internal attribute in mapping.
Mit freundlichen Grüßen Clemens (Bergmann) -- Clemens Bergmann [er/ihm; he/him] Gruppe Nutzermanagement und Entwicklung Technische Universität Darmstadt Hochschulrechenzentrum, Alexanderstraße 2, 64283 Darmstadt Tel. +49 6151 16 71184 http://www.hrz.tu-darmstadt.de/ > -----Ursprüngliche Nachricht----- > Von: Francesco Chicchiriccò <ilgro...@apache.org> > Gesendet: Montag, 15. Juli 2024 09:33 > An: user@syncope.apache.org > Betreff: Re: mapping multiple External attributes to one Internal attribute > > 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/JEXLIt > emTransformerImpl.java#L178 > > [2] > https://github.com/apache/syncope/blob/master/core/provisioning- > api/src/main/java/org/apache/syncope/core/provisioning/api/data/ItemTran > sformer.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/
smime.p7s
Description: S/MIME cryptographic signature