Il 16/03/2015 19:14, Manfredo Hopp ha scritto:
Thanks Marco
The second sync task is delivering all users rows with only one attribute, which are obtained through the scripted sql search.
This sciript returns  atributes __UID__, __NAME__ , and AtributeN.

The task has a user template to assign this table to users.
The mapping is


Imágenes integradas 1


After running users doesnt show this attribute!

There are some errors in your resource mapping:

1) AtributeN is not configured in the mapping of the resource.
2) You must replace __NAME__ with the name of the accountId attribute.

In your groovy, after the select statement you must return:

sql.eachRow(query, {
                    result.add([
                        __UID__:it.ACCOUNTID_ATTRIBUTE_NAME,
                        __NAME__:it.it.ACCOUNTID_ATTRIBUTE_NAME,
ACCOUNTID_ATTRIBUTE_NAME:it.ACCOUNTID_ATTRIBUTE_NAME,
                        ...,
                         ...
                 ])
            });


Regards
Marco

Thanks

2015-03-13 6:16 GMT-03:00 Marco Di Sabatino Di Diodoro <[email protected] <mailto:[email protected]>>:

    Hi Manfredo,


    Il 12/03/2015 17:51, Manfredo Hopp ha scritto:
    Marco thanks!

    I have 2 tasks to syncronize users data from different tables
    (both tables share userid)

    Task 1 use db.table connector with properties UPDATE,ASSIGN so
    new users are added/modified. This is working.
    Task 2 use sriptedSql connector and has properties UPDATE/IGNORE
    since all records are supposed to match thats why no unmatchig
    action is taken.  The second table is also assigned to users.

    So there are 2 tables assigned to users to syncronize different data.

    The scripted connector has ONE_PHASE_UPDATE  capability as well
    as sync and search capabilities.

    When I run this task my guess is that since  there is a matching
    record it should be updated. In fact associating an action class
    shows it is entering  beforeupdate() method.
    Results are that no updates occur and only search script is
    activated.

    Sorry Manfredo, but updateScript runs only when Syncope propagates.

    From core-connid.log INFO  Entering SEARCH Script       Method:
    run is the only meesage. Every script  (See log output below)

    If Syncope users are not updated after task 2, you need to check
    the mapping on the resource.

    Marco


    Since search occurs for every record to be updated the process it
    is reading hole table for each record.

    Regards



    13:36:06.204 DEBUG Search values into menu
    13:36:06.204 DEBUG Perform connection to menu
    13:36:06.209 DEBUG Enter: getObject(ObjectClass: __ACCOUNT__,
    Attribute: {Name=__UID__, Value=[73]}, OperationOptions:
    {ATTRS_TO_GET:[__UID__,menu,__NAME__,__ENABLE__]})       Method:
    getObject
    13:36:06.212 DEBUG ObjectClass: __ACCOUNT__     Method:
    createFilterTranslator
    13:36:06.213 DEBUG ObjectClass: __ACCOUNT__     Method: executeQuery
    13:36:06.215 INFO  Entering SEARCH Script     Method: run
    13:36:06.306 DEBUG Search ok    Method: executeQuery
    13:36:06.307 DEBUG ConnectorObject is built     Method:
    processResults
    (lots of these)


    13:36:06.400 DEBUG ConnectorObject is built     Method:
    processResults
    13:36:06.401 DEBUG ConnectorObject is built     Method:
    processResults
    13:36:06.403 DEBUG Return: {Name=Attribute: {Name=__NAME__,
    Value=[73]}, Attributes=[Attribute: {Name=menu, Value=[]},
    Attribute: {Name=__UID__, Value=[73]}, Attribute: {Name=__NAME__,
    Value=[73]}, Attribute: {Name=__ENABLE__, Value=[true]}],
    ObjectClass=ObjectClass: __ACCOUNT__, Uid=Attribute:
    {Name=__UID__, Value=[73]}} Method: getObject
    13:36:06.403 DEBUG Retrieved values []
    13:36:07.408 DEBUG Retrieve values for virtual attribute menu
    (UserVirtualSchema)
    13:36:07.408 DEBUG Values found in cache
    org.apache.syncope.core.cache.VirAttrCacheValue@2dfc7b8
    13:36:07.803 DEBUG Retrieve values for virtual attribute nombre
    (UserVirtualSchema)










    2015-03-12 5:59 GMT-03:00 Marco Di Sabatino Di Diodoro
    <[email protected] <mailto:[email protected]>>:

        Hi Manfredo,

        Il 11/03/2015 21:45, Manfredo Hopp ha scritto:
        Hello, from docs:

        Implementation of custom Groovy SQL scripts

        Every action script receives a set of parameters and an
        attribute map. The set of parameters varies for each action.

          * CreateScript.groovy
            
<https://cwiki.apache.org/confluence/download/attachments/30754125/CreateScript.groovy?version=1&modificationDate=1361178783000&api=v2>

        CreateScript run if the SearchScript doesn't find the object
        on the resource.

          * UpdateScript.groovy
            
<https://cwiki.apache.org/confluence/download/attachments/30754125/UpdateScript.groovy?version=1&modificationDate=1361178815000&api=v2>

        UpdateScript run if the SearchScript find the object on the
        resource.

          * DeleteScript.groovy
            
<https://cwiki.apache.org/confluence/download/attachments/30754125/DeleteScript.groovy?version=1&modificationDate=1361178836000&api=v2>

        Delete an object.

          * SearchScript.groovy
            
<https://cwiki.apache.org/confluence/download/attachments/30754125/SearchScript.groovy?version=1&modificationDate=1361178856000&api=v2>

        SearchScript run before and after all privisioning operation,
        search operation and full reconciliation.

          * SyncScript.groovy
            
<https://cwiki.apache.org/confluence/download/attachments/30754125/SyncScript.groovy?version=1&modificationDate=1361178914000&api=v2>

        SyncScript take only the changes on the resource (incremental
        synchronization)

         *



        Question: When and how does each script run (i.e update script).


        When using scripted resource for an update Task, only search
        script is activated.
        I suggest you to check in the Connector configuration if the
        update capability is enabled (ONE_PHASE_UPDATE) and if your
        updateScripthas no errors (core-connid.log). In addition, in
        the resource configuration tab check the propagation mode
        (set ONE_PHASE).

        Moreover, the update takes place only if there are changes on
        the attributes present in the mapping of the resource.

        Regards
        M

        Syncope version 1.2.2 sricptedSQL version 2.1.1

        Regards












-- Dott. Marco Di Sabatino Di Diodoro
        Tel. +39 3939065570

        Tirasa S.r.l.
        Viale D'Annunzio 267 - 65127 Pescara
        Tel +39 0859116307 / FAX +39 0859111173
        http://www.tirasa.net

        Apache Syncope PMC Member
        http://people.apache.org/~mdisabatino/  
<http://people.apache.org/%7Emdisabatino/>



-- Dott. Marco Di Sabatino Di Diodoro
    Tel. +39 3939065570

    Tirasa S.r.l.
    Viale D'Annunzio 267 - 65127 Pescara
    Tel +39 0859116307 / FAX +39 0859111173
    http://www.tirasa.net

    Apache Syncope PMC Member
    http://people.apache.org/~mdisabatino/  
<http://people.apache.org/%7Emdisabatino/>



--
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/

Reply via email to