[midPoint] generating username with condition, code not right?

Ivan Noris ivan.noris at evolveum.com
Tue Jul 28 17:33:26 CEST 2015


Hi Jason,

a wild shot for now..

Try to use tmpAdditionalName in the condition as well.

Or, do not use tmpAdditionalName at all (use additionalName everywhere
in your expressions):

      <source>
           <!-- <name>tmpAdditionalName</name> -->
            <path>additionalName</path>
        </source>

Regards,
Ivan

On 07/28/2015 05:24 PM, Jason Everling wrote:
> 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.
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-- 
  Ing. Ivan Noris
  Senior Identity Management Engineer & IDM Architect
  evolveum.com                     evolveum.com/blog/
  ___________________________________________________
  "Semper Id(e)M Vix."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150728/2216b019/attachment.htm>


More information about the midPoint mailing list