Skip to Content.
Sympa Menu

grouper-dev - subject API changes

Subject: Grouper Developers Forum

List archive

subject API changes


Chronological Thread 
  • From: Chris Hyzer <>
  • To: "" <>
  • Subject: subject API changes
  • Date: Fri, 30 Oct 2009 16:49:06 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US

Hey,

My latest (and last) round of subject api changes are:

1. I added support for too many results found. At penn we display users like
this:

Michael Christopher Hyzer (mchnetid, 12345678) Pennpay, Staff (active)

Note non active people have this at the end: (NOT ACTIVE). So if someone
searches for "act" they will get everyone back (300k). This severely hurts
our server. :)

So I added support for a setting in jdbc and jdbc2 sources:

<init-param>
<param-name>maxResults</param-name>
<param-value>1000</param-value>
</init-param>

And in JDBC if it is scrolling through the resultset, and it hits that max
number (if set), then it will throw a SubjectTooManyResults exception. If
that is thrown in the UI (struts or ajax), then a friendly message will be
displayed to the user.

So, if someone who does ldap wants to change the ldap source, or the UW ldap
source, feel free. I kind of think for jdbc there should be a default (e.g.
5k) since I don't know why you would want more than that... but someone can
confirm this...

Thanks to Gary for his help on this one.

https://bugs.internet2.edu/jira/browse/GRP-320

2. Here is a method that is useful for gsh or imports of data:

/**
* find by id or identifier. pass in either an id or an identifier
* @param idOrIdentifier
* @param exceptionIfNull if SubjectNotFoundException or null
* @return the subject
* @throws SubjectNotFoundException
* @throws SubjectNotUniqueException
*/
public Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean
exceptionIfNull)
throws SubjectNotFoundException, SubjectNotUniqueException;

It is implemented in the BaseSource, so every source should extend that, and
you don't have to change anything.

Im not using these next three methods yet, but I added it to the source
interface, and will start using them shortly. They help with the problem
with grouper of sorting large membership lists. If there is a group with
80k, this wont help. But if there is a group of 1k, and you are using the
jdbc2 source, then we could bulk retrieve all members in a few dozen calls.
These are also implemented in the BaseSource, so other sources don't need to
be changed. But if this is possible in the ldap sources, and someone can
implement an efficient way to do it (btw, sending batches of 100 is what I
will do in the jdbc2 source), then please go forward with it. If there isn't
a more efficient way to do this than individual calls, then don't worry about
it, the BaseSource will do that for you. I get complaints that groups of
size 1000 arent sorted at Penn, and I don't want to do 1000 lookups to do
that! :) ...

/**
* Get subjects by ids. Note, if the subjects arent found or arent unique,
* they wont be returned. Duplicates are ok on the input, but will return
one output.
* @param ids
* @return a map of results never null indexed by the id
*/
public Map<String, Subject> getSubjectsByIds(Collection<String> ids);

/**
* Get subjects by identifiers. Note, if the subjects arent found or arent
unique,
* they wont be returned. Identifiers are unique ways to refer to a
subject that
* isnt its id (e.g. netid). Duplicates are ok on the input, but will
return one output.
* @param identifiers
* @return a map of results never null indexed by the identifiers
*/
public Map<String, Subject> getSubjectsByIdentifiers(Collection<String>
identifiers);

/**
* Get subjects by ids or identifiers. Note, if the subjects arent found
or arent unique,
* they wont be returned. Identifiers are unique ways to refer to a
subject that
* isnt its id (e.g. netid). Duplicates are ok on the input, but will
return one output.
*
* @param idsOrIdentifiers each string could be a subject id or identifier
* @return a map of results never null indexed by the id or identifier that
was passed in.
* Note, the same subject could be returned twice if looked up by id and
identifier (two inputs)
*/
public Map<String, Subject>
getSubjectsByIdsOrIdentifiers(Collection<String> idsOrIdentifiers);





Archive powered by MHonArc 2.6.16.

Top of Page