[midPoint] Synchronizing organizational structure with DatabaseTableConnector

Pálos Gustáv gustav.palos at evolveum.com
Tue Jun 14 13:10:15 CEST 2016


Hi Bolat,

I have an example how can I assign user to existing org in midpoint
by midpoint.searchObjectByName in object template.
The similar can work for you, but you need to run import in right order
(first root, next his childs, ...)

<objectTemplate xmlns="
http://midpoint.evolveum.com/xml/ns/public/common/common-3"
 xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
 xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
 xmlns:icfc="
http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3
"
 xmlns:icfs="
http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3
"
 xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
          xmlns:cap="
http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3"
          xmlns:apti="
http://midpoint.evolveum.com/xml/ns/public/common/api-types-3"
          xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
          xmlns:enc="http://www.w3.org/2001/04/xmlenc#"
          xmlns:ri="
http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
          xmlns:cdoext="http://xml.uniba.sk/cdoext"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          oid="10000000-0000-0000-0210-000000000101">
   <name>User Template</name>



  <mapping>
      <name>User org mapping</name>
      <authoritative>true</authoritative>
      <source>
         <c:path xmlns:ext="http://xxx">extension/namesOfOrgs</c:path>
    <c:name>namesOfOrg</c:name>
      </source>
      <expression>
         <script>
          <!-- <relativityMode>absolute</relativityMode> --><!-- FIX for
multivalue -->
            <code>
  import
com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
  import
com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
  import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
  import java.util.*;

  log.info("XXX assigning from org {}" , namesOfOrg)
  if (namesOfOrg != null){

    org = midpoint.searchObjectByName(OrgType.class, namesOfOrg);
    log.info("org {}" , org)
    orgOrt = new ObjectReferenceType();
   orgOrt.setOid(org.getOid());
   orgOrt.setType(OrgType.COMPLEX_TYPE);

   AssignmentType assignment = new AssignmentType();
   assignment.asPrismContainerValue()
   assignment.setTargetRef(orgOrt);

   return assignment
  }
  </code>
         </script>
      </expression>
      <target>
         <c:path>assignment</c:path>
      </target>
      <condition>
         <script>
            <code>
            return namesOfOrg != null
            </code>
         </script>
      </condition>
   </mapping>

</objectTemplate>

Gustav

2016-06-14 12:48 GMT+02:00 Болат Казыбаев <B.kazybayev at ktg.kz>:

> Hi Pavol,
>
>
>
> Thank you for your suggestion. I changed “Identifier” to lower-case and it
> works.  J 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?
>
>
>
> *From:* midPoint [mailto:midpoint-bounces at lists.evolveum.com] *On Behalf
> Of *Pavol Mederly
> *Sent:* Tuesday, June 14, 2016 3:41 PM
> *To:* midpoint at lists.evolveum.com
> *Subject:* Re: [midPoint] Synchronizing organizational structure with
> DatabaseTableConnector
>
>
>
> Hello Bolat,
>
> 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.
>
> Best regards,
>
> Pavol
>
> On 14.06.2016 11:32, Болат Казыбаев wrote:
>
> Hello all,
>
>
>
> 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”.
>
>
>
> Where am I wrong in xml configuration?
>
>
>
>
> _______________________________________________
>
> midPoint mailing list
>
> midPoint at lists.evolveum.com
>
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20160614/a8f2d828/attachment.htm>


More information about the midPoint mailing list