Delete entry in destination using conditions (syncOptions) 

Hello,

I am trying to enforce the following behavior with "<conditions>" directive 
using the documentation (i.e. Documentation » Version 2.1 » LSC Configuration » 
Synchronization Rules) :

   IF ( "mail" attribute in source == "mail" attribute in destination (i.e. 
duplicate entry) ) 
   AND IF ( "description" attribute in destination == "FR" )
   THEN delete entry in destination.


I don't want to synchronize entries because it is already done by first task 
inside same xml file (only delete duplicate entry).   
   
I tried the configuration bellow but nothing happen (no erreor, no delete) :
----------------------------------------------------
<task>

  <name>delete-duplicate-entry</name>
  <bean>org.lsc.beans.SimpleBean</bean> 

  <ldapSourceService>
    <name>src-ldap</name>
    <connection reference="ldap-ro" />
    <baseDn>dc=contacts,dc=fr</baseDn>
    <pivotAttributes>
      <string>mail</string>
      <string>description</string>  
    </pivotAttributes>
    <fetchedAttributes>
      <string>mail</string>
      <string>description</string>  
      <string>objectClass</string>         
    </fetchedAttributes>
    <getAllFilter>(objectClass=inetOrgPerson)</getAllFilter>
    <getOneFilter>(&amp; (mail={mail}) (objectClass=inetOrgPerson) 
)</getOneFilter> 
    <cleanFilter>(&amp; (mail={mail}) (objectClass=inetOrgPerson) 
)</cleanFilter> 
  </ldapSourceService>

  <ldapDestinationService> 
    <name>dst-ldap</name>
    <connection reference="ldap-rw" />
    <baseDn>dc=contacts,dc=internal</baseDn>
    <pivotAttributes>
      <string>mail</string>
      <string>description</string>  
    </pivotAttributes>
    <fetchedAttributes>
      <string>description</string>  
      <string>mail</string>
      <string>objectClass</string> 
    </fetchedAttributes>
    <getAllFilter>(objectClass=inetOrgPerson)</getAllFilter>
    <getOneFilter>(&amp; (mail={mail}) (objectClass=inetOrgPerson) 
)</getOneFilter>
  </ldapDestinationService>

  <propertiesBasedSyncOptions>
    <!-- If you have an “update only” task, and the DN cannot be inferred from 
the source referrential, you can also use the dstBean: -->
    <mainIdentifier>dstBean.getMainIdentifier()</mainIdentifier>
    <defaultDelimiter>;</defaultDelimiter>
    <defaultPolicy>FORCE</defaultPolicy>
    <conditions> 
      <create>false</create>
      <update>false</update>
      <!-- In the condition delete you have access to the dstBean. -->
      <delete><![CDATA[ dstBean.getDatasetFirstValueById('description') == "FR" 
]]></delete>
      <changeId>false</changeId>
    </conditions>
  </propertiesBasedSyncOptions>

</task>
----------------------------------------------------

I probably misunderstood something but I don't see where...

So how can I configure LSC to apply this behavior with "conditions" ?
Or maybe is there another way to do this ?

Thx
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to