[midPoint] Synchronizing organizational structure with DatabaseTableConnector

Pálos Gustáv gustav.palos at evolveum.com
Wed Jul 13 15:15:12 CEST 2016


2016-06-30 18:16 GMT+02:00 Pálos Gustáv <gustav.palos at evolveum.com>:

> Hi Bolat,
>
> sorry for the late answer, you need to set filter in this way:
>          <assignmentTargetSearch>
>             <targetType>c:OrgType</targetType>
>             <filter>
>                <q:equal>
>                   <q:path>*c:identifier*</q:path>
>                   <expression>
>                      <script>
>                         <code>
>
> return costCenter
> </code>
>                      </script>
>                   </expression>
>                </q:equal>
>             </filter>
> ...
>
> you need to find org with c:identifier what you have in costCenter in
> child org as parent_id and not his c:name.
>
> And sorry for my previous User-Org assignment sample, for Orgs-Orgs
> assignments you don't need to do this way. It's better to do this in your's
> way.
>
> Gustav
>
>
> 2016-06-15 7:30 GMT+02:00 Болат Казыбаев <B.kazybayev at ktg.kz>:
>
>> 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("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/20160713/d2d2c0c0/attachment.htm>


More information about the midPoint mailing list