4 Replies Latest reply: Feb 24, 2011 2:27 PM by stellentpmp RSS

    How to call GET_SEARCH_RESULTS service in filter

      Hi Experts,

      I wrote a custom filter and in filter i am calling GET_SEARCH_RESULTS service. But i am getting following error :
      intradoc.data.DataException: !csNoServiceDefined,GET_SEARCH_RESULTS
           at test.notification.ExpirationNotification.executeService(ExpirationNotification.java:195)
           at test.notification.ExpirationNotification.doCustomDailyEvent(ExpirationNotification.java:112)
           at test.notification.ExpirationNotification.doFilter(ExpirationNotification.java:51)
           at intradoc.shared.PluginFilters.filter(PluginFilters.java:92)
           at intradoc.server.ScheduledSystemEvents.checkScheduledEvents(ScheduledSystemEvents.java:161)
           at intradoc.server.IdcSystemLoader$13.handleManagerEvent(IdcSystemLoader.java:2411)
           at intradoc.server.SubjectManager$1.run(SubjectManager.java:92)

      Here is the code :

      public class ExpirationNotification implements FilterImplementor
           public int doFilter(Workspace ws, DataBinder eventData, ExecutionContext cxt)
                throws DataException, ServiceException
                String action = eventData.getLocal("action");
                if (action!=null && action.equals("CustomExpNotifyEvent"))
                     doCustomDailyEvent(ws, eventData, cxt);
                     return CONTINUE;
           }catch(Exception e){e.printStackTrace();}
                return CONTINUE;
           protected void doCustomDailyEvent(Workspace ws, DataBinder eventData,
                ExecutionContext cxt) throws DataException, ServiceException
                update("CustomExpNotifyEvent", "CustomExpNotifyEvent event started...", ws);
                     DataBinder serviceBinder = new DataBinder();
                     serviceBinder.putLocal("QueryText", "dOutDate > `<$dateCurrent()$>` <AND> dOutDate < `<$dateCurrent(30)$>`");
                     serviceBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
                          ResultSet results= serviceBinder.getResultSet("SearchResults");
                } catch(Exception e){e.printStackTrace();}
                update("CustomExpNotifyEvent", "CustomExpNotifyEvent finished successfully", ws);
           protected void update(String action, String msg, Workspace workspace) throws ServiceException, DataException
                long curTime = System.currentTimeMillis();
                ScheduledSystemEvents sse = IdcSystemLoader.getOrCreateScheduledSystemEvents(workspace);
                sse.updateEventState(action, msg, curTime);
           protected void trace(String str)
                SystemUtils.trace("scheduledevents", "- custom - " + str);
           public static Workspace getSystemWorkspace() {
                Workspace workspace = null;
                Provider wsProvider = Providers.getProvider("SystemDatabase");
                if (wsProvider != null)
                     workspace = (Workspace) wsProvider.getProvider();
                return workspace;

           * Obtain information about a user. Only the 'userName' parameter must be
           * non-null.
           public static UserData getFullUserData(String userName, ExecutionContext cxt,
                     Workspace ws) throws DataException, ServiceException {
                if (ws == null)
                     ws = getSystemWorkspace();
                UserData userData = UserStorage.retrieveUserDatabaseProfileDataFull(userName, ws, null, cxt, true, true);
                return userData;

           public void executeService(DataBinder binder, String userName,
                     boolean suppressServiceError) throws DataException,
                     ServiceException {
                // obtain a connection to the database
                Workspace workspace = getSystemWorkspace();
                // check for an IdcService value
                String cmd = binder.getLocal("IdcService");
                     if (cmd == null)
                     throw new DataException("!csIdcServiceMissing");
                // obtain the service definition
                ServiceData serviceData = ServiceManager.getFullService(cmd);
                if (serviceData == null)
                     throw new DataException(LocaleUtils.encodeMessage(
                               "!csNoServiceDefined", null, cmd));
                // create the service object for this service
                Service service = ServiceManager.createService(serviceData.m_classID,workspace, null, binder, serviceData);
                // obtain the full user data for this user
                UserData fullUserData = getFullUserData(userName, service, workspace);
                binder.m_environment.put("REMOTE_USER", userName);
                ServiceException error = null;
                try {
                     // init the service to not send HTML back
                     service.setSendFlags(true, true);
                     // create all the ServiceHandlers and implementors
                     // do a security check
                     // prepare for the service
                     // execute the service
                     // do any cleanup
                     // store any new personalization data
                } catch (ServiceException e) {
                     error = e;
                } finally {
                     // Remove all the temp files.
                // handle any error
                if (error != null) {
                     if (suppressServiceError) {
                          if (binder.getLocal("StatusCode") == null) {
                               binder.putLocal("StatusCode", String
                               binder.putLocal("StatusMessage", error.getMessage());
                     } else {
                          throw new ServiceException(error.m_errorCode, error

      Edited by: user4884609 on Nov 5, 2012 5:05 PM