<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I believe I've set something similar in our CSV sample:<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/Evolveum/midpoint/raw/master/samples/resources/csvfile/localhost-csvfile-resource-advanced-nosync-2.xml">https://github.com/Evolveum/midpoint/raw/master/samples/resources/csvfile/localhost-csvfile-resource-advanced-nosync-2.xml</a><br>
<br>
See the comments for expression description. This was from our real
customer setup. I see now that I'd probably use
basic.norm(basic.stringify(...)) to get rid of diacritics.<br>
<br>
<outbound><br>
<source><br>
<name>tmpGivenName</name><br>
<path>$user/givenName</path><br>
</source><br>
<source><br>
<name>tmpFamilyName</name><br>
<path>$user/familyName</path><br>
</source><br>
<expression><br>
<script><br>
<code><br>
<!-- Generate user name:<br>
- FamilyName + GivenName initial (1 character)<br>
- no diacritics, all lower case (normalized)<br>
- max. length 12 including iterator, so the family name part may be
shortened:<br>
John Smith: smithj<br>
Jay Smith: smithj1<br>
Max Verylonglastname: verylonglasm (notice the family name being
shortened)<br>
Marty Verylonglastname: verylonglam1 (notice the family name being
shortened)<br>
--><br>
<br>
<!--<br>
tmpFamilyName = tmpFamilyName ? tmpFamilyName.getNorm() : ''<br>
tmpGivenName = tmpGivenName ? tmpGivenName.getNorm() : ''--><br>
<br>
tmpGivenNameInitial = basic.stringify(tmpGivenName)?.size() >
0 ? (basic.stringify(tmpGivenName)).substring(0,1) : ''<br>
<br>
if (iteration == 0) {<br>
if (basic.stringify(tmpFamilyName).size() < 11) {<br>
basic.norm(basic.stringify(tmpFamilyName + tmpGivenNameInitial))<br>
}<br>
else {<br>
basic.norm(basic.stringify(tmpFamilyName)?.substring(0, 11) +
basic.stringify(tmpGivenNameInitial))<br>
}<br>
}<br>
else {<br>
if (basic.stringify(tmpFamilyName).size() < 10) {<br>
basic.norm(basic.stringify(tmpFamilyName + tmpGivenNameInitial)) +
iterationToken<br>
}<br>
else {<br>
basic.norm(basic.stringify(tmpFamilyName?.substring(0, 10) +
tmpGivenNameInitial)) + iterationToken<br>
}<br>
}<br>
</code><br>
</script><br>
</expression><br>
</outbound><br>
<br>
Regards,<br>
Ivan<br>
<br>
<div class="moz-cite-prefix">On 11/20/2014 06:20 PM, Jason Everling
wrote:<br>
</div>
<blockquote
cite="mid:CAFkZXY5D1E8ZbBhbuHtvtf6NP-jUjRbwqo9yU5LitARGEKBmpg@mail.gmail.com"
type="cite">
<div dir="ltr">I decided to make this seperate,
<div><br>
</div>
<div>So the username gets generated with the following</div>
<div><br>
</div>
<div>
<div> <expression></div>
<div> <script></div>
<div> <code></div>
<div> tmpGivenNameInitial =
basic.stringify(tmpGivenName)?.size() > 0 ?</div>
<div>
(basic.stringify(tmpGivenName)).substring(0,2) : ''</div>
<div> if (iteration == 0) {</div>
<div>
basic.norm(basic.stringify(tmpGivenNameInitial +
tmpFamilyName))</div>
<div> }</div>
<div> else {</div>
<div>
basic.norm(basic.stringify(tmpGivenNameInitial +
tmpFamilyName)) + iterationToken</div>
<div> }</div>
<div> </code></div>
<div> </script></div>
<div> </expression></div>
</div>
<div><br>
</div>
<div>Would there be a way, instead of using the iterationToken
to use another script if the username is already taken.</div>
<div><br>
</div>
<div>Try filastname and if not try firlastname ?</div>
<div><br>
</div>
<div>I was thinking maybe this which is probably not correct but
easier to visualize.</div>
<div><br>
</div>
<div>
<div> <expression></div>
<div> <script></div>
<div> <code></div>
<div> tmpGivenNameInitial =
basic.stringify(tmpGivenName)?.size() > 0 ?</div>
<div>
(basic.stringify(tmpGivenName)).substring(0,2) : ''</div>
<div> if (iteration == 0) {</div>
<div>
basic.norm(basic.stringify(tmpGivenNameInitial +
tmpFamilyName))</div>
<div> }</div>
<div> else {</div>
<div>
<div> tmpGivenNameInitial =
basic.stringify(tmpGivenName)?.size() > 0 ?</div>
<div>
(basic.stringify(tmpGivenName)).substring(0,3) : ''</div>
</div>
<div>
basic.norm(basic.stringify(tmpGivenNameInitial +
tmpFamilyName)) </div>
<div> }</div>
<div> </code></div>
<div> </script></div>
<div> </expression></div>
</div>
<div><br>
</div>
<div>JASON</div>
</div>
<br>
<font size="2"><br>
<br>
CONFIDENTIALITY NOTICE:<br>
This e-mail together with any attachments is proprietary and
confidential; intended for only the recipient(s) named above and
may contain information that is privileged. You should not
retain, copy or use this e-mail or any attachments for any
purpose, or disclose all or any part of the contents to any
person. Any views or opinions expressed in this e-mail are those
of the author and do not represent those of the Baptist School
of Health Professions. If you have received this e-mail in
error, or are not the named recipient(s), you are hereby
notified that any review, dissemination, distribution or copying
of this communication is prohibited by the sender and to do so
might constitute a violation of the Electronic Communications
Privacy Act, 18 U.S.C. section 2510-2521. Please immediately
notify the sender and delete this e-mail and any attachments
from your computer. </font><br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ing. Ivan Noris
Senior Identity Management Engineer
evolveum.com
___________________________________________
"Idem per idem - semper idem Vix."
</pre>
</body>
</html>