<div dir="ltr">I see now, I need to go through other templates also and do this, I looked at a few others and I am chaining all over the place for other resources and it seems to be working for those but as you say it might now work at times.<div><br></div><div>Thanks!</div><div>JASON</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 15, 2015 at 9:57 AM, Pavol Mederly <span dir="ltr"><<a href="mailto:mederly@evolveum.com" target="_blank">mederly@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">
<div>Not exactly.<br>
<br>
I mean keeping the mapping that <b>computes</b> name property,
i.e.<div><div class="h5"><br>
<br>
<mapping><br>
<name>Generate Username for CSV</name><br>
<source><br>
<name>tmpGivenName</name><br>
<path>givenName</path><br>
</source><br>
<source><br>
<name>tmpFamilyName</name><br>
<path>familyName</path><br>
</source><br>
<!-- Will generate username in the filastname format
with iterator,<br>
filastname<br>
filastname2<br>
--><br>
<expression><br>
<script><br>
<code><br>
tmpGivenNameInitial =
basic.stringify(tmpGivenName)?.size() > 0 ?<br>
(basic.stringify(tmpGivenName)).substring(0,2)
: ''<br>
if (iteration == 0) {<br>
basic.norm(basic.stringify(tmpGivenNameInitial
+ tmpFamilyName))<br>
}<br>
else {<br>
basic.norm(basic.stringify(tmpGivenNameInitial
+ tmpFamilyName)) + iterationToken<br>
}<br>
</code><br>
</script><br>
</expression><br>
<target><br>
<path>name</path><br>
</target><br>
</mapping><br>
<br></div></div>
And changing the mapping that <b>uses</b> the name property to
compute emailAddress so that it would compute it from existing
sources (givenName, familyName) by duplicating the code from the
first mapping:<br>
<br>
<mapping><br>
<b><font color="#006600"><font color="#009900"><span class="">
<source><br>
<name>tmpGivenName</name><br>
<path>givenName</path><br>
</source><br>
<source><br>
<name>tmpFamilyName</name><br>
<path>familyName</path><br>
</source><br></span><span class="">
<expression><br>
<script><br>
<code><br>
tmpGivenNameInitial =
basic.stringify(tmpGivenName)?.size() > 0 ?<br>
(basic.stringify(tmpGivenName)).substring(0,2) : ''<br>
if (iteration == 0) {<br></span>
<font color="#000000">name = </font>basic.norm(basic.stringify(tmpGivenNameInitial
+ tmpFamilyName))<br>
}<br>
else {<br>
<font color="#000000">name = </font>basic.norm(basic.stringify(tmpGivenNameInitial
+ tmpFamilyName)) + iterationToken<br>
}</font><br>
</font></b> <b><font color="#ff0000">name +
'@<a href="http://bshp.edu" target="_blank">bshp.edu</a>'</font></b><span class=""><br>
</script><br>
</expression><br>
<target><br>
<path>emailAddress</path><br>
</target><br>
</mapping><br>
<br></span>
Green is the copied - and slightly changed - code, red is the code
from the email address mapping.<br>
<br>
The same - but slightly more complicated - should be done for
Assign Organization mapping, which would then look like this:<br>
(again, the duplicated code show in green)<br>
<br>
<mapping><br>
<source><br>
<path><font color="#009900">costCenter</font></path><br>
</source><br>
<expression><br>
<assignmentTargetSearch><br>
<targetType>c:OrgType</targetType><br>
<filter><span class=""><br>
<q:equal><br>
<q:path>name</q:path><br>
</span><font color="#009900"> <expression><br>
<script><br>
<code><br>
tmpOU = 'OU=SHP Students,DC=TEST,DC=LOCAL'<br>
switch (costCenter) {<br>
case 'ASHIT':<br>
tmpOU = 'OU=AAS HIT,' + tmpOU<br>
break<br>
case 'ASIM':<br>
tmpOU = 'OU=DMIT,' + tmpOU<br>
break<br>
case 'ASGA':<br>
tmpOU = 'OU=AAD,' + tmpOU<br>
break<br>
case 'ASGT':<br>
tmpOU = 'OU=DST,' + tmpOU<br>
break<br>
case 'BSHM':<br>
tmpOU = 'OU=BSHM,' + tmpOU<br>
break<br>
case 'CT':<br>
tmpOU = 'OU=DMIT,' + tmpOU<br>
break<br>
case 'GEN':<br>
tmpOU = 'OU=GENED,' + tmpOU<br>
break<br>
case 'LVRN':<br>
tmpOU = 'OU=LVRN,' + tmpOU<br>
break<br>
case 'MO':<br>
tmpOU = 'OU=LVRN,' + tmpOU<br>
break<br>
case 'MRI':<br>
tmpOU = 'OU=DMIT,' + tmpOU<br>
break<br>
case 'AAD':<br>
tmpOU = 'OU=AAD,' + tmpOU<br>
break<br>
case 'ND':<br>
tmpOU = 'OU=DPN,' + tmpOU<br>
break<br>
case 'RT':<br>
tmpOU = 'OU=DMIT,' + tmpOU<br>
break<br>
case 'ST':<br>
tmpOU = 'OU=DST,' + tmpOU<br>
break<br>
case 'PO':<br>
tmpOU = 'OU=PNP,' + tmpOU<br>
break<br>
case 'PN':<br>
tmpOU = 'OU=DPN,' + tmpOU<br>
break<br>
case 'BSN':<br>
tmpOU = 'OU=BSN,' + tmpOU<br>
break<br>
case 'VT':<br>
tmpOU = 'OU=DMIT,' + tmpOU<br>
break<br>
case 'SO':<br>
tmpOU = 'OU=DMIT,' + tmpOU<br>
break<br>
case 'VN':<br>
tmpOU = 'OU=DVN,' + tmpOU<br>
break<br>
default:<br>
tmpOU = 'OU=SHP Students,DC=TEST,DC=LOCAL'<br>
}<br>
return tmpOU<br>
</code><br>
</script><br>
</expression></font><span class=""><br>
</q:equal><br>
</filter><br>
</assignmentTargetSearch><br>
</expression><br>
<target><br></span>
<path>assignment</path><br>
</target><br>
</mapping><br>
<br>
Haven't tested it; but it should work.<br>
<br>
Best regards,<br>
Pavol<div><div class="h5"><br>
<br>
On 15. 1. 2015 16:39, Jason Everling wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">Ok thanks for the update,
<div><br>
</div>
<div>I am not sure though what you mean by duplicate code? Are
you saying in the objectTemplate mapping add another email
address mapping so that it would be something like this?</div>
<div><br>
</div>
<div>
<div> <mapping></div>
<div> <source></div>
<div> <path>$user/name</path></div>
<div> </source></div>
<div> <expression></div>
<div> <script></div>
<div> <language><a href="http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy" target="_blank">http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</a></language></div>
<div> <code>name + '@<a href="http://domain.com" target="_blank">domain.com</a>'</code></div>
<div> </script></div>
<div> </expression></div>
<div> <target></div>
<div> <path>emailAddress</path></div>
<div> </target></div>
<div> </mapping></div>
</div>
<div><br>
</div>
<div>
<div> <mapping></div>
<div> <source></div>
<div> <path>$user/name</path></div>
<div> </source></div>
<div> <expression></div>
<div> <script></div>
<div> <language><a href="http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy" target="_blank">http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</a></language></div>
<div> <code>name + '@<a href="http://domain.com" target="_blank">domain.com</a>'</code></div>
<div> </script></div>
<div> </expression></div>
<div> <target></div>
<div> <path>emailAddress</path></div>
<div> </target></div>
<div> </mapping></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>JASON</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Jan 15, 2015 at 9:18 AM, Pavol
Mederly <span dir="ltr"><<a href="mailto:mederly@evolveum.com" target="_blank">mederly@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">
<div>Hello Jason,<br>
<br>
just before Christmas vacation, I've been looking at
this issue. The problem is in the chaining of mappings
in the object template. In your case, <b>name</b> is
generated by the first mapping and then used for
computation of <b>emailAddress</b>. In a similar way, <b>organization</b>
is generated and then used to compute <b>assignment</b>.<br>
<br>
MidPoint does not support such a chaining in the current
version. If it works in some cases, it is more by chance
than by design. I've created a jira issue for that: <a href="https://jira.evolveum.com/browse/MID-2149" target="_blank">https://jira.evolveum.com/browse/MID-2149</a>.
Hopefully we'll fix that in 3.2.<br>
<br>
Fortunately, there is a simple (yet a bit ugly)
workaround: duplicate your code so that no mapping would
depend on another.<br>
<br>
Best regards,<br>
Pavol
<div>
<div><br>
<br>
On 10. 12. 2014 17:27, Jason Everling wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">Almost toward the end of the log
part, I see this
<div><br>
</div>
<div>
<div>---[ EXECUTED delta of UserType
]---------------------</div>
<div>Channel: <a href="http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#liveSync" target="_blank">http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#liveSync</a></div>
<div>Wave: 1</div>
<div>ObjectDelta<UserType>(UserType:ab907de7-4302-47ef-8003-36959fc842ef,MODIFY):</div>
<div> emailAddress</div>
<div> REPLACE: <a href="mailto:null@domain.com" target="_blank">null@domain.com</a></div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Dec 10, 2014 at
10:13 AM, Jason Everling <span dir="ltr"><<a href="mailto:jeverling@bshp.edu" target="_blank">jeverling@bshp.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">So I disabled or removed that
template from the resource reactions, I set
it as the default template is sysconfig.
<div><br>
</div>
<div>It still does it,
<emailAddress><a href="mailto:null@domain.com" target="_blank">null@domain.com</a></emailAddress>
seems to be affected,</div>
<div><br>
</div>
<div>Wierd though, I turned on debugging,</div>
<div><br>
</div>
<div>It shows the attribute being created
correctly, you can see from the log but in
the gui and in the user xml it is <a href="mailto:null@domain.com" target="_blank">null@domain.com</a></div>
<div><br>
</div>
<div>
<div>ObjectDelta<UserType>(UserType:ab907de7-4302-47ef-8003-36959fc842ef,ADD):</div>
<div> user:
(ab907de7-4302-47ef-8003-36959fc842ef,
v0, UserType)</div>
<div> extension: </div>
<div> otherMailbox: [ <a href="mailto:hhernandez@local.org" target="_blank">hhernandez@local.org</a>
]</div>
<div> eduPersonAffiliation: [
student ]</div>
<div> givenName: Herman</div>
<div> familyName: Hernandes</div>
<div> costCenter: PN</div>
<div> employeeNumber: HE5019982</div>
<div> credentials: </div>
<div> password: </div>
<div> value:
ProtectedStringType(encrypted=EncryptedDataType(encryptionMethod=EncryptionMethodType(algorithm=<a href="http://www.w3.org/2001/04/xmlenc#aes128-cbc" target="_blank">http://www.w3.org/2001/04/xmlenc#aes128-cbc</a>),
keyInfo=KeyInfoType(keyName=HiCJvCmeUCWoiEl3d+uXyd2VeYs=),
cipherData=CipherDataType(cipherValue=[32
bytes])))</div>
<div> activation: </div>
<div> administrativeStatus:
ENABLED</div>
<div> effectiveStatus: ENABLED</div>
<div> enableTimestamp:
2014-12-10T10:07:21.502-06:00</div>
<div> <font style="background-color:rgb(255,255,0)" color="#000000">emailAddress: <a href="mailto:hehernandes@domain.com" target="_blank">hehernandes@domain.com</a></font></div>
<div> name: hehernandes</div>
<div> employeeType: [ A2S ]</div>
<div> locale: US</div>
<div> organization: [ OU=DPN,OU=SHP
Students,DC=TEST,DC=LOCAL ]</div>
<div> locality: San Antonio</div>
<div> fullName: Herman Hernandes</div>
<div> iteration: 0</div>
</div>
</div>
<div>
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Dec 10,
2014 at 9:46 AM, 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"> Jason,<br>
<br>
I believe I have seen this couple
of weeks ago when debugging the
iterator problem... seems that
I've forgotten about this.<br>
<br>
But as far I can remember, it has
worked when the mapping was in
global system template instead of
the resource-referenced.<br>
<br>
If you can temporarily disable
using of the template in resource
and set the same template in
System Configuration for UserType
objects, can you please test the
behaviour?<br>
<br>
Anyway it seems to be a bug, so
after you could confirm the
behaviour, I'd create a new issue.<br>
<br>
Thanks,<br>
I.
<div>
<div><br>
<br>
<div>On 12/10/2014 04:32 PM,
Jason Everling wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">Since I
upgraded to 3.1 and I am
not sure if this is
related to the other CSV
Resource issue.
<div><br>
</div>
<div>Here is the mapping
for the template, it
worked fine in 3.0.1 so
I do not know if
anything changed, the
email address is built
using name + '@<a href="http://domain.com" target="_blank">domain.com</a>' but when the
user is created I get <a href="mailto:null@domain.com" target="_blank">null@domain.com</a>, like
it is not picking up the
username from the first
mapping</div>
<div><br>
</div>
<div>
<div> <mapping></div>
<div>
<name>Generate
Username for
CSV</name></div>
<div>
<source></div>
<div>
<name>tmpGivenName</name></div>
<div>
<path>givenName</path></div>
<div>
</source></div>
<div>
<source></div>
<div>
<name>tmpFamilyName</name></div>
<div>
<path>familyName</path></div>
<div>
</source></div>
<div> <!--
Will generate username
in the filastname
format with iterator,</div>
<div>
filastname</div>
<div>
filastname2</div>
<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>
<target></div>
<div>
<path>name</path></div>
<div>
</target></div>
<div>
</mapping></div>
<div><br>
</div>
<div>
<iteration></div>
<div>
<maxIterations>25</maxIterations></div>
<div>
<tokenExpression></div>
<div>
<script></div>
<div>
<code></div>
<div>
if (iteration == 0) {</div>
<div>
return "";</div>
<div>
} else {</div>
<div>
return "" +
(iteration+1)</div>
<div>
}</div>
<div>
</code></div>
<div>
</script></div>
<div>
</tokenExpression></div>
<div>
</iteration></div>
<div><br>
</div>
<div> <mapping></div>
<div>
<source></div>
<div>
<path>$user/name</path></div>
<div>
</source></div>
<div>
<expression></div>
<div>
<script></div>
<div>
<language><a href="http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy" target="_blank">http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</a></language></div>
<div>
<code>name + '@<a href="http://domain.com" target="_blank">domain.com</a>'</code></div>
<div>
</script></div>
<div>
</expression></div>
<div>
<target></div>
<div>
<path>emailAddress</path></div>
<div>
</target></div>
<div>
</mapping></div>
</div>
<div><br>
</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><font color="#888888">
</font></span></pre>
<span><font color="#888888"> </font></span></blockquote>
<span><font color="#888888"> <br>
<pre cols="72">--
Ing. Ivan Noris
Senior Identity Management Engineer
<a href="http://evolveum.com" target="_blank">evolveum.com</a> <a href="http://evolveum.com/blog/" target="_blank">evolveum.com/blog/</a>
_____________________________________________
"Semper Id(e)M Vix."
</pre>
</font></span></div>
<br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<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>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<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>
</pre>
</blockquote>
<br>
</div></div></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" target="_blank">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>