Examples of UpdateResponse


Examples of org.apache.solr.client.solrj.response.UpdateResponse

      {
        try
        {
          // Do the operation!
          UpdateRequest updateRequest = new UpdateRequest(postUpdateAction + "?commit=true");
          UpdateResponse response = updateRequest.process(solrServer);
          //UpdateResponse response = solrServer.commit();
        }
        catch (InterruptedIOException ioe)
        {
          return;
View Full Code Here

Examples of org.apache.solr.client.solrj.response.UpdateResponse

          // Note: I need to know whether the document has been permanently rejected or not, but we currently have
          // no means to determine that.  Analysis of SolrServerExceptions that have been thrown is likely needed.
          try
          {
            readFromDocumentStreamYet = true;
            UpdateResponse response;
            if ( useExtractUpdateHandler )
            {
              response = contentStreamUpdateRequest.process( solrServer );
            }
            else
View Full Code Here

Examples of org.apache.solr.client.solrj.response.UpdateResponse

        // Do the operation!
        long fullStartTime = System.currentTimeMillis();
        // Open a socket to ingest, and to the response stream to get the post result
        try
        {
          UpdateResponse response = new UpdateRequest(postRemoveAction).deleteById(documentURI).process(solrServer);
           
          // Success
          activityStart = new Long(fullStartTime);
          activityCode = "OK";
          activityDetails = null;
View Full Code Here

Examples of org.apache.solr.client.solrj.response.UpdateResponse

      {
        try
        {
          // Do the operation!
          UpdateRequest updateRequest = new UpdateRequest(postUpdateAction + "?commit=true");
          UpdateResponse response = updateRequest.process(solrServer);
          //UpdateResponse response = solrServer.commit();
        }
        catch (InterruptedIOException ioe)
        {
          return;
View Full Code Here

Examples of org.apache.solr.client.solrj.response.UpdateResponse

    doc.addField( "name", "my name!", 1.0f );
   
    Assert.assertEquals( null, doc.getField("foo") );
    Assert.assertTrue(doc.getField("name").getValue() != null );
       
    UpdateResponse upres = server.add( doc );
    System.out.println( "ADD:"+upres.getResponse() );
    Assert.assertEquals(0, upres.getStatus());
   
    upres = server.commit( true, true );
    System.out.println( "COMMIT:"+upres.getResponse() );
    Assert.assertEquals(0, upres.getStatus());
   
    upres = server.optimize( true, true );
    System.out.println( "OPTIMIZE:"+upres.getResponse() );
    Assert.assertEquals(0, upres.getStatus());
   
    SolrQuery query = new SolrQuery();
    query.setQuery( "id:"+docID );
    QueryResponse response = server.query( query );
   
    Assert.assertEquals(docID, response.getResults().get(0).getFieldValue("id") );
   
    // Now add a few docs for facet testing...
    List<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
    SolrInputDocument doc2 = new SolrInputDocument();
    doc2.addField( "id", "2", 1.0f );
    doc2.addField( "inStock", true, 1.0f );
    doc2.addField( "price", 2, 1.0f );
    doc2.addField( "timestamp_dt", new java.util.Date(), 1.0f );
    docs.add(doc2);
    SolrInputDocument doc3 = new SolrInputDocument();
    doc3.addField( "id", "3", 1.0f );
    doc3.addField( "inStock", false, 1.0f );
    doc3.addField( "price", 3, 1.0f );
    doc3.addField( "timestamp_dt", new java.util.Date(), 1.0f );
    docs.add(doc3);
    SolrInputDocument doc4 = new SolrInputDocument();
    doc4.addField( "id", "4", 1.0f );
    doc4.addField( "inStock", true, 1.0f );
    doc4.addField( "price", 4, 1.0f );
    doc4.addField( "timestamp_dt", new java.util.Date(), 1.0f );
    docs.add(doc4);
    SolrInputDocument doc5 = new SolrInputDocument();
    doc5.addField( "id", "5", 1.0f );
    doc5.addField( "inStock", false, 1.0f );
    doc5.addField( "price", 5, 1.0f );
    doc5.addField( "timestamp_dt", new java.util.Date(), 1.0f );
    docs.add(doc5);
   
    upres = server.add( docs );
    System.out.println( "ADD:"+upres.getResponse() );
    Assert.assertEquals(0, upres.getStatus());
   
    upres = server.commit( true, true );
    System.out.println( "COMMIT:"+upres.getResponse() );
    Assert.assertEquals(0, upres.getStatus());
   
    upres = server.optimize( true, true );
    System.out.println( "OPTIMIZE:"+upres.getResponse() );
    Assert.assertEquals(0, upres.getStatus());
   
    query = new SolrQuery("*:*");
    query.addFacetQuery("price:[* TO 2]");
    query.addFacetQuery("price:[2 TO 4]");
    query.addFacetQuery("price:[5 TO *]");
 
View Full Code Here

Examples of org.elasticsearch.action.update.UpdateResponse

    @BenchmarkOptions(benchmarkRounds = BENCHMARK_ROUNDS, warmupRounds = 1)
    @Test
    public void testUpdateApiById() {
        for (int i=0; i<NUM_REQUESTS_PER_TEST; i++) {
            UpdateResponse response = getClient(false).execute(UpdateAction.INSTANCE, getApiUpdateByIdRequest(false)).actionGet();
            assertEquals(updateId, response.getId());
        }
    }
View Full Code Here

Examples of org.oasis.wsrp.v1.UpdateResponse

   {
      BlockingInteractionResponse blockingInteractionResponse = (BlockingInteractionResponse)response;
      log.debug("Starting processing response");

      String redirectURL = blockingInteractionResponse.getRedirectURL();
      UpdateResponse updateResponse = blockingInteractionResponse.getUpdateResponse();
      if (redirectURL != null && updateResponse != null)
      {
         return new ErrorResponse(new IllegalArgumentException("Response cannot both redirect and update state."));
      }

      if (redirectURL != null)
      {
         return new HTTPRedirectionResponse(redirectURL); // do we need to process URLs?
      }
      else
      {
         // updateResponse.getMarkupContext(); // ignore bundled markup for now.

         UpdateNavigationalStateResponse result = new UpdateNavigationalStateResponse();
         // new mode
         String newMode = updateResponse.getNewMode();
         if (newMode != null)
         {
            result.setMode(WSRPUtils.getJSR168PortletModeFromWSRPName(newMode));
         }
         // new window state
         String newWindowState = updateResponse.getNewWindowState();
         if (newWindowState != null)
         {
            result.setWindowState(WSRPUtils.getJSR168WindowStateFromWSRPName(newWindowState));
         }
         // navigational state
         String navigationalState = updateResponse.getNavigationalState();
         if (navigationalState != null)
         {
            result.setNavigationalState(new OpaqueStateString(navigationalState));
         }

         // check if the portlet was cloned
         PortletContext portletContext = updateResponse.getPortletContext();
         if (portletContext != null)
         {
            PortletContext originalContext = requestPrecursor.getPortletContext();
            InstanceContext context = invocation.getInstanceContext();

            String handle = portletContext.getPortletHandle();
            if (!originalContext.getPortletHandle().equals(handle))
            {
               log.debug("Portlet '" + requestPrecursor.getPortletHandle() + "' was implicitely cloned. New handle is '"
                  + handle + "'");
               StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_CLONED_EVENT);
               context.onStateEvent(event);
            }
            else
            {
               // check if the state was modified
               byte[] originalState = originalContext.getPortletState();
               byte[] newState = portletContext.getPortletState();
               if (!Arrays.equals(originalState, newState))
               {
                  StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_MODIFIED_EVENT);
                  context.onStateEvent(event);
               }
            }

            // update the session information associated with the portlet handle
            consumer.getSessionHandler().updateSessionInfoFor(originalContext.getPortletHandle(), handle, invocation);
         }
         else
         {
            portletContext = requestPrecursor.getPortletContext();
         }

         // update the session info, using either the original or cloned portlet context, as appropriate
         consumer.getSessionHandler().updateSessionIfNeeded(updateResponse.getSessionContext(), invocation,
            portletContext.getPortletHandle());

         log.debug("Response processed");
         return result;
      }
View Full Code Here

Examples of org.oasis.wsrp.v2.UpdateResponse

      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse unsResponse = (UpdateNavigationalStateResponse)response;
         HandleEventsResponse eventsResponse = WSRPTypeFactory.createHandleEventsReponse();

         UpdateResponse updateResponse = createUpdateResponse(unsResponse);
         eventsResponse.setUpdateResponse(updateResponse);

         return eventsResponse;
      }
      else
View Full Code Here

Examples of org.oasis.wsrp.v2.UpdateResponse

      return state != null ? state.toString() : null;
   }

   protected UpdateResponse createUpdateResponse(UpdateNavigationalStateResponse stateResponse)
   {
      UpdateResponse updateResponse = WSRPTypeFactory.createUpdateResponse();
      updateResponse.setNewMode(WSRPUtils.convertJSR168PortletModeNameToWSRPName(getNewStateOrNull(stateResponse, true)));
      updateResponse.setNewWindowState(WSRPUtils.convertJSR168WindowStateNameToWSRPName(getNewStateOrNull(stateResponse, false)));
      NavigationalContext navigationalContext = WSRPTypeFactory.createNavigationalContextOrNull(
         stateResponse.getNavigationalState(),
         stateResponse.getPublicNavigationalStateUpdates()
      );
      updateResponse.setNavigationalContext(navigationalContext);

      // events
      List<UpdateNavigationalStateResponse.Event> events = stateResponse.getEvents();
      if (ParameterValidation.existsAndIsNotEmpty(events))
      {
         for (UpdateNavigationalStateResponse.Event event : events)
         {
            updateResponse.getEvents().add(WSRPTypeFactory.createEvent(event.getName(), event.getPayload()));
         }
      }

      // deal with implicit cloning and state modification
      if (instanceContext.wasModified())
      {
         PortletContext updatedPortletContext = WSRPUtils.convertToWSRPPortletContext(instanceContext.getPortletContext());
         updateResponse.setPortletContext(updatedPortletContext);
      }
      return updateResponse;
   }
View Full Code Here

Examples of org.oasis.wsrp.v2.UpdateResponse

   protected BlockingInteractionResponse internalProcessResponse(PortletInvocationResponse response)
   {
      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse stateResponse = (UpdateNavigationalStateResponse)response;
         UpdateResponse updateResponse = createUpdateResponse(stateResponse);

         return WSRPTypeFactory.createBlockingInteractionResponse(updateResponse);
      }
      else
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.