Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Error creating saved search through WOM API
beansalex
I have encountered problem when creating saved search through WOM API.
I first create a CommonSearch object and result did return in the code. However, after it was saved as a SavedSearch, error displayed in the web UI and no criteria found when editing the properties of the saved search. Anyone can help?
Code fragment:
Collection childrenLayout = new ArrayList();
SearchComponent searchComponent = project.getFacility().getViewSet().getDataModel().getSearchComponentByName(CRDCaseDocType.DATASOURCE);
Vector searchReturnedItems = new Vector();
CommonSearch cs = project.getLibrary().createCommonSearch(searchComponent);
String[] propertyTypes = {"EXT::CASE_ID", "EXT::FIRST_NAME", "EXT::LAST_NAME", "EXT::FLIGHT_NUMBER", "EXT::MEMBERSHIP_NO"};
ArrayList workspaceList = new ArrayList();
workspaceList.add(project.getWorkspace().getId());
searchReturnedItems.add(new SearchArgument.SearchReturnedItem(CRDCaseDocType.getTypeDescription(project.getLibrary()),propertyTypes));
searchSameName = project.createSavedSearch(searchComponent);
//log.debug("debug::::"+cs.)
cs.setScope(CommonSearch.Scope.WORKSPACE_LIST);
cs.setScopeList(workspaceList);
cs.setProfileCondition("(EXT::FIRST_NAME=\""+customerFirstName+"\") AND (EXT::LAST_NAME=\""+customerLastName+"\")");
cs.setItemsToReturn(Integer.valueOf(20));
// cs.createConfiguration(arg0)
cs.setReturnedItems(searchReturnedItems);
SearchExecuter se = project.getLibrary().getSearchExecuter(cs);
Collection results = se.getResults();
// log.debug("debug:::: "+results);
log.debug(results.size());
for(Object obj: results) {
SearchResultReference sr = (SearchResultReference)obj;
log.debug("debug2:::: "+sr.getResultPropertyValueString("EXT::CASE_ID")+":"+sr.getResultPropertyValueString("EXT::FIRST_NAME"));
}
searchSameName.setSecurityPolicy(WOMUtil.getSecurityPolicyByName(project.getWorkspace(), "View"));
searchSameName.setName(SEARCH_SAME_NAME);
searchSameName.saveSearch(cs);
searchSameName.update();
childrenLayout.add(new Container.ChildLayout(searchSameName.getId(),"column2",1));
project.changeLayout(childrenLayout);
// searchSameName.update();
project.update();
Log output:
2008-11-24 12:30:27,875 DEBUG [http-9080-Processor25] com.beansfactory.wsmp5.cx.crd.CRDCase - 2
2008-11-24 12:30:27,875 DEBUG [http-9080-Processor25] com.beansfactory.wsmp5.cx.crd.CRDCase - debug2:::: 1400:Lui
2008-11-24 12:30:27,875 DEBUG [http-9080-Processor25] com.beansfactory.wsmp5.cx.crd.CRDCase - debug2:::: 1900:Lui
Msg on web:
WorkSite MP has encountered an error. Additional information is unavailable.
No results found.
Find more posts tagged with
Comments
There are no comments yet