[midPoint] generating username with condition, code not right?
Jason Everling
jeverling at bshp.edu
Tue Jul 28 17:24:03 CEST 2015
I have modified my username generation based on condition additionalName
(middle initial) in our case so that it uses the middle initial if present,
I have 2 one with condition and one without or null
Can you take a look at the below template mappings for me.
It does not seems to work, I get
groovy.lang.MissingPropertyException: No such property: additionalName for
class: Script24 condition in mapping 'Generate Username without
additionalName'
<mapping>
<name>Generate Username without additionalName</name>
<source>
<name>tmpGivenName</name>
<path>givenName</path>
</source>
<source>
<name>tmpAdditionalName</name>
<path>additionalName</path>
</source>
<source>
<name>tmpFamilyName</name>
<path>familyName</path>
</source>
<expression>
<script>
<code>
tmpGivenNameInitial = basic.stringify(tmpGivenName)?.size() > 0 ?
(basic.stringify(tmpGivenName)).substring(0,2) : ''
if (iteration == 0) {
if (basic.stringify(tmpFamilyName).size() < 12) {
basic.norm(basic.stringify(tmpGivenNameInitial + tmpFamilyName))
}
else {
basic.norm(basic.stringify(tmpGivenNameInitial) +
basic.stringify(tmpFamilyName)?.substring(0, 12))
}
}
else {
if (basic.stringify(tmpFamilyName).size() < 11) {
basic.norm(basic.stringify(tmpGivenNameInitial + tmpFamilyName)) +
iterationToken
}
else {
basic.norm(basic.stringify(tmpGivenNameInitial +
tmpFamilyName?.substring(0, 11))) + iterationToken
}
}
</code>
</script>
</expression>
<target>
<path>name</path>
</target>
<condition>
<script>
<code>additionalName == null</code>
</script>
</condition>
</mapping>
<mapping>
<name>Generate Username with additionalName</name>
<source>
<name>tmpGivenName</name>
<path>givenName</path>
</source>
<source>
<name>tmpAdditionalName</name>
<path>additionalName</path>
</source>
<source>
<name>tmpFamilyName</name>
<path>familyName</path>
</source>
<expression>
<script>
<code>
tmpGivenNameInitial = basic.stringify(tmpGivenName)?.size() > 0 ?
(basic.stringify(tmpGivenName)).substring(0,1) : ''
if (iteration == 0) {
if (basic.stringify(tmpFamilyName).size() < 12) {
basic.norm(basic.stringify(tmpGivenNameInitial + tmpAdditionalName +
tmpFamilyName))
}
else {
basic.norm(basic.stringify(tmpGivenNameInitial + tmpAdditionalName) +
basic.stringify(tmpFamilyName)?.substring(0, 12))
}
}
else {
if (basic.stringify(tmpFamilyName).size() < 11) {
basic.norm(basic.stringify(tmpGivenNameInitial + tmpAdditionalName +
tmpFamilyName)) + iterationToken
}
else {
basic.norm(basic.stringify(tmpGivenNameInitial + tmpAdditionalName +
tmpFamilyName?.substring(0, 11))) + iterationToken
}
}
</code>
</script>
</expression>
<target>
<path>name</path>
</target>
<condition>
<script>
<code>additionalName != null</code>
</script>
</condition>
</mapping>
--
JASON
--
CONFIDENTIALITY NOTICE:
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150728/83eb4801/attachment.htm>
More information about the midPoint
mailing list