Hi All:

It just occurred to me that pivotAttributes in LSC may support more than 1
string attributes?

Is something like the below possible --- it does not work yet -- but was
wondering if I am on the right path.

i.e.to pivot on the 2 attribute combination from the source database tables
which are guaranteed to be unique: the course group name(cn) and the login
name(uid)?

I'm still hitting a snag --- i.e. it is an error w.r.t the pivot condition
on "cn" --- I am missing something --- not sure if I'm on the correct path
and should push further.

Error message: ERROR - Error while synchronizing ID {uid=smith,
cn=ZOOL_649_001_2015W}: org.lsc.exception.LscServiceException: Only a
single record can be returned from a getObject request ! For id=smith,
ZOOL_649_001_2015W (8), there are 72 records !

Thanks.


*Source: Database (sample table data*)

*TABLE 1*
COURSE
course A
course B


*TABLE 2*
COURSE      LOGIN_NAME
course A       student 1 uid
course B       student 1 uid
course A       student 2 uid

*In InetOrgPerson.xml:*
        select unique sect.COURSE as "cn", s2s.LOGIN_NAME as "uid" from
TABLE1 sect, TABLE2 s2s
        where
        sect.course = #cn# and
        sect.course=s2s.course


*In LSC:*

 <pivotAttributes>
          <string>cn</string>
          <string>dept</string>
          <string>uid</string>
  </pivotAttributes>


<mainIdentifier>"cn=" + srcBean.getDatasetFirstValueById("cn") + " +",ou="
+ srcBean.getDatasetFirstValueById("dept") + ",ou=example"</mainIdentifier>

<dataset>
        <name>uniqueMember</name>
        <policy>FORCE</policy>
        <forceValues>
            <string>
                <![CDATA[rjs:
                    var membersSrcDn = srcBean.getDatasetValuesById("uid");
                    var membersDstDn = [];
                    for  (var i=0; i<membersSrcDn.size(); i++) {
                    var memberSrcDn = membersSrcDn.get(i);
                    var uid = "";
                    try {
                    uid = srcLdap.attribute(memberSrcDn, "uid").get(0);
                    } catch(e) {
                    continue;
                    }
                    var destDn = ldap.search("ou=example", "(uid=" + uid +
")");
                    if (destDn.size() == 0 || destDn.size() > 1) {
                    continue;
                    }
                    var destMemberDn = destDn.get(0) + "," +
ldap.getContextDn();
                    membersDstDn.push(destMemberDn);
                    }
                    membersDstDn
                ]]>
            </string>
        </forceValues>
        </dataset>







On Mon, Feb 1, 2016 at 11:04 AM, Joel Levin <[email protected]>
wrote:

> Hi All:
>
> Have a bit of a conundrum and wondering if list has any suggestions.
>
> Source: Database (sample table data)
>
> COURSE      STUDENT
> course A       student 1
> course B       student 1
> course A       student 2
>
>
> Target: LDAP (sample end result  below)
>
> cn= course A, ou=foo, ou=bar
> uniqueMember = student 1
> uniqueMember = student 2
>
> cn=course B, ou=foo, ou=bar
> uniqueMember = student 1
>
> Problem to Solve: How to populate the students into the course groups?
>
> Using the group 'cn' as the pivot --- It works if there is just 1 row,
> i.e. 1 student, for a course (say course B) --- but there are multiple of
> rows for each course in the source database (1 row per each student
> enrolled in the course). In total, there are ~700k rows.
>
> Any thoughts on approaching the conundrum?
>
> Thanks.
>
>
>
_______________________________________________________________
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