<div dir="ltr">This is great, Thanks! I shouldn't need the iterator then, Our current way is flastname, filastname, firlastname and so on so this would be better.<div><br></div><div>JASON</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 20, 2014 at 2:11 PM, Ivan Noris <span dir="ltr"><<a href="mailto:ivan.noris@evolveum.com" target="_blank">ivan.noris@evolveum.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
I believe I've set something similar in our CSV sample:<br>
<br>
<a href="https://github.com/Evolveum/midpoint/raw/master/samples/resources/csvfile/localhost-csvfile-resource-advanced-nosync-2.xml" target="_blank">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<div><div class="h5"><br>
<br>
<div>On 11/20/2014 06:20 PM, Jason Everling
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<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>
</div></div><font><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></fieldset>
<br>
<pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<pre cols="72">--
Ing. Ivan Noris
Senior Identity Management Engineer
<a href="http://evolveum.com">evolveum.com</a>
___________________________________________
"Idem per idem - semper idem Vix."
</pre>
</font></span></div>
<br>_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br></blockquote></div><br></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>