You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Merve Temizer <me...@gmail.com> on 2012/09/06 11:34:25 UTC
Getting Parent Dn
Hi,
I use JNDI and i have some search result entries and i can get their dn s
like
NamingEnumeration answer = ctx.search(searchBaseDn, filter, ctls);
try
{
while (answer.hasMore())
{
SearchResult sr = (SearchResult) answer.next();
OrganizationPojo organizationPojo = new OrganizationPojo();
organizationPojo.setDn((String)sr.getName());
...
How can i get parent entry/dn ?
Re: Getting Parent Dn
Posted by Merve Temizer <me...@gmail.com>.
thanks in advance
2012/9/6 Kiran Ayyagari <ka...@apache.org>
> using JNDI you can do this
>
> LdapName name = new LdapName( "uid=adm\\,in,ou=sys\\,tem" );
> name.remove( 1 );
>
> now 'name' contains the parent's DN
>
> On Thu, Sep 6, 2012 at 3:33 PM, Merve Temizer <me...@gmail.com>
> wrote:
> > Should i do this by processing(cropping) srings, or is there an elegant
> way?
> > Maybe is there a way to convert dn string to LdapName ad subtract one
> from
> > another?
> >
> >
> > 2012/9/6 Kiran Ayyagari <ka...@apache.org>
> >>
> >> just strip the RDN from the DN of the each entry received in the
> >> search results, that will be the
> >> corresponding entry parent's DN
> >>
> >> On Thu, Sep 6, 2012 at 3:04 PM, Merve Temizer <me...@gmail.com>
> >> wrote:
> >> > Hi,
> >> > I use JNDI and i have some search result entries and i can get their
> dn
> >> > s
> >> > like
> >> >
> >> > NamingEnumeration answer = ctx.search(searchBaseDn, filter, ctls);
> >> > try
> >> > {
> >> > while (answer.hasMore())
> >> > {
> >> > SearchResult sr = (SearchResult) answer.next();
> >> > OrganizationPojo organizationPojo = new OrganizationPojo();
> >> > organizationPojo.setDn((String)sr.getName());
> >> > ...
> >> >
> >> > How can i get parent entry/dn ?
> >>
> >>
> >>
> >> --
> >> Kiran Ayyagari
> >> http://keydap.com
> >
> >
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>
Re: Getting Parent Dn
Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 9/6/12 12:31 PM, Kiran Ayyagari a écrit :
> using JNDI you can do this
>
> LdapName name = new LdapName( "uid=adm\\,in,ou=sys\\,tem" );
> name.remove( 1 );
Or
if ( name.size != 0 )
{
Rdn myRdn = name.getRdn( name.size() - 1 );
}
Do *not* manipulate the String. Never. Ever...
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
Re: Getting Parent Dn
Posted by Kiran Ayyagari <ka...@apache.org>.
using JNDI you can do this
LdapName name = new LdapName( "uid=adm\\,in,ou=sys\\,tem" );
name.remove( 1 );
now 'name' contains the parent's DN
On Thu, Sep 6, 2012 at 3:33 PM, Merve Temizer <me...@gmail.com> wrote:
> Should i do this by processing(cropping) srings, or is there an elegant way?
> Maybe is there a way to convert dn string to LdapName ad subtract one from
> another?
>
>
> 2012/9/6 Kiran Ayyagari <ka...@apache.org>
>>
>> just strip the RDN from the DN of the each entry received in the
>> search results, that will be the
>> corresponding entry parent's DN
>>
>> On Thu, Sep 6, 2012 at 3:04 PM, Merve Temizer <me...@gmail.com>
>> wrote:
>> > Hi,
>> > I use JNDI and i have some search result entries and i can get their dn
>> > s
>> > like
>> >
>> > NamingEnumeration answer = ctx.search(searchBaseDn, filter, ctls);
>> > try
>> > {
>> > while (answer.hasMore())
>> > {
>> > SearchResult sr = (SearchResult) answer.next();
>> > OrganizationPojo organizationPojo = new OrganizationPojo();
>> > organizationPojo.setDn((String)sr.getName());
>> > ...
>> >
>> > How can i get parent entry/dn ?
>>
>>
>>
>> --
>> Kiran Ayyagari
>> http://keydap.com
>
>
--
Kiran Ayyagari
http://keydap.com
Re: Getting Parent Dn
Posted by Merve Temizer <me...@gmail.com>.
Should i do this by processing(cropping) srings, or is there an elegant way?
Maybe is there a way to convert dn string to LdapName ad subtract one from
another?
2012/9/6 Kiran Ayyagari <ka...@apache.org>
> just strip the RDN from the DN of the each entry received in the
> search results, that will be the
> corresponding entry parent's DN
>
> On Thu, Sep 6, 2012 at 3:04 PM, Merve Temizer <me...@gmail.com>
> wrote:
> > Hi,
> > I use JNDI and i have some search result entries and i can get their dn s
> > like
> >
> > NamingEnumeration answer = ctx.search(searchBaseDn, filter, ctls);
> > try
> > {
> > while (answer.hasMore())
> > {
> > SearchResult sr = (SearchResult) answer.next();
> > OrganizationPojo organizationPojo = new OrganizationPojo();
> > organizationPojo.setDn((String)sr.getName());
> > ...
> >
> > How can i get parent entry/dn ?
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>
Re: Getting Parent Dn
Posted by Kiran Ayyagari <ka...@apache.org>.
just strip the RDN from the DN of the each entry received in the
search results, that will be the
corresponding entry parent's DN
On Thu, Sep 6, 2012 at 3:04 PM, Merve Temizer <me...@gmail.com> wrote:
> Hi,
> I use JNDI and i have some search result entries and i can get their dn s
> like
>
> NamingEnumeration answer = ctx.search(searchBaseDn, filter, ctls);
> try
> {
> while (answer.hasMore())
> {
> SearchResult sr = (SearchResult) answer.next();
> OrganizationPojo organizationPojo = new OrganizationPojo();
> organizationPojo.setDn((String)sr.getName());
> ...
>
> How can i get parent entry/dn ?
--
Kiran Ayyagari
http://keydap.com