[midPoint] generating username with condition, code not right?
Jason Everling
jeverling at bshp.edu
Tue Jul 28 19:21:52 CEST 2015
Thanks! We are finishing up our last group of manually created accounts for
this semester, another week and they will be done with new admissions.
After that, I am going to add my CSV which will kickoff the automation so I
have just been changing/testing a few things before hand. I added the
middle initial so that in the future we shouldn't have too many iterations,
just gives the username generation another option to try!
JASON
On Tue, Jul 28, 2015 at 11:50 AM, Ivan Noris <ivan.noris at evolveum.com>
wrote:
> Hi Jason,
>
> glad to hear it works. It seems that if you declare local name for object
> property (such as $user/additionalName), you need to use it instead of the
> object property name everywhere including the condition expression in the
> mapping, because the "original" property name is no more accessible as such.
>
> Maybe others can give more technical background info regarding this; but
> I'm happy that that wild shot advice worked for you :)
>
> Previously I was using the "local names" much more often as I do now.
>
> Best regards,
> Ivan
>
>
> On 07/28/2015 06:36 PM, Jason Everling wrote:
>
> Thanks! I got it going now, removing the tmpAdditionalName and just using
> additionalName works! The last error wasbecause I forgot the name = within
> the if else statements for the email address.
>
> JASON
>
> On Tue, Jul 28, 2015 at 11:03 AM, Jason Everling <jeverling at bshp.edu>
> wrote:
>
>> Oh wait, let me check me email address script, that is referring to that
>> one
>>
>> On Tue, Jul 28, 2015 at 11:02 AM, Jason Everling <jeverling at bshp.edu>
>> wrote:
>>
>>> Ok thanks, so I updated it and removed tmpAdditionalName and just used
>>> additionalName I get this now, fields look to be null. It is using the
>>> script with condition without but in CSV the user has a additionalName
>>>
>>> Internal Error: Synchronization error:
>>> com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
>>> groovy.lang.MissingPropertyException: No such property: name for class:
>>> Script31 expression in mapping 'Generate Email Address without
>>> additionalName' in objectTemplate:10000000-0000-0000-0000-000000000203(User
>>> Template 3)(tmpFamilyName=null; additionalName=null; tmpGivenName=null; )
>>> in expression in mapping 'Generate Email Address without additionalName' in
>>> objectTemplate:10000000-0000-0000-0000-000000000203(User Template 3)
>>>
>>>
>>>
>>> On Tue, Jul 28, 2015 at 10:33 AM, Ivan Noris <ivan.noris at evolveum.com>
>>> wrote:
>>>
>>>> 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 listmidPoint at lists.evolveum.comhttp://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."
>>>>
>>>>
>>>> _______________________________________________
>>>> midPoint mailing list
>>>> midPoint at lists.evolveum.com
>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>>
>>>>
>>>
>>>
>>> --
>>> JASON
>>>
>>
>>
>>
>> --
>> JASON
>>
>
>
>
> --
> 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 listmidPoint at lists.evolveum.comhttp://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."
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
--
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/07046308/attachment.htm>
More information about the midPoint
mailing list