cancel
Showing results for 
Search instead for 
Did you mean: 

UME- pulling too many records

Former Member
0 Kudos

Apparently when we brought our LDAP data over into the UME we pulled in things like systems and not simply users. Therefore we've got around 10,000+ UME entries whereas we have perhaps 3000 actual portal users.

I have coded an EVS help to allow a user to select a portal user and populate an Input Box. I put the code to populate this into the wdDoInit method so the application is taking a good 2-3 minutes to launch.

I found that if I do a restriction on email address containing an "@" sign that seems to get it down to under 5000 records but that operation seems like it's rather slow (maybe because it's using LIKE_OPERATOR??)- I do that using the following code:

isf = ufact.getUserSearchFilter();

isf.setEmail("@", ISearchAttribute.LIKE_OPERATOR,true)

My question, then, has a couple of levels to it...

1. Is there a way to keep these "bad" records from ever getting into the UME? My colleague seems to think that she saw something about this somewhere, printed it off, and now cannot find it.

2. Is there a better way for me to access this user information. Basically I need a name (the UniqueName field) and the Email but no other info. Would it make sense to set up some kind of job to pull in the entire UME on a regular basis and then pare it down and put it into a table local to the Webdynpro/J2EE projects? I know I will have need to do this kind of selection in multiple future projects so I want to find an elegant solution that I can then apply elsewhere.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Answers (4)

Answers (4)

Former Member
0 Kudos

Weird thing is - I still cannot debug but I am putting in a statement to print a message to the Message Area in various sections of the code.

I seem to get to just before the creation of the users array but I do not proceed any further than that- my code seems to stop at that statement because if I put a message right after the creation of the users array it never gets there. Any idea what could cause that? I was a little suspicious because I put a valueSet.put ("Joe Schmoe", "Joe_Shmoe@company.com") right before I sort the list and it didn't display but when I moved it up to after the creation of valueSet it worked fine.

Former Member
0 Kudos

When I put the creation of the users array into another try catch block I am seeing this exception:

Exception com.sap.security.core.locking.TechnicalLockException: Cannot lock at least one of the 4,700 locks for the owner 2006120111090170900000tewk-epdv..................438715650; table-overflow (returncode = 16).

Any idea how I can overcome this? I will look to see if I can find any info on this particular exception. On the plus side I'm guessing the code is correct!!

Former Member
0 Kudos

I must have some bad data in the UME because with the following code to select just the "Kathy*" people I get the 4 or 5 records pulled back very quickly. I'm thinking we still have over 1000 records in the UME that are not "people" that should be removed. Here is the code I have that is now "working" except for the security exception if I open up the search. Is there a way of finding, say, all of the unique usernames that begin with a letter from a-z? We have some stuff that begins with "@" or "__" or "zz" that are for testing that if I can remove them may help with the locking problem- unless there is a better solution for that...

-


IUserFactory ufact = UMFactory.getUserFactory();

IUserSearchFilter isf;

String strtest = "";

String strnamen = "";

String stremail = "";

try {

isf = ufact.getUserSearchFilter();

isf.setDisplayName("Kathy*", ISearchAttribute.LIKE_OPERATOR, false);

ISearchResult sr = ufact.searchUsers(isf);

String attributeName =

IPrivateGenReceiptsMainView.IReceiptElement.ADDRESSED_TO;

IWDAttributeInfo attributeInfo =

wdThis.wdGetContext().nodeReceipt().getNodeInfo().getAttribute(attributeName);

ISimpleTypeModifiable AddressedType = attributeInfo.getModifiableSimpleType();

AddressedType.setFieldLabel("AddressedTo");

IModifiableSimpleValueSet valueSet =

AddressedType.getSVServices().getModifiableSimpleValueSet();

final List ids = new ArrayList(sr.size());

for (; sr.hasNext(); ) ids.add( sr.next() );

/* Define only necessary attributes */

AttributeList attrs = new AttributeList();

attrs.addAttribute(IPrincipal.DEFAULT_NAMESPACE, IPrincipal.DISPLAYNAME,

AttributeList.TYPE_STRING);

attrs.addAttribute(IPrincipal.DEFAULT_NAMESPACE, "email",

AttributeList.TYPE_STRING);

IUserFactory ufact2 = UMFactory.getUserFactory();

/* GET DATA FOR ALL USERS VIA ONE QUERY */

try {

IUser[] users = ufact2.getUsers(

(String[])ids.toArray(new String[0]),

attrs

);

for (int i = 0, size = users.length; i < size; i++) {

strnamen = users<i>.getDisplayName();

stremail = users<i>.getEmail();

valueSet.put(strnamen, stremail );

}

valueSet.sort(true,true,true);

} catch (Exception e) {

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Exception " + e );

}

} catch (Exception e) {

e.printStackTrace();

}

Former Member
0 Kudos

Speed is much improved with the new code (on the order of between 1/2 the time and 1/3 of the time) although I don't get a list of users. Could the line in your code:

final IUser user = UMFactory.getUserFactory().getUser(strtest);

need to reference the users array in some way rather than strtest? I have tried a few things but haven't come up with anything that returns any users as of yet.

I tried users<i>.toString() among others as it looks like getUser takes a string arg.

You'll be glad to know I am signed up for the JA310 Web Dynpro class the week after next- maybe with some more practice I'll start to get the syntax right

Message was edited by:

Dana Boisvert

Former Member
0 Kudos

We did apply the negative user filter in the XML and got our list down to 5000 records. However my code to populate my search box is still taking a good 30 seconds to bring in the list of portal users.

Has anyone else experienced such lousy performance? Is there a way I can improve this any? My main view of my application simply displays a list of documents- when the user clicks on the "Create New" button I go to a view with a bunch of input fields, one of which is for entering the portal user that received a package from an outside shipper. It looks like the 5000 or so records are mostly legit so I need to be able to pull these in for the user to get the full list of people they need to be able to see.

Note that I am doing this code in the wdDoInit of the view- is that the proper place?

Any ideas would be welcome as this is about the only thing keeping me from my first deployed WD application. Here is the code in case that is the source of my bottleneck... If I remove the isf.setEmail line I bring in approx. 200 folks who don't have an email address defined- I don't see much of an improvement, time-wise, if I comment that line out. I have experimented with setting something like setUniqueName and using, say, "d*" and getting all usernames that begin with d but even that seems a little slower than I'd expect...

IUserFactory ufact = UMFactory.getUserFactory();

IUserSearchFilter isf;

try {

isf = ufact.getUserSearchFilter();

isf.setEmail("@.com", ISearchAttribute.LIKE_OPERATOR, false);

ISearchResult sr = ufact.searchUsers(isf);

String strtest = "";

String strnamen = "";

String stremail = "";

String attributeName =

IPrivateGenReceiptsMainView.IReceiptElement.ADDRESSED_TO;

IWDAttributeInfo attributeInfo =

wdThis.wdGetContext().nodeReceipt().getNodeInfo().getAttribute(attributeName);

ISimpleTypeModifiable AddressedType = attributeInfo.getModifiableSimpleType();

AddressedType.setFieldLabel("AddressedTo");

IModifiableSimpleValueSet valueSet =

AddressedType.getSVServices().getModifiableSimpleValueSet();

while (sr.hasNext()) {

strtest = sr.next().toString();

IUser user = UMFactory.getUserFactory().getUser(strtest);

strnamen = user.getDisplayName();

stremail = user.getEmail();

valueSet.put(user.getDisplayName(), user.getEmail() );

}

valueSet.sort(true,true,true);

} catch (UMException e) {

e.printStackTrace();

}

Former Member
0 Kudos

Dana,

Your code has 2 parts: search and retrieval. When you were playing with filter, you analyzed search part. Try to analyze the second: temporary comment out accessing user attributes and see how execution time changes.

while (sr.hasNext()) {
strtest = sr.next().toString();
//IUser user = UMFactory.getUserFactory().getUser(strtest);
//strnamen = user.getDisplayName();
//stremail = user.getEmail();
//valueSet.put(user.getDisplayName(), user.getEmail() );
}

If it changes significally, then there is a way to optimize "retrieval" part (below code replaces while loop):


/* Collect id of users */
final List ids = new ArrayList(sr.size());
for (; sr.hasNext(); ) ids.add( sr.next() );
	
/* Define only necessary attributes */
AttributeList attrs = new AttributeList();
attrs.addAttribute(IPrincipal.DEFAULT_NAMESPACE, IPrincipal.DISPLAYNAME, 
  AttributeList.TYPE_STRING);
attrs.addAttribute(IPrincipal.DEFAULT_NAMESPACE, "email", 
  AttributeList.TYPE_STRING);
	
/* GET DATA FOR ALL USERS VIA ONE QUERY */
final IUser[] users = ufact.getUsers(
  (String[])ids.toArray(new String[0]),
  attrs
);
	
for (int i = 0, size = users.length; i < size; i++) {
 final IUser user = UMFactory.getUserFactory().getUser(strtest);
 strnamen = user.getDisplayName();
 stremail = user.getEmail();
 valueSet.put(strnamen, stremail );
}

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

lajitha_menon
Contributor
0 Kudos

Hi Dana,

These users I believe would be assigned to roles. Hopefully they would not have assigned systems and other junk data to groups and roles. If yes, if you can find out a common group/role to which all users are assigned to, you can use the UME API to get users assigned to a particular group/role. That way you can filter just the users.

Cheers

LMenon