<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi,<br>
<br>
What you are doing should work. Theoretically. But you are
probably the first one that have tried something like that in
practice.<br>
Looking at the schema it seems that you have got the path and the
data types right. Try to enable mapping and expression tracing.
Please see<br>
<a class="moz-txt-link-freetext" href="https://wiki.evolveum.com/display/midPoint/Troubleshooting+Mappings">https://wiki.evolveum.com/display/midPoint/Troubleshooting+Mappings</a><br>
I have just added a couple of new sections about expression
tracing. The trace may give you more information on what's wrong.
If it still won't make any sense to you, please select the
relevant parts of the logs and send them to me. I'll have a look.<br>
<br>
<pre class="moz-signature" cols="72">--
Radovan Semancik
Software Architect
evolveum.com
</pre>
<br>
<br>
On 10/12/2016 05:13 PM, Oskar Butovič - AMI Praha a.s. wrote:<br>
</div>
<blockquote
cite="mid:CAE8MtZDtopk92EQVLMBpX0tW9RBPf2u4EsxiL6gx3yuFrakJ2w@mail.gmail.com"
type="cite">
<div dir="ltr">Hello everybody
<div><br>
</div>
<div>I am trying to prefill one security question for users.
Whenever I set questionAnswer text it tries to add two whole
questionAnswer objects. Despite being authoritative, strong
and relativity-absolute it doesnt delete any existing values
and duplicate the one I am trying to add. </div>
<div>Interresting is that when I comment out line
"resultQuestion.setQuestionAnswer(answerText);" midpoint tries
to add only one question answer but it has no answer text
obviously.</div>
<div><br>
</div>
<div>I want to create different answer for each user so I havent
used simple <value> as expression.</div>
<div>I am using this mapping:</div>
<div><br>
</div>
<div>
<div><mapping></div>
<div> <name>start date question</name></div>
<div> <authoritative>true</authoritative></div>
<div> <strength>strong</strength></div>
<div> <expression></div>
<div> <script></div>
<div>
<relativityMode>absolute</relativityMode></div>
<div> <code></div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>import
com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionAnswerType;</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>import
com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>import
java.lang.reflect.*;</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>def
resultQuestions = [];</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>SecurityQuestionAnswerType
resultQuestion = new SecurityQuestionAnswerType();</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>resultQuestion.setQuestionIdentifier("<a
moz-do-not-send="true"
href="http://midpoint.evolveum.com/xml/ns/public/security/question-2#q001">http://midpoint.evolveum.com/xml/ns/public/security/question-2#q001</a>");</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ProtectedStringType
answerText = basic.encrypt("2.2.2016");</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>resultQuestion.setQuestionAnswer(answerText);</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>resultQuestions
<< resultQuestion;</div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></div>
<div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>return
resultQuestions;</div>
<div> </code></div>
<div> </script></div>
<div> </expression></div>
<div> <target></div>
<div>
<c:path>credentials/securityQuestions/questionAnswer</c:path></div>
<div> </target></div>
<div> </mapping></div>
<div><br>
</div>
<div>this is result of preview:</div>
<div><img src="cid:part2.EE7AE794.643A3146@evolveum.com"
width="527" height="196"><br>
<br>
</div>
<div>Am I doing something wrong in mapping? Could security
question answers be prepared by some other way?</div>
<div><br>
</div>
<div>Best Regards</div>
<div><br>
</div>
<div>Oskar Butovič</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<table
style="font-family:verdana,arial,helvetica,sans-serif;border-collapse:collapse;padding:0px;margin:0px;border-width:0px;border-style:solid;width:482px">
<tbody>
<tr style="padding:0px;margin:0px;border:0px
solid gray">
<td
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:11px;width:160px;vertical-align:bottom;padding:0px;border:0px
solid gray">
<p><span
style="font-size:14px;font-weight:bold">Oskar
Butovič</span><br>
solution architect<br>
<br>
gsm: [+420] 774 480 101<br>
e-mail: <a moz-do-not-send="true"
href="mailto:oskar.butovic@ami.cz"
target="_blank">oskar.butovic@ami.cz</a></p>
</td>
<td
style="color:rgb(0,0,0);font-family:verdana,arial,helvetica,sans-serif;font-size:10px;border-width:0px
1px 0px
0px;border-style:solid;border-color:gray
rgb(204,204,204) gray gray;padding:0px"> </td>
<td
style="color:rgb(0,0,0);font-family:verdana,arial,helvetica,sans-serif;font-size:10px;padding:0px;border:0px
solid gray"> </td>
<td
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:11px;vertical-align:bottom;padding:0px;width:123px;border:0px
solid gray">
<p>AMI Praha a.s.<br>
Pláničkova 11<br>
162 00 Praha 6<br>
tel.: [+420] 274 783 239<br>
web: <a moz-do-not-send="true"
href="http://www.ami.cz/"
target="_blank">www.ami.cz</a></p>
</td>
<td
style="color:rgb(0,0,0);font-family:verdana,arial,helvetica,sans-serif;font-size:10px;border-width:0px
1px 0px
0px;border-style:solid;border-color:gray
rgb(204,204,204) gray gray;padding:0px"> </td>
<td
style="color:rgb(0,0,0);font-family:verdana,arial,helvetica,sans-serif;font-size:10px;padding:0px;border:0px
solid gray"> </td>
<td
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:11px;margin:8px;width:116px;border:0px
solid gray">
<p><img moz-do-not-send="true"
src="http://www.ami.cz/images/podpis/ami_logo.gif"
alt="AMI Praha a.s." style="border:
0px;"></p>
</td>
</tr>
<tr style="padding:0px;margin:0px;border:0px
solid gray">
<td colspan="7"
style="color:rgb(0,0,0);font-family:verdana,arial,helvetica,sans-serif;font-size:10px;padding:0px;width:480px;border:0px
solid gray"><br>
<a moz-do-not-send="true"
href="http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management"
target="_blank"><img
moz-do-not-send="true"
src="http://www.ami.cz/images/podpis/AMI-podpis-IdM_1.png"
alt="AMI Praha a.s." style="border:
0px; width: 480px; height: 82px;"></a></td>
</tr>
<tr style="padding:0px;margin:0px;border:0px
solid gray">
<td colspan="7"
style="color:rgb(128,128,128);font-family:arial,sans-serif;font-size:11px;padding:0px;border:0px
solid gray"><br>
Textem tohoto e-mailu podepisující
neslibuje uzavřít ani neuzavírá za
společnost AMI Praha a.s.<br>
jakoukoliv smlouvu. Každá smlouva, pokud
bude uzavřena, musí mít výhradně
písemnou formu.<br>
<br>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
<br>
</body>
</html>