Hello Dave.
I tried with XWSContactsGroups and had the same results, Im gonna try
to be more clear of what Im doing:
There must be something in the WSContacts already that refers back
to the XWSContactGroup. You should use that existing attribute as
the FK.
There is no such an attribute in the LDAP server for XWSContact, or
XWSContactsGroup.
all turns around the DN. after reading the documentation of the JNDI
plugin for webobjects, it says that the relativeDistinguishName (rdn)
is a attribute that acts as a PK (comparing to a SQL server) but this
is a string and its not auto-generated(there is a work around). so ie.
XWSContactsGroup DN's
cn=Apple,cn=Contacts,o=xws
Apple is a XWSContactGroup, the rdn is cn=Apple,cn=Contacts and the
base search is o=xws.
with the qualifier I created I specify (correct me if Im wrong),
qqual = new
ERXKeyValueQualifier(XWSContactsGroup.RELATIVE_DISTINGUISHED_NAME_KEY,
EOQualifier.QualifierOperatorContains,"cn=Contacts");
NSArray<XWSContactsGroup> gl =
XWSContactsGroup.fetchXWSContactsGroups(ec, qqual,
new NSArray(new Object[]
{ EOSortOrdering.sortOrderingWithKey(XWSContactsGroup.CN_KEY,
EOSortOrdering.CompareAscending)}));
I want all the XWSContactsGroup that are inside the XWSContactGroup
with rdn: Contacts, including this last one (which is the parent group)
and when I want to check the cn of wach object in the array, well, I
get n-times the cn of one of the XWSContactGroup.
So, you are getting the number of records you'd expect, but they are
all same XWSContact? That sounds extremely odd. What data are you
expecting to be in the "cn" attribute of the XWSContact?
the cn attribute is the current name of that element.
IT IS ODD. why should I get the right number of elements but all the
same elements.
I have tried doing it trough objectswithfetchspecification, but well
it does nothing different, I was doing the same as the _XXX.java class
does in int he fetch method.
odd odd odd... dont get it why.
maybe somebody will?...
Gus
On May 11, 2009, at 1:48 PM, David Avendasora wrote:
On May 11, 2009, at 7:10 AM, Gustavo Adolfo Pizano wrote:
Hello David.
Yes in fact I have realized about that.. in the LDAP there is no FK
attribute, and I can't modify the schema, so I need to come with
something.
There must be something in the WSContacts already that refers back
to the XWSContactGroup. You should use that existing attribute as
the FK.
I have done the following to fetch all XWSContacts in a specific
XWSCntacGroup.
EOQualifier qqual = new
ERXKeyValueQualifier(XWSContact.RELATIVE_DISTINGUISHED_NAME_KEY,
EOQualifier
.QualifierOperatorCaseInsensitiveLike,"cn=Dolis,cn=Contacts");
NSArray<XWSContact> cs= XWSContact.fetchXWSContacts(ec, qqual,null);
What attribute in XWSContatGroup would contain "cn=Dolis,cn=Contacts"?
when I check the size of the NSArray, I see it has 18 elements,
which in fact checking the LDAP server it's true...
Okay, so it looks like that should be the FK, why can't you use that
then?
BUT!, when I do the following to check the cn of all the
XWSContacts :
for(int i =0 ;i < cs.size(); i++)
{
System.out.println(cs.objectAtIndex(i).cn());
}
On a completely side note, here's a much nicer way of doing the for
loop (if you are using WO 5.4 or WO 5.3 with WOnder):
for (XWSContact aContact : cs)
{
System.out.println(aContact.cn());
}
I get the follwoing:
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
7764-Sucharov‡
which is one of the XWSContact with is inside the group I specify
in the Qualifier... I dunno what's wrong with the qualifier.. :S
So, you are getting the number of records you'd expect, but they are
all same XWSContact? That sounds extremely odd. What data are you
expecting to be in the "cn" attribute of the XWSContact?
Dave
Any clue?
Gustavo
On May 11, 2009, at 12:52 PM, David Avendasora wrote:
Hi Gustavo,
I have never done any LDAP stuff, but I see a couple things that
don't sound or look quite right. Maybe they are, but I figure it
can't hurt to make some observations. See below:
On May 11, 2009, at 4:38 AM, Gustavo Adolfo Pizano wrote:
Hello again, and sorry for disturbing so much, but this topic is
giving me a headache due that is first time I work with LDAP and
not an WO/EOF expert.
I have two Entity (reversed engineered form the LDAP server)
called XWSContactsGroup and XWSContact.
XWSContactgroup can have more XWSContactsGroup ObjClass inside
and XWSContact also. so it will look like.
-XWS (root)
-Contacts (XWSContactsGroup)
-Apple.(XWSContactsGroup)
-Gustavo Pizano
-XWS(XWSContactsGroup)
-Veronica Pizano
-Carolina Pizano
-PhotoCenter(XWSContactsGroup)
-Gilbert Pizano
etc.
When I try to set the relations in EOModeler, I just did it as I
normally did with a SQL server, it palced a FK called
XWSContactsGroupID and the respectively relationships.
Are you saying that when you added the relationship in Entity
Modeler, it added a FK attribute that is not actually in the LDAP
server? Entity Modeler gives you the option to specify what the PK
and FK are maually, and if you don't it can create new ones. I
don't think you want it creating new ones. Go back to Entity
Modeler and select the relationship and make sure the source and
destination attributes of the relationship are the correct
attributes - the same ones that the LDAP server will use to join
the records together.
When I do the fetch of one XWSContactsGroup, let say i.e , and I
try to get what it has inside, in this case more
XWSContactsGroup, I get hte following exception. :
com.webobjects.jndiadaptor.JNDIAdaptorException: Cannot get type
with name relativeDistinguishedName for attribute
xWSContactsGroupID
Above you say the FK is called "XWSContactsGroupID" and here it's
complaining about "xWSContactsGroupID" (note the lowercase "x").
Could that be causing problems?
I checked, and it seems weird to me that, of course the
relativeDistinguishedName att (pk) will never be the same,
How can a PK never be the same? Isn't it the identifier of the
record in the LDAP record? How can that change without breaking
lots of stuff?
Dave
so how can I set up the relationship and against what, to make it
work properly?, or should I connect directly to the server
avoiding the EOF?
Thanks again,
Gustavo Pizano
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]