Develop > Controller layer > Application developer > Member subsystem > Member search
ECUserQuery object
The ECUserQuery object, used to perform member search, can be extended. This object is used to find users in the WebSphere Commerce database.
It supports the following tables:
USERS The user's record USERREG The user's registry record USERDEMO The user's demographics information USERPROF The user's profile information ORGENTITY The user's parent organization ADDRESS The user's self address (the address of the user's parent organization) BUSPROF The user's business profile information ACCOUNT Accounts owned by the parent organization MBRROLE Roles played by the user MBRATTRVAL Custom member attributes for the user MBRREL The user's ancestors
This means that you can search based on any numeric or string attribute in any of these tables.
Example 1: Search by logonId
In this example, the query object generates an SQL query to find all users whose logonId is LIKE %myLogon%. The query has only one condition, a search condition on USERREG.LOGONID where the search type is case insensitive containing. The USERREG table is automatically joined with the USERS table for the search.
ECUserQuery query = new ECUserQuery();
WhereClauseSearchCondition whereClause = new WhereClauseSearchCondition( new TableField("USERREG", "LOGONID"), WhereClauseSearchCondition.SEARCHTYPE_CASEINSENSITIVE_CONTAINS, "myLogon");
query.setWhereClause(whereClause);
Vector vecResults = (new UserSearchAccessBean()) .executeCustomizeableMemberSearch(query);
Example 2: Find all users with a given logonId and with a given parent organization
This example shows searching by logonId and parent organization name.
ECUserQuery query = new ECUserQuery();
WhereClauseSearchCondition whereClause = new WhereClauseSearchCondition( new TableField("USERREG", "LOGONID"), WhereClauseSearchCondition.SEARCHTYPE_CASEINSENSITIVE_CONTAINS, "myLogon"); whereClause.appendANDCondition( new WhereClauseSearchCondition( new TableField("ORGENTITY", "ORGENTITYNAME"), WhereClauseSearchCondition.SEARCHTYPE_CASESENSITIVE_STARTSWITH, "myParentOrgName"));
query.setWhereClause(whereClause);
Vector vecResults = (new UserSearchAccessBean()) .executeCustomizeableMemberSearch(query);
In this example, two where clauses have now been combined with an AND condition. The JOIN condition for the ORGENTITY table stipulates that it should search based on the parent organization.
Related concepts
Related tasks
Extend the ECOrganizationQuery and ECUserQuery objects
Related reference