SS_GET_SEARCH_RESULTS and GET_SEARCH_RESULTS

I have migrated my website from one content server to another. I have a fragment in my project which uses SS_GET_SEARCH_RESULTS servie to fect data. This worked fine on my content server where my website was perviously stored but, it does not run on my content server where I migrated my project to. Also, if I use GET_SEARCH_RESULTS in place of SS_GET_SEARCH_RESULTS in that fragment my query works fine and results are displayed.
What could be the root cause of this?
Or please give me pointers on how to debug it.

in your search result fragment what is the parameter for ssLimitScope?
Can you set this to false and execute your service.
Let me know what happens...
regards,
deepak

Similar Messages

  • How to get full url using UCM RIDC api

    Hi,
    I am using RIDC api to get the full url of the document (including protocol, host, port info). I tried using DOC_INFO
    and GET_SEARCH_RESULTS api. The GET_SEARCH_RESULTS api returns the path but no protocol, host, port info.
    DOC_INFO does not contain any uri. Is there a way to get full url? I only have access to the idc socket connection
    configuration to connect to the server.
    E.g. I know the idc connection url is idc://hostname:4444
    The user supplies document name as "myDoc.txt" and dId = 2000.
    I used GET_SEARCH_RESULTS for myDoc.txt and DOC_INFO for dId=2000.
    I need to return absolute url to the user that user can copy paste in the browser and download the doc.
    Thanks,
    --dhiraj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    You can ge the docUrl using doc info services DOC_INFO or DOC_INFO_BY_NAME.
    dataBinder.putLocal("IdcService", "DOC_INFO");
    dataBinder.putLocal("dID", docId);
    ServiceResponse response = idcClient.sendRequest (idcContext, dataBinder);
    DataBinder respBinder = response.getResponseAsBinder();
    System.out.println("DocUrl"+ respBinder.getLocal("DocUrl"));

  • Workflow, Folios and Document Update question?

    " Hi All,
    System Setup - Oracle UCM 10gR3, ORacle 11G DB using OracleText
    We are currently passing a folio through the workflow and want to be able to read the metadata of the content/docuemnt item stored in the folio.
    We can do this from iDoc from say another webform/webpage but when we do it in the workflow scripting interface we get an error as follows:
    Event generated by user 'Secretariat' at host 'appecmts01'. Error
    generated when executing query '((SDATA(sddDocName LIKE 'TEST'))) and
    ((((prj/%) WITHIN dDocAccount)))'. Unable to execute query
    'CotsSearchQuery'. ORA-20000: Oracle Text error:
    DRG-50857: oracle error in ctx_query.result_set
    ORA-20000: Oracle Text error:
    DRG-51030: wildcard query expansion resulted in too many terms
    ORA-06512: at "CTXSYS.DRUE", line 160
    ORA-06512: at "CTXSYS.CTX_QUERY", line 772
    ORA-06512: at "DB_ADMIN.CONTENT_SEARCH", line 116
    ORA-06512: at line 1
    What it is doing is automatically adding the "and
    ((((prj/%) WITHIN dDocAccount))" statment onto the search query, but only from the workflow iDoc script interface. Using the iDoc elsewhere works correctly.
    Is this standard behaviour? What can we do to resolve the issue barring disabling accounts?
    Script we are using in workflow
    <$getViewValuesResultSet("FolioContentId", "", "")$>
    <$count = 0$>
    <$numRows = 0$>
    <$loop SchemaData$>
    <$numRows = rsNumRows("SchemaData")$>
    <$if strEquals(getValue("SchemaData", "dCpdParentDocName"),"UP-003563")$>
    <$numRows = rsNumRows("SchemaData")$>
    <$test = getValue("SchemaData", "dDocName")$>
    <$QueryText = "dDocName<Matches>`test`"$>
    <$executeService("GET_SEARCH_RESULTS") $>
    <$if SearchResults$>
    <$loop SearchResults$>
    <$Poopie = "Vaylee"$>
    <$endloop$>
    <$wfMailSubject="Prop Owner - decision, namely <$dDocTitle$> (<$dDocName$>) FYI"$>
    <$wfMessage="Prop Owner - <$numRows$>........Folio id: <$dCpdParentDocName$>......Doc id: <$getValue('SchemaData', 'dDocName')$>..This is a computer generated e-mail to notify you that the Agenda has served on the Commitee Meeting on <strong><$Committee_Meeting_Date$></strong> and the final version of the Minutes of Meeting, namely <strong><$dDocTitle$> (<$dDocName$>) </strong> has been compiled and approved and is ready for distribution to the correct proposal owners / initiators <i>(click on the link below to view the Minutes of Meeting)</i>."$>
    <$wfNotify(Poopie, "user")$>
    <$endif$>
    <$count = count + 1$>
    <$endif$>
    <$endloop$>
    Thx
    Edited by: Stuart S on Jan 12, 2009 11:10 AM

    Hi
    I missed out to read that line in the problem that you had put across. I had come across a scenario like this and the reason and the workaround that i ffigured out was :
    Cause:
    This is caused by the 'ZonedSecurityFields' configuration entry not being set with the 'xClbraUserList' and 'xClbraAliasList ' options.
    Solution
    To implement the solution, please execute the following steps:
    1. On the Content Server's file system, navigate to <ContentServer>\config
    2. Make a backup copy of the 'config.cfg' file
    3. Open the 'config.cfg' file
    4. Under the "Additional Variables" section, place the following configuration entry:
    ZonedSecurityFields=xClbraUserList,xClbraAliasList
    5. Save the changes and close the file
    6. Restart the Content Server
    Let me know if this resolves the issue you are facing.
    Thanks
    Srinath

  • 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
              try{
              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);
              try
                   DataBinder serviceBinder = new DataBinder();
                   serviceBinder.putLocal("QueryText", "dOutDate > `<$dateCurrent()$>` <AND> dOutDate < `<$dateCurrent(30)$>`");
                   serviceBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
                        executeService(serviceBinder,"sysadmin",false);
                        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);
              System.out.println(cmd+".....serviceData-------------"+serviceData);
              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
              //if(service.getCachedObject("propFile")==null){
              UserData fullUserData = getFullUserData(userName, service, workspace);
              service.setUserData(fullUserData);
              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
                   service.initDelegatedObjects();
                   // do a security check
                   service.globalSecurityCheck();
                   // prepare for the service
                   service.preActions();
                   // execute the service
                   service.doActions();
                   // do any cleanup
                   service.postActions();
                   // store any new personalization data
                   service.updateSubjectInformation(true);
                   service.updateTopicInformation(binder);
              } catch (ServiceException e) {
                   error = e;
              } finally {
                   // Remove all the temp files.
                   service.cleanUp(true);
                   workspace.releaseConnection();
              // handle any error
              if (error != null) {
                   if (suppressServiceError) {
                        error.printStackTrace();
                        if (binder.getLocal("StatusCode") == null) {
                             binder.putLocal("StatusCode", String
                                       .valueOf(error.m_errorCode));
                             binder.putLocal("StatusMessage", error.getMessage());
                   } else {
                        throw new ServiceException(error.m_errorCode, error
                                  .getMessage());
    Edited by: user4884609 on Nov 5, 2012 5:05 PM

    The error you get tells you that the server cannot find the service GET_SEARCH_RESULTS.
    I checked the documentation (http://download.oracle.com/docs/cd/E17904_01/doc.1111/e11011/c05_core.htm#BABJBFFD) and this service is defined as a subservice - therefore, you might call it only within other service and (most likely) not directly from java.
    I guess that you use a filter because you use some standard hooks (like check-in ones). Therefore, you might not be able to call subservice prior to calling the filter. I'd suggest you to write what you are trying to achieve - it seems to me a bit strange that as a result of a filter you want to nothing else but fill-in a search result set.

  • Oracle UCM distinct values for attribute in GET_SEARCH_RESULTS ResultSet

    hi, can anyone, please, tell if there is a way to get a distinct values of resultset of GET_SEARCH_RESULTS?
    I mean, is it possible to obtain distinct values with custom where values of attribute through api?
    I need to build somewhat like autosuggest feature, but afaik there is no such service.
    Alternatives are
    - build my own service which can accept query text, pass it to GET_SEARCH_RESULTS, get results, calculate distinct and output it in hda - i dont like this idea, becouse it means getting whole result set into java while it is efficient to handle in DB
    - customize CHECK_IN/UPDATE services to update cached distincts (that means no grouping on custom queries)
    May be there was some sort of discussion or blog note?
    Thanks in advance.

    If you do not declare "SearchEngineName" as part of the request, whatever value is defined in config.cfg is used. This behavior is by design.
    Setting it in your request allows you to override the system setting in order to use another search engine, provided that the rest of the underlying parts are in place for the engine you are trying to use. For example, if your system setting is "DATABASE.METADATA", setting your individual request to "ORACLETEXTSEARCH" will probably fail, since the Oracle full text indexes would not exist. But if you are doing just metadata searching based on a couple of columns, and don't need the full text part for the request, it's a good way to craft a very specific search. Combined with a couple of database indexes on the columns in the where clause, it's also a good performer.
    I do "SearchEngineName=DATABASE" usually in conjunction with the parameter "SearchQueryFormat=Native" so I can create some database specific queries in native SQL (and thus avoiding the need to figure out the exact internet or universal syntax.) Your mileage may vary.

  • Is it possible to run an IdocScript Query with Service GET_SEARCH_RESULTS?

    Hi All,
    I need to run the below query with GET_SEARCH_RESULTS service.
    dDocType <matches> `ArchivePackage` <AND> xSubmissionDate < `10/08/13 11:03 AM`  <AND> xArchiveDocName <EQUALS> dDocName
    Part of this query works fine but when the part in BOLD is also used I get an error, reason being there is nothing like <EQUALS> when using QueryBuilder
    Instead is it possible to run the below idocscript with any service?
    <$ (dDocType like 'ArchivePackage') & xSubmissionDate < dateCurrent(-365) & (XArchiveDocname == dDocname) $>
    I tried it with GET_SEARCH_RESULTS, but got wrong results and no error.
    Is this even possible or should I just change my approach?
    Regards

    I tried to search more info on this one. It is true that in all cases the operator is followed by a constant - see e.g. https://blogs.oracle.com/interactions/entry/ucm_get_search_results_with_full_text_search
    Honestly, I see no reason why a reference to another metadata could not be made, but the parser might just fail on it. If you can, try to get an official answer from support via Metalink. Alternatively, you can decompile the code processing the service and check why parsing fails when non-constants are used.

  • 'contains' query  clause in GET_SEARCH_RESULTS

    Hi,
    I'm using UCM & Oracle DB 11g and I would like to do invoke GET_SEARCH_RESULT service with a query string like this; "dDocTitle <contains> `alle*`".
    If I run this query I obtainn the error:
    "Unable to find parsed elements with engine label 'DATABASE.METADATA.ORACLE', field name 'dDocTitle', operator name 'hasasword'."
    So I enabled the component: DBSearchContainsOpSupport
    But now, running the query, it produces a different error:
    Caused by: oracle.stellent.ridc.protocol.ServiceException: Unable to retrieve search results. Error occurred while processing. Unable to return results. Unable to create the result set for query 'SELECT Revisions.dID, dDocTitle, dDocType, dRevisionID, dSecurityGroup, dDocAuthor, dDocAccount, dRevLabel, dFormat, dOriginalName, dExtension, dWebExtension, dInDate, dOutDate, dCreateDate, dPublishType, dRendition1, dRendition2, dFileSize AS VaultFileSize, DocMeta.*, RevClasses.*
    FROM Revisions, DocMeta, Documents, RevClasses
    WHERE Revisions.dID=DocMeta.dID And Revisions.dID=Documents.dID And Revisions.dDocName = RevClasses.dDocName And dIsPrimary = 1 And dReleaseState IN ('Y', 'U', 'I') AND (((CONTAINS(dDocTitle, 'alle%')> 0 AND ( xCollectionID = 811441310542000029 OR xCollectionID = 811441310542000028 OR xCollectionID = 811441310542000036 OR xCollectionID = 811441310542000031 OR xCollectionID = 811441310542000032 OR xCollectionID = 811441310542002002 OR xCollectionID = 811441310542000033 OR xCollectionID = 811441310542002001 OR xCollectionID = 811441310542000034 OR xCollectionID = 811441310542000030 OR xCollectionID = 811441310542001602 OR xCollectionID = 811441310542001601 OR xCollectionID = 811441310542000005 OR xCollectionID = 811441310542000004 OR xCollectionID = 811441310542001603 OR xCollectionID = 811441310542002605 OR xCollectionID = 811441310542000403 OR xCollectionID = 811441310542000404 OR xCollectionID = 811441310542000602 OR xCollectionID = 811441310542000401 OR xCollectionID = 811441310542000601 OR xCollectionID = 811441310542000012 OR xCollectionID = 811441310542001409 OR xCollectionID = 811441310542000011 OR xCollectionID = 811441310542000010 OR xCollectionID = 811441310542001407 OR xCollectionID = 811441310542001408 OR xCollectionID = 811441310542000016 OR xCollectionID = 811441310542001405 OR xCollectionID = 811441310542000015 OR xCollectionID = 811441310542001406 OR xCollectionID = 811441310542000014 OR xCollectionID = 811441310542000801 OR xCollectionID = 811441310542001403 OR xCollectionID = 811441310542000013 OR xCollectionID = 811441310542001404 OR xCollectionID = 811441310542000008 OR xCollectionID = 811441310542001412 OR xCollectionID = 811441310542000009 OR xCollectionID = 811441310542001411 OR xCollectionID = 811441310542000006 OR xCollectionID = 811441310542001410 OR xCollectionID = 811441310542000007 OR xCollectionID = 811441310542002803 OR xCollectionID = 811441310542002802 OR xCollectionID = 811441310542002801 OR xCollectionID = 811441310542003802 OR xCollectionID = 811441310542003801 OR xCollectionID = 811441310542003803 OR xCollectionID = 811441310542002401 OR xCollectionID = 811441310542000021 OR xCollectionID = 811441310542000020 OR xCollectionID = 811441310542000023 OR xCollectionID = 811441310542000022 OR xCollectionID = 811441310542000025 OR xCollectionID = 811441310542000024 OR xCollectionID = 811441310542000027 OR xCollectionID = 811441310542000026 OR xCollectionID = 811441310542000017 OR xCollectionID = 811441310542000018 OR xCollectionID = 811441310542001402 OR xCollectionID = 811441310542000019 OR xCollectionID = 811441310542001401 OR xCollectionID = 811441310542003201 OR xCollectionID = 811441310542003202 OR xCollectionID = 811441310542002201 )))) ORDER BY dInDate DESC'. ORA-20000: Oracle Text error:
    DRG-10599: column is not indexed
    java.sql.SQLException: ORA-20000: Oracle Text error:
    DRG-10599: column is not indexed.
    How can I solve this error (DRG-10599: column is not indexed)?
    P.S.
    SearchEngineName used while calling GET_SEARCH_RESULT: "database"
    and in UCM config.cfg:
    SearchIndexerEngineName=OracleTextSearch
    The same query ("dDocTitle <contains> `alle*`") runs successfully if I use the UCM search interface.
    Any help will be greatly appreciated.
    Thank you very much,
    best regards,
    S.

    If you do not declare "SearchEngineName" as part of the request, whatever value is defined in config.cfg is used. This behavior is by design.
    Setting it in your request allows you to override the system setting in order to use another search engine, provided that the rest of the underlying parts are in place for the engine you are trying to use. For example, if your system setting is "DATABASE.METADATA", setting your individual request to "ORACLETEXTSEARCH" will probably fail, since the Oracle full text indexes would not exist. But if you are doing just metadata searching based on a couple of columns, and don't need the full text part for the request, it's a good way to craft a very specific search. Combined with a couple of database indexes on the columns in the where clause, it's also a good performer.
    I do "SearchEngineName=DATABASE" usually in conjunction with the parameter "SearchQueryFormat=Native" so I can create some database specific queries in native SQL (and thus avoiding the need to figure out the exact internet or universal syntax.) Your mileage may vary.

  • How to call GET_SEARCH_RESULTS from Filter Class

    Hi All,
    I want to call GET_SEARCH_RESULTS from Filter Class. How can we do? Any sample code.

    Hi Mohan,
    I am using "preComputeDocName"
    public int doFilter(Workspace ws, DataBinder binder, ExecutionContext cxt)
    throws DataException, ServiceException
      String dType=binder.getLocal(UCMConstants.dDocType);
      if(dType.equals("CIDTest"))
       if(binder.getLocal("IdcService").equals("CHECKIN_NEW"))
        String filename=binder.getLocal(UCMConstants.primaryFile);
        originalFileName=filename.substring(filename.lastIndexOf("\\")+1);
        SystemUtils.trace(trace_checkin, "org::"+originalFileName);
        DataBinder newDB = ucmUtils.getNewBinder(binder);
        newDB.putLocal("IdcService", "GET_SEARCH_RESULTS");
        newDB.putLocal("QueryText","dDocType <starts> `"+dType+"` <AND> xcidfilename <starts> `"+originalFileName+"`");
        ucmUtils.executeService(ws, newDB, true);
        DataResultSet docInfoDrs = null;
        docInfoDrs = (DataResultSet) newDB.getResultSet("SearchResults");
        if(docInfoDrs.getNumRows()!=0){
         throw new ServiceException("file is not unique");
        binder.putLocal("xcidfilename", originalFileName);
        return CONTINUE;
    return CONTINUE;

  • Execute GET_SEARCH_RESULTS service in doFilter method

    Hi everybody,
    I would like to copy "template file" into primaryFile by CHECKIN. The "template file" is saved in the UCM. I use custom component and now i run "doFilter" method.
    First step in doFilter method is GET_SEARCH_RESULTS service.
    I found this example:
    DataBinder serviceBinder = idcClient.createBinder();
    binder.putLocal ("IdcService", "GET_SEARCH_RESULTS");
    binder.putLocal("QueryText","myquery");
    ServiceResponse response = idcClient.sendRequest (userContext, binder);
    DataBinder serverBinder = response.getResponseAsBinder ();
    binder = response.getResponseAsBinder ();
    DataResultSet resultSet = binder.getResultSet ("SearchResults");
    // loop over the results
    for (DataObject dataObject : resultSet.getRows ())
    System.out.println ("Title is: " + dataObject.get ("dDocTitle"));
    BUT:
    - What is the object "idcClient"?
    - How can i create the object? import........ what
    Thank you
    Martin

    The error you get tells you that the server cannot find the service GET_SEARCH_RESULTS.
    I checked the documentation (http://download.oracle.com/docs/cd/E17904_01/doc.1111/e11011/c05_core.htm#BABJBFFD) and this service is defined as a subservice - therefore, you might call it only within other service and (most likely) not directly from java.
    I guess that you use a filter because you use some standard hooks (like check-in ones). Therefore, you might not be able to call subservice prior to calling the filter. I'd suggest you to write what you are trying to achieve - it seems to me a bit strange that as a result of a filter you want to nothing else but fill-in a search result set.

  • Component name of SS_GET_SEARCH_RESULTS

    Hi All
    Please let me know in UCM on which component "SS_GET_SEARCH_RESULTS" service belongs to.
    With thanks and regards
    Anoop

    Hi
    This will be part of the any search fragment that is there by default on SS . This is the core search service of Site Studio .
    Thanks
    Srinath

  • Execute GET_SEARCH_RESULTS by Java class

    I'm developing a UCM component and I have to perform a search by my java classes to built the service answer. I write this pice of code but the resultSet is always empty.
    this.m_binder.putLocal("QueryText","xProfileTrigger <matches> `INVOICE` <AND> xIvoiceCode <matches> `"+code+"`");
    this.executeServiceEx("GET_SEARCH_RESULTS", true);
    result = this.m_binder.getResultSet("SearchResults");
    if (!result.isRowPresent()){
                   //Always there
    } else {
              //if I perform this instruction i will get an exception
              result.getStringValue(ResultSetUtils.getIndexMustExist(esitoRicerca,"dID"));
    thanks Maurizio

    Hello. I have tried the option#3. It works but I am getting 1514 results where as when I execute the query from the browser in UCM in soap format I got 1515 results. I posting the code.
         int resultCount = 100;
         List<DataObject> dataObjects = new ArrayList<DataObject>();
         IdcClientManager manager = new IdcClientManager();
         IdcClient idcClient = manager.createClient("idc://"+ip+":"+port);
         IdcContext userContext = new IdcContext(username);
         String queryText = "(dDocName <substring> `%` <OR> dDocTitle <substring> `%`) <AND> (xDAMBrand <starts> `WF/008/DAM`)";
         DataBinder binder = idcClient.createBinder();
         binder.putLocal ("IdcService", "GET_SEARCH_RESULTS");
         binder.putLocal("QueryText", queryText);
         binder.putLocal("ResultCount", Integer.toString(resultCount));
         binder.putLocal("PageNumber", "1");     
         binder.putLocal("StartRow", "1");
         ServiceResponse response = idcClient.sendRequest (userContext, binder);
         DataBinder responseBinder = response.getResponseAsBinder();
         DataResultSet resultSet = responseBinder.getResultSet("SearchResults");
         System.out.println(responseBinder.getLocal("StartRow"));
         dataObjects.addAll(resultSet.getRows());
         int totalRows = Integer.parseInt(responseBinder.getLocal("TotalRows"));
         int pageNumber = (totalRows % resultCount == 0) ? (totalRows / resultCount) : (totalRows / resultCount) + 1;
         int i = 2;
         try {
              if(totalRows > resultCount) {
                   int startRow = 1;
                   while(i <= pageNumber) {     
                        startRow += resultCount;
                        if(i == pageNumber) {
                             resultCount = totalRows - startRow;                              
                        binder = idcClient.createBinder();
                        binder.putLocal ("IdcService", "GET_SEARCH_RESULTS");
                        binder.putLocal("QueryText", queryText);
                        binder.putLocal("ResultCount", Integer.toString(resultCount));
                        binder.putLocal("PageNumber", Integer.toString(i));
                        binder.putLocal("StartRow", Integer.toString(startRow));
                        response = idcClient.sendRequest (userContext, binder);
                        responseBinder = response.getResponseAsBinder();
                        resultSet = responseBinder.getResultSet("SearchResults");
                        dataObjects.addAll(resultSet.getRows());
                        i++;     
                        System.out.println(responseBinder.getLocal("StartRow"));
         }catch (Exception e) {
              e.printStackTrace();
         System.out.println(dataObjects.size());I don't understand what I am doing wrong. If the total result is 1515 and result count is 100 then I have 16 pages. In the following code block
         if(i == pageNumber) {
              resultCount = totalRows - startRow;                              
         }The resultCount = 14 and startRow = 1501. I f I made the resultCount 15 I am getting exception also if remove this code block I also got exception:
    oracle.stellent.ridc.protocol.ServiceException: !csCollectionUnableToLoad,851438161954000794
    1500
         at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:142)
         at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:108)
         at Controller.main(Controller.java:63)Can you help me to solve this problem please or show me the code that you have developed?
    Thanks in advance.
    Tapas.

  • A problem with Threads and loops.

    Hi, I have some code that needs to be constantly running, like while(true)
          //code here
    }However, the code just checks to see if the user has input anything (and then if the user has, it goes to do some other stuff) so I don't need it constantly running and hogging up 98% of the CPU. So I made my class (which has the method that needs to be looped, call it ClassA) implement Runnable. Then I just added the method which needed to be looped into the public void run()
    I have another class which creates an instance of the above class (call it ClassB), and the main(String[] args) is in there.
    public static void main(String[] args)
              ClassA test = new ClassA();
              Thread thread = new Thread(test.getInstanceOfClassA());
              thread.start();
              while(true)
                           //I do not know what to put here
                   try
                        thread.sleep(100);
                   catch(InterruptedException iex)
         }However, the thread only calls run() once,(duh...) but I can't think of away to get it to run - sleep - run -sleep forever. Can someone help me?

    Hi, I have some code that needs to be constantly
    running, like while(true)
    //code here
    }However, the code just checks to see if the user has
    input anything (and then if the user has, it goes to
    do some other stuff) so I don't need it constantly
    running and hogging up 98% of the CPU. Where does the user input come from. Are you reading from an InputStream? If so, then your loop will be blocked anyway when reading from the InputStream until data is available. During that time, the loop will not consume processor cycles.
    public static void main(String[] args)
              ClassA test = new ClassA();
    Thread thread = new Thread(test.getInstanceOfClassA());I have never seen this idiom. If ClassA instanceof Runnable, you simply write new Thread(test).
              thread.start();
              while(true)
    //I do not know what to put
    do not know what to put here
                   try
                        thread.sleep(100);
                   catch(InterruptedException iex)
         }However, the thread only calls run() once,(duh...)Yeah, why would you want to call it more than once given that you have an infinite loop in ClassA.run()?
    Harald.
    Java Text Crunching: http://www.ebi.ac.uk/Rebholz-srv/whatizit/software

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • Problem with Threads and "plase wait..."-Window

    Hi everyone,
    I have a problem that I'm not able to solve in any way... I have a time-consuming task (a file decryption) which I execute in a separate thread; I've used the SwingWorker class, like suggested by sun-tutorial, and it works right. The problem is that I have to wait that the decryption have finished before continuing with program-execution. Therefore I would like to display a "please wait"-window while the task runs. I've tryed all the possible ways I know but the problem is always the same: the waitWindow is displayed empty, the bounds are painted but the contents no; it's only painted when the decrypt-task has finished. Please help me, I have no more resources....
    decrypt-file code:
    public class DecryptFile {
      private String cryptedFileNameAndPath;
      private ByteArrayInputStream resultStream = null;
      // need for progress
      private int lengthOfTask;
      private int current = -1;
      private String statMessage;
      public DecryptFile(String encZipFileNameAndPath) {
        cryptedFileNameAndPath = encZipFileNameAndPath;
        //Compute length of task...
        // 0 for indeterminate
        lengthOfTask = 0;
      public ByteArrayInputStream getDecryptedInputStream() {
        return this.resultStream;
       * Called from ProgressBarDemo to start the task.
      public void go() {
        current = -1;
        final SwingWorker worker = new SwingWorker() {
          public Object construct() {
            return new ActualTask();
        worker.start();
       * Called from ProgressBarDemo to find out how much work needs
       * to be done.
      public int getLengthOfTask() {
        return lengthOfTask;
       * Called from ProgressBarDemo to find out how much has been done.
      public int getCurrent() {
        return current;
      public void stop() {
        current = lengthOfTask;
       * Called from ProgressBarDemo to find out if the task has completed.
      public boolean done() {
        if (current >= lengthOfTask)
          return true;
        else
          return false;
      public String getMessage() {
        return statMessage;
       * The actual long running task.  This runs in a SwingWorker thread.
      class ActualTask {
        ActualTask () {
          current = -1;
          statMessage = "";
          resultStream = AIUtil.getInputStreamFromEncZip(cryptedFileNameAndPath); //here the decryption happens
          current = 0;
          statMessage = "";
      }The code that calls decryption and displays waitWindow
          final WaitSplash wS = new WaitSplash("Please wait...");
          final DecryptFile cryptedTemplate = new DecryptFile (this.templateFile);
          cryptedTemplate.go();
          while (! cryptedTemplate.done()) {
            try {
              wait();
            } catch (Exception e) { }
          this.templateInputStream = cryptedTemplate.getDecryptedInputStream();
          wS.close();Thanks, thanks, thanks in advance!
    Edoardo

    Maybe you can try setting the priority of the long-running thread to be lower? so that the UI will be more responsive...

Maybe you are looking for

  • After latest Photoshop CC update, I can no longer edit a raw file in Lightroom 4 as a smart object

    I updated PS this morning, since then I am no longer able to edit a file in LIghtroom 4 as a smart object in Photoshop CC. Photoshop will open, but after some time passes, Lightroom 4 gives an error that Photoshop cannot be launched. If I choose "edi

  • What exactly is using data and how can i keep it from using data when im not using my phone?

    So i have an iphone 4 and i have used a lot of data this month(like almost 2GB) and i have barely touched my phone outside of wifi areas. I always shut down any apps that use data like youtube, funnypics, facebook, etc. but i do play some games durin

  • Solution to missing MPEG2 Playback component FOUND!

    This solution is for those that have purchased Final Cut Studio HD, and then found the MPEG2 playback component mysteriously missing. Well, from digging and digging around I found my answer. Check for the existence of /System/Library/QuickTime/QuickT

  • Adobe reader x and Autodesk Architecture

    I have installed Adobe Reader x on my computer. When I make a pdf in Architecture, it allows me to do it but then I get an error message that says that I haven't installed a pdf reader on my computer and can't view it, even though it has saved the fi

  • Sap Hana

    Hi    my name is shahzaman i would like to start my career  in sap hana  can any one help me what is best way to start .  thanks Hi shahzaman, please use the appropriate space for questions around career and development, e.g. Career Center. Cheers, L