[midPoint] Synchronizing organizational structure with DatabaseTableConnector

Болат Казыбаев B.kazybayev at ktg.kz
Wed Jun 15 07:30:48 CEST 2016


Hi Gustav,


Thank you for your example. As I said before, in previous post: “I have, “name” property as org_id, and “costCenter” property as parent_id.” I made an assignment of root org, even though I am not sure if this a correct way.

<populateItem>
    <expression>
        <assignmentTargetSearch>
           <targetType>c:OrgType</targetType>
           <filter>
               <q:equal>
                   <q:path>c:name</q:path>
                   <expression>
                      <script>
                         <code>
                            return costCenter
                         </code>
                      </script>
                   </expression>
               </q:equal>
            </filter>
         </assignmentTargetSearch>
      </expression>
      <target>
          <c:path>assignment</c:path>
       </target>
</populateItem>

From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Palos Gustav
Sent: Tuesday, June 14, 2016 5:10 PM
To: midPoint General Discussion <midpoint at lists.evolveum.com>
Subject: Re: [midPoint] Synchronizing organizational structure with DatabaseTableConnector

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#<http://www.w3.org/2000/09/xmldsig>"
          xmlns:enc="http://www.w3.org/2001/04/xmlenc#<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<http://log.info>("XXX assigning from org {}" , namesOfOrg)
                          if (namesOfOrg != null){

                                       org = midpoint.searchObjectByName(OrgType.class, namesOfOrg);
                                       log.info<http://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<mailto:B.kazybayev at ktg.kz>>:
Hi Pavol,

Thank you for your suggestion. I changed “Identifier” to lower-case and it works.  ☺ 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<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<mailto: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<mailto:midPoint at lists.evolveum.com>

http://lists.evolveum.com/mailman/listinfo/midpoint


_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto: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/20160615/1869bfb9/attachment.htm>


More information about the midPoint mailing list