searchResourcePools
Purpose
This operation searches for resource pool objects in PPM Center based on certain criteria.
Function and Parameters
This operation returns all resource pool objects matching the search criteria from PPM Center.
The user performing this operation must have one of the following access grants:
-
View Resource Pools
-
View All Resource Pools
-
Edit Resource Pool
-
Edit All Resource Pools
Required Fields: None
Optional Fields:
-
Name
-
Description
-
Parent
-
Org unit
-
Manager
-
Region
If none of the optional fields are set, all resource pools are returned. If more than one criteria are specified, they are combined with each other by the AND logic.
Limitations
Performance might be an issue if more than a few thousand resource pools are read at once.
Input
ResourcePoolSearchFilter
Return
ResourcePool matching the criteria.
Java Interface
CreateResourcePoolsResponseDocument createResourcePools( CreateResourcePoolsDocument in)
Parameters |
Description |
---|---|
SearchResourcePoolsDocument |
Wrapper of the resource pool search filter. (ResourcePoolSearchFilter) |
SearchResourcePoolsResponseDocument |
Wrapper for the resource pool array. (WSResourcePoolBean[]) |
Java Examples
Example: search resource pools.
/** * Create a search filter with all fields set to match the nonnull fields of a *specific resource pool, thereby creating a search filter that should match only that *one resource pool. * @param target The resource pool that the filter will be made for. * @return the search filter. */ ResourcePoolSearchFilter createSearchFilter(ResourcePool target) { ResourcePoolSearchFilter filter = ResourcePoolSearchFilter.Factory.newInstance(); filter.setName(target.getName()); // required field filter.setDescription(target.getDescription()); filter.addNewRegion().setName(target.getRegion().getName()); // required field if (target.sizeOfManagerArray() > 0) { // use the first of the resource pool's managers in the search query
filter.addNewManager().setName(target.getManagerArray(0).getNam e()); } if (target.getOrgUnit() != null) {
filter.addNewOrgUnit().setName(target.getOrgUnit().getName()); } if (target.getParent() != null) {
filter.addNewParent().setName(target.getParent().getName()); } return filter; }
/** * This is a wrapper method around the searchResourcePools web service, which reads *resource pools based on filter criteria. This method handles the details of creating *the document, invoking the service and unwrapping the response. * * @param filter A bunch of filter fields to narrow down the search. * @return Zero or more resource pools that match the search criteria. * @throws Exception */ ResourcePool[] searchResourcePools(ResourcePoolSearchFilter filter) throws Exception { ResourceServiceStub service = new ResourceServiceStub(ctx, WSURL); SearchResourcePoolsDocument searchResourcePoolsDoc = SearchResourcePoolsDocument.Factory.newInstance();
searchResourcePoolsDoc.addNewSearchResourcePools().setFilter(filter);
SearchResourcePoolsResponse searchResponse = service.searchResourcePools(searchResourcePoolsDoc).getSearchResourcePoolsResponse();
return searchResponse.getResourcePoolArray(); }
Errors and Exceptions
When an error occurs on this operation, you will see a description of the root cause in the log or in the response message.
The server log file content is similar to the following:
Exception in thread "main" org.apache.axis2.AxisFault: <exception:exceptionDetails xmlns:exception="http:// www.mercury.com/ppm/ws/exception"> <exception:detail>[root cause description] </exception:detail> </exception:exceptionDetails>
Possible root cause descriptions
Message Code | Message | Cause(s) | Possible Corrective Action |
---|---|---|---|
exception.authorization | You do not have the privilege to take this action. Consult your PPM Administrator. | You do not have the required access grants for this operation. | Verify that your account has the required access grants. |