|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Search
The Search can be used to manage and perform searches for public objects in metadata. Searches are defined using search filters, folder scoping, and output manipulation settings i.e the result details. (attributes returned, sorting results, result limits).
You can search for public types in the metadata server that match specified search filters or you can scope the search to be within a specified folder in the SAS Folders tree. You can indicate if the search includes subfolders when doing a folder search or just within the folder specified.
The Search is created using the SearchFactory createSearch() method. If the search does not find any matched results, the user is returned an empty list.
The following is an example of using Search to search for all public objects in the metadata server that contain the name "Sample":
Search search = SearchFactory.createSearch(server); //where "server" is the ServerInterface //create the name filter and have it search for the name in the description field as well. ObjectNameFilter nameFilter = new ObjectNameFilter("Sample", true); //add the nameFilter to the search filters used in Search search.addFilter(nameFilter); //Only show the first 100 objects that match the search from all the results //returned from the server. If the server returns more than 100 matching objects we //limit what we see in the client to the first 100 in this example. search.getResultDetails().setResultLimit(100); //run the search, return a list of PublicObjects that search found. List |
The following is another example of using Search to search for all public objects, however this time we are searching within a folder, using multiple filters (Search by Name and by Dates):
Search search = SearchFactory.createSearch(server); //where "server" is the ServerInterface //create the name filter and have it search for the name. ObjectNameFilter nameFilter = new ObjectNameFilter("Sample", false); //Search for objects that were created between January 1, 2009 and December 15, 2009 Calendar cMin = Calendar.getInstance(); cMin.setTimeZone(TimeZone.getTimeZone("GMT")); cMin.set(Calendar.YEAR, 2009); cMin.set(Calendar.MONTH, Calendar.JANUARY); cMin.set(Calendar.DAY_OF_MONTH, 1); Calendar cMax = Calendar.getInstance(); cMax.setTimeZone(TimeZone.getTimeZone("GMT")); cMax.set(Calendar.YEAR, 2009); cMax.set(Calendar.MONTH, Calendar.December); cMax.set(Calendar.DAY_OF_MONTH, 15); DateFilter dateFilter = new DateFilter(DateType.CREATED_DATE, cMin.getTime(), cMax.getTime()); //add the nameFilter and dateFilter to the search filters used in Search search.addFilter(nameFilter); search.addFilter(dateFilter); //Change the sort order for the objects returned from the search so that they are //sorted by Type and then Name instead of by Name and then Type, which is the default. SortOrder[] order = {SortOrder.TYPE, SortOrder.NAME, SortOrder.CREATED_DATE}; search.getResultDetails().setSortOrder(order); //Search within the "/Products/SAS Intelligence Platform" folder in the SAS folders tree String path = "/Products/SAS Intelligence Platform(Folder)"; PathUrl pathURL = PathUrl.newPathUrlFromAbsolutePath(server, path); //Pass "true" to search in all subfolders as well search.setFolderScope(pathURL, true); //run the search, return a list of PublicObjects that search found. List |
Finally, here is another example of using Search to search for specific public objects, searching within a folder and using multiple search filters. (Search by Name and by Job and Library Types):
Search search = SearchFactory.createSearch(server); //where "server" is the ServerInterface //create the name filter and have it search for the name. ObjectNameFilter nameFilter = new ObjectNameFilter("Sample", false); //Set Public Types to search for (only Job and Library). List |
Method Summary | |
---|---|
void |
addFilter(SearchFilter filter)
Method to specify a search filter to use in this search. |
java.util.List<SearchFilter> |
getFilters()
Getter to retrieve the filters used for this search |
PathUrl |
getFolderScope()
If a folder was specified for scoping this search, the getter returns the folders path Url. |
OMIRepositoryInterface |
getRepository()
Returns the repository being searched. |
ResultDetails |
getResultDetails()
Returns the ResultDetails instance used when retrieving the objects from the server. |
java.util.List<PublicObjectInterface> |
getSearchResults()
Get the search results for this search. |
ServerInterface |
getServer()
Returns the ServerInterface instance used when retrieving the objects from the server. |
boolean |
isFolderSearchRecursive()
Returns the boolean value that tells us if we are recursively searching in subfolders when doing a folder search. |
void |
removeFilter(SearchFilter filter)
Removes a filter currently being used for the search. |
java.util.List<PublicObjectInterface> |
search()
Search the server using the provided search criteria that was set. |
void |
setFolderScope(PathUrl pathUrl,
boolean recurse)
If we are searching within the scope of a folder, set the folder path Url to search from. |
void |
setRepository(OMIRepositoryInterface repos)
Sets the repository to search within. |
Method Detail |
---|
ServerInterface getServer() throws java.rmi.RemoteException
java.rmi.RemoteException
- in the event of remote object failure.java.util.List<PublicObjectInterface> search() throws ServiceException, java.rmi.RemoteException
ServiceException
- if repository errors occur.
java.rmi.RemoteException
- in the event of remote object failure.ResultDetails getResultDetails() throws java.rmi.RemoteException
java.rmi.RemoteException
- in the event of remote object failure.void addFilter(SearchFilter filter) throws java.rmi.RemoteException
filter
-
java.rmi.RemoteException
- in the event of remote object failure.void removeFilter(SearchFilter filter) throws java.rmi.RemoteException
filter
-
java.rmi.RemoteException
- in the event of remote object failure.java.util.List<SearchFilter> getFilters() throws java.rmi.RemoteException
java.rmi.RemoteException
- in the event of remote object failure.void setFolderScope(PathUrl pathUrl, boolean recurse) throws java.rmi.RemoteException
pathUrl
- - the folder path URLrecurse
- - true or false. Recursively search through subfolders.
java.rmi.RemoteException
- in the event of remote object failure.PathUrl getFolderScope() throws java.rmi.RemoteException
java.rmi.RemoteException
- in the event of remote object failure.boolean isFolderSearchRecursive() throws java.rmi.RemoteException
java.rmi.RemoteException
- in the event of remote object failure.void setRepository(OMIRepositoryInterface repos) throws java.rmi.RemoteException
Note, this is only valid when a folder has not already been specified as well.
repos
- the repository to search within
java.rmi.RemoteException
- in the event of remote object failure.OMIRepositoryInterface getRepository() throws java.rmi.RemoteException
java.rmi.RemoteException
- in the event of remote object failure.java.util.List<PublicObjectInterface> getSearchResults() throws java.rmi.RemoteException
java.rmi.RemoteException
- in the event of remote object failure.
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |