<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Carlos,</p>
    <p>AFAIK there are two possible implementations of "update"
      operations in the connector: UPDATE and
      ADD_ATTRIBUTE_VALUES/REMOVE_ATTRIBUTE_VALUES. I didn't know what's
      default as I'm not writing the connectors so stuff like this is
      usually "just working".</p>
    <p>Best regards,</p>
    <p>Ivan<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 10/10/2016 04:31 PM, Carlos Ferreira
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJHEg677=sXCFmq3RpzdngcNyQxJAvwGHuzcJUgUSHEBdu2o5g@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Hi Ivan,<br>
          <br>
        </div>
        In fact, adding the following line (on the resource
        configuration)<br>
        <div><br>
                      <readReplaceMode>false</<wbr>readReplaceMode>                                  
          (instead of  <readReplaceMode>true</<wbr>readReplaceMode>)<br>
        </div>
        <div><br>
          makes the connector send the action <br>
          <br>
          <br>
          - "REMOVE_ATTRIBUTE_VALUES", when <b>updating</b> the current
          value<br>
          <br>
        </div>
        <div>or<br>
          <br>
          - "ADD_ATTRIBUTE_VALUES", when <b>adding</b> another one<br>
          <br>
        </div>
        <div>That will make it possible to adjust the groovy script so
          as to accomplish what I need.<br>
          <br>
        </div>
        <div>Thanks a lot,<br>
          <br>
          <br>
        </div>
        <div>Carlos<br>
        </div>
        <div><br>
          <br>
          <br>
          <br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2016-10-10 6:07 GMT-03:00 Ivan Noris <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:Ivan.Noris@evolveum.com" target="_blank">Ivan.Noris@evolveum.com</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div>
              <div style="font-family:times new roman,new
                york,times,serif;font-size:12pt;color:#000000">
                <div>Hi Carlos,<br>
                </div>
                <div>I may be completely wrong, but for a different
                  (custom) connector, we needed to do something like
                  this:<br>
                </div>
                <div><br>
                </div>
                <div>         <attribute><br>
                              <description>We want the connector
                  have ALL values, not only delta</description><br>
                              <ref>ri:roles</ref><br>
                              <readReplaceMode>true</<wbr>readReplaceMode><br>
                           </attribute><br>
                  <br>
                </div>
                <div>(It was maybe half year ago, I don't remember the
                  particular details now, except that the "ri:roles" was
                  a multi-valued attribute, not association).<br>
                </div>
                <div>Maybe this helps or brings new answers from the
                  other members of this list.<br>
                </div>
                <div><br>
                </div>
                <div>Regards,<br>
                </div>
                <div>Ivan<br>
                </div>
                <div><br>
                </div>
                <hr id="m_8524420695855624980zwchr">
                <blockquote style="border-left:2px solid
#1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From:
                  </b>"Carlos Ferreira" <<a moz-do-not-send="true"
                    href="mailto:carlos18619@gmail.com" target="_blank">carlos18619@gmail.com</a>><br>
                  <b>To: </b>"midPoint General Discussion" <<a
                    moz-do-not-send="true"
                    href="mailto:midpoint@lists.evolveum.com"
                    target="_blank">midpoint@lists.evolveum.com</a>><br>
                  <b>Sent: </b>Saturday, October 8, 2016 12:46:59 AM<br>
                  <b>Subject: </b>Re: [midPoint] DatabaseTable
                  Multi-Value Fields
                  <div>
                    <div class="h5"><br>
                      <div><br>
                      </div>
                      <div dir="ltr">HI,<br>
                        <div><br>
                          This is exactly the same behavior I've been
                          seeing im my case.<br>
                          <div><br>
                          </div>
                        </div>
                        <div>First of all,<br>
                          <div><br>
                          </div>
                        </div>
                        <div>1. I'm using SCRIPTEDSQL connector and an
                          ORACLE DB;<br>
                        </div>
                        <div>2. I've configured a multi-valued extension
                          attribute - says 'roles' - to receive the
                          roles applied to an user;<br>
                        </div>
                        <div>3. Configured a metarole to deal with an
                          association. Something like this:<br>
                          <div><br>
                          </div>
                             <inducement id="3"><br>
                                <construction><br>
                                   <resourceRef xmlns:tns="<a
                            moz-do-not-send="true"
                            href="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
                            target="_blank">http://midpoint.<wbr>evolveum.com/xml/ns/public/<wbr>common/common-3</a>"<br>
                                               
                          oid="ef2bc95b-76e0-48e3-86db-<wbr>3d4f02d42fff"<br>
                                               
                          type="tns:ResourceType"><!-- Localhost
                          ScriptedSQL - Oracle 
                          --></resourceRef><br>
                                   <kind>account</kind><br>
                                   <intent>default</intent><br>
                                   <association><br>
                                      <c:ref>ri:priv</c:ref><br>
                                      <outbound><br>
                                         <expression><br>
                                            <associationFromLink><br>
                                              
                          <projectionDiscriminator><br>
                                                 
                          <kind>entitlement</kind><br>
                                                 
                          <intent>privilege</intent><br>
                                              
                          </projectionDiscriminator><br>
                                            </associationFromLink><br>
                                         </expression><br>
                                      </outbound><br>
                                   </association><br>
                                </construction><br>
                                <order>2</order><br>
                             </inducement><br>
                          <div><br>
                          </div>
                        </div>
                        <div>4. Made the necessary adjustments on the
                          resource to cope with the association. Like
                          this:<br>
                          <div><br>
                          </div>
                                   <association><br>
                                      <c:ref>ri:priv</c:ref><br>
                                     
                          <kind>entitlement</kind><br>
                                     
                          <intent>privilege</intent><br>
                                     
                          <direction>subjectToObject</<wbr>direction><br>
                                      <associationAttribute>ri:<wbr>roles</associationAttribute><br>
                                     
                          <valueAttribute>icfs:name</<wbr>valueAttribute><br>
                                   </association><br>
                          <div><br>
                          </div>
                        </div>
                        <div>As to help me understand what goes through
                          the connector, I added some lines in the
                          beginning of 'UpdateScript.groovy' script:<br>
                          <div><br>
                          </div>
                          <br>
                        </div>
                        <div>def now = new Date()<br>
                          <div><br>
                          </div>
                          def file1 = new File('/var/opt/midpoint/icf-<wbr>connectors/oracle/update.log')<wbr>;<br>
                          if (file1.exists()) {<br>
                              file1.delete()<br>
                          }<br>
                          file1 << "Update test" << "\n"<br>
                          file1 << "Date = $now" << "\n"<br>
                          file1 << "objectClass =
                          ${objectClass}"<< "\n"<br>
                          file1 << "action = $action" <<
                          "\n"<br>
                          file1 << "attributes = ${attributes}"
                          << "\n"<br>
                          file1 << "options = $options" <<
                          "\n"<br>
                          file1 << "uid = $uid" << "\n"<br>
                          <div><br>
                          </div>
                        </div>
                        <div>No matter if I update the current role
                          applied to an user or add another one (as the
                          attribute is multivalued), the result comes
                          like this:<br>
                          <div><br>
                          </div>
                          Update test<br>
                          Date = Fri Oct 07 19:28:07 BRT 2016<br>
                          objectClass = __ACCOUNT__<br>
                          action = UPDATE<br>
                          attributes = [roles:[role1]]<br>
                          options = [:]<br>
                          uid = 161<br>
                          <div><br>
                          </div>
                        </div>
                        <div>or<br>
                          <div><br>
                          </div>
                          Update test<br>
                          Date = Fri Oct 07 19:29:07 BRT 2016<br>
                          objectClass = __ACCOUNT__<br>
                          action = UPDATE<br>
                          attributes = [roles:[role2]]<br>
                          options = [:]<br>
                          uid = 161<br>
                          <div><br>
                          </div>
                        </div>
                        <div>when, in my opinion, it should be, for
                          example,<br>
                          <div><br>
                          </div>
                          Update test<br>
                          Date = Fri Oct 07 19:29:07 BRT 2016<br>
                          objectClass = __ACCOUNT__<br>
                          action = UPDATE<br>
                          attributes = [roles:[role1,role2]]<br>
                          options = [:]<br>
                          uid = 161<br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>It seems as the connector treats the
                          "roles" attribute as a single-valued one.<br>
                          <div><br>
                          </div>
                          <br>
                        </div>
                        <div>Carlos A. Ferreira<br>
                        </div>
                        <div>TRT/MG<br>
                        </div>
                        <div>Brasil<br>
                        </div>
                        <div class="gmail_extra"><br>
                        </div>
                      </div>
                      <br>
                    </div>
                  </div>
                  <span class="">______________________________<wbr>_________________<br>
                    midPoint mailing list<br>
                    <a moz-do-not-send="true"
                      href="mailto:midPoint@lists.evolveum.com"
                      target="_blank">midPoint@lists.evolveum.com</a><br>
                    <a moz-do-not-send="true"
                      href="http://lists.evolveum.com/mailman/listinfo/midpoint"
                      target="_blank">http://lists.evolveum.com/<wbr>mailman/listinfo/midpoint</a><br>
                  </span></blockquote>
                <span class="HOEnZb"><font color="#888888">
                    <div><br>
                      <br>
                    </div>
                    <div><br>
                    </div>
                    <div>-- <br>
                    </div>
                    <div><span name="x"></span>Ivan Noris<br>
                      Senior Identity Engineer<br>
                      <a moz-do-not-send="true"
                        href="http://evolveum.com" target="_blank">evolveum.com</a><span
                        name="x"></span><br>
                    </div>
                  </font></span></div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            midPoint mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br>
            <a moz-do-not-send="true"
              href="http://lists.evolveum.com/mailman/listinfo/midpoint"
              rel="noreferrer" target="_blank">http://lists.evolveum.com/<wbr>mailman/listinfo/midpoint</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Ivan Noris
Senior Identity Engineer
evolveum.com
</pre>
  </body>
</html>