<div dir="ltr">Hi Bolat,<div><br></div><div>I have an example how can I assign user to existing org in midpoint by midpoint.searchObjectByName in object template.</div><div>The similar can work for you, but you need to run import in right order (first root, next his childs, ...)</div><div><br></div><div><div><objectTemplate xmlns="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>"</div><div><span class="" style="white-space:pre">           </span>  xmlns:c="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>"</div><div><span class="" style="white-space:pre">           </span>  xmlns:q="<a href="http://prism.evolveum.com/xml/ns/public/query-3">http://prism.evolveum.com/xml/ns/public/query-3</a>"</div><div><span class="" style="white-space:pre">         </span>  xmlns:icfc="<a href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3</a>"</div><div><span class="" style="white-space:pre">          </span>  xmlns:icfs="<a href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3">http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3</a>"</div><div><span class="" style="white-space:pre">            </span>  xmlns:t="<a href="http://prism.evolveum.com/xml/ns/public/types-3">http://prism.evolveum.com/xml/ns/public/types-3</a>"</div><div>          xmlns:cap="<a href="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3</a>"</div><div>          xmlns:apti="<a href="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3">http://midpoint.evolveum.com/xml/ns/public/common/api-types-3</a>"</div><div>          xmlns:ds="<a href="http://www.w3.org/2000/09/xmldsig#">http://www.w3.org/2000/09/xmldsig#</a>"</div><div>          xmlns:enc="<a href="http://www.w3.org/2001/04/xmlenc#">http://www.w3.org/2001/04/xmlenc#</a>"</div><div>          xmlns:ri="<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>"</div><div>          xmlns:cdoext="<a href="http://xml.uniba.sk/cdoext">http://xml.uniba.sk/cdoext</a>"</div><div>          xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"</div><div>          xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"</div><div>          oid="10000000-0000-0000-0210-000000000101"></div><div>   <name>User Template</name></div><div>   </div><div><br></div><div>   </div><div> <span class="" style="white-space:pre">      </span><mapping></div><div>      <name>User org mapping</name></div><div>      <authoritative>true</authoritative></div><div>      <source></div><div>         <c:path xmlns:ext="<a href="http://xxx">http://xxx</a>">extension/namesOfOrgs</c:path></div><div>   <span class="" style="white-space:pre">          </span> <c:name>namesOfOrg</c:name></div><div>      </source></div><div>      <expression></div><div>         <script></div><div>         <span class="" style="white-space:pre"> </span><!-- <relativityMode>absolute</relativityMode> --><!-- FIX for multivalue --></div><div>            <code></div><div><span class="" style="white-space:pre">         </span>   import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;</div><div><span class="" style="white-space:pre">            </span>   import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;</div><div><span class="" style="white-space:pre">               </span>   import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;</div><div><span class="" style="white-space:pre">           </span>   import java.util.*;</div><div><span class="" style="white-space:pre">            </span>   </div><div><span class="" style="white-space:pre">              </span>   <a href="http://log.info">log.info</a>("XXX assigning from org {}" , namesOfOrg)</div><div><span class="" style="white-space:pre">               </span>   if (namesOfOrg != null){</div><div><span class="" style="white-space:pre">                       </span>   </div><div><span class="" style="white-space:pre">                      </span>    org = midpoint.searchObjectByName(OrgType.class, namesOfOrg);</div><div><span class="" style="white-space:pre">                       </span>    <a href="http://log.info">log.info</a>("org {}" , org)</div><div><span class="" style="white-space:pre">                      </span>    orgOrt = new ObjectReferenceType();</div><div><span class="" style="white-space:pre">                 </span>    orgOrt.setOid(org.getOid());</div><div><span class="" style="white-space:pre">                 </span>    orgOrt.setType(OrgType.COMPLEX_TYPE);</div><div><span class="" style="white-space:pre">                                                </span>            </div><div><span class="" style="white-space:pre">                 </span>    AssignmentType assignment = new AssignmentType();</div><div><span class="" style="white-space:pre">                    </span>    assignment.asPrismContainerValue()</div><div><span class="" style="white-space:pre">                   </span>    assignment.setTargetRef(orgOrt);</div><div><span class="" style="white-space:pre">                     </span>    </div><div><span class="" style="white-space:pre">                     </span>    return assignment</div><div><span class="" style="white-space:pre">            </span>   }</div><div><span class="" style="white-space:pre">              </span>   </code></div><div>         </script></div><div>      </expression></div><div>      <target></div><div>         <c:path>assignment</c:path></div><div>      </target></div><div>      <condition></div><div>         <script></div><div>            <code></div><div>            <span class="" style="white-space:pre">       </span>return namesOfOrg != null</div><div>            </code></div><div>         </script></div><div>      </condition></div><div>   </mapping>      </div><div>   </div><div></objectTemplate></div></div><div><br></div><div>Gustav</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-14 12:48 GMT+02:00 Болат Казыбаев <span dir="ltr"><<a href="mailto:B.kazybayev@ktg.kz" target="_blank">B.kazybayev@ktg.kz</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div bgcolor="white" lang="RU" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">Hi Pavol,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">Thank you for your suggestion. I changed “Identifier” to lower-case and it works.  </span><span lang="EN-US" style="font-family:Wingdings;color:#1f497d">J</span><span lang="EN-US" style="color:#1f497d">
 Now I need to make an organization tree using parent-child reference. In fact now I have, “name” property as org_id, and “costCenter” property as parent_id. Any suggestions how to make it?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d"><u></u> <u></u></span></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> midPoint [mailto:<a href="mailto:midpoint-bounces@lists.evolveum.com" target="_blank">midpoint-bounces@lists.evolveum.com</a>]
<b>On Behalf Of </b>Pavol Mederly<br>
<b>Sent:</b> Tuesday, June 14, 2016 3:41 PM<br>
<b>To:</b> <a href="mailto:midpoint@lists.evolveum.com" target="_blank">midpoint@lists.evolveum.com</a><br>
<b>Subject:</b> Re: [midPoint] Synchronizing organizational structure with DatabaseTableConnector<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p>Hello Bolat,<span style="font-size:12.0pt"><u></u><u></u></span></p>
<p>I would suggest replacing c:Identifier with c:identifier (lower-cased) - in all paths referencing "identifier" property of the OrgType; including the search filter used for correlation.<u></u><u></u></p>
<p>Best regards,<u></u><u></u></p>
<p>Pavol<u></u><u></u></p>
<div>
<p class="MsoNormal">On 14.06.2016 11:32, Болат Казыбаев wrote:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US">Hello all,</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I’m trying to sync my org data from database table to midpoint. I read all previous topics about that and compose resource xml (in attachment). There is an error: “Failed to import: com.evolveum.midpoint.util.exception.SystemException:
 Error occurred during resource object shadow owner lookup, reason: Couldn't search user”.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Where am I wrong in xml configuration?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><br>
<br>
<br>
<u></u><u></u></span></p>
<pre>_______________________________________________<u></u><u></u></pre>
<pre>midPoint mailing list<u></u><u></u></pre>
<pre><a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><u></u><u></u></pre>
<pre><a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><u></u><u></u></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p>
</div></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" rel="noreferrer" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br></blockquote></div><br></div>