public void handle(XInteractionRequest xInteractionRequest) {
      log.println("### _XCompletedExecution.InteractionHandlerImpl: handle called.");
      handlerWasUsed = true;

      Object o = xInteractionRequest.getRequest();
      ParametersRequest req = (ParametersRequest) o;
      XIndexAccess params = req.Parameters;
      int count = params.getCount();
      try {
        for (int i = 0; i < count; i++) {
          params.getByIndex(i);
          log.println(
              "### _XCompletedExecution.InteractionHandlerImpl: Parameter "
                  + i
                  + ": "
                  + params.getByIndex(i));
          XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(i));
          log.println(
              "### _XCompletedExecution.InteractionHandlerImpl: Parameter Name: '"
                  + xProp.getPropertyValue("Name")
                  + "' is set to Value '1'");
          xProp.setPropertyValue("Value", new Integer(1));
          handlerWasUsed = true;
        }
      } catch (Exception eI) {
        log.println("### _XCompletedExecution.InteractionHandlerImpl: Exception!");
        eI.printStackTrace(log);
      }
    }
Example #2
0
    public void handle(XInteractionRequest xInteractionRequest) {
      log.println("### _XCompletedExecution.InteractionHandlerImpl: handle called.");
      boolean abort = false;

      Object o = xInteractionRequest.getRequest();
      if (o instanceof ParametersRequest) {
      } else if (o instanceof AuthenticationRequest) {
        log.println("### The request in XCompletedExecution is of type 'AuthenticationRequest'");
        log.println("### This is not implemented in ORowSet.InteractionHandlerImpl test -> abort.");
        abort = true;
      } else {
        log.println("### Unknown request:" + o.toString());
        log.println("### This is not implemented in ORowSet.InteractionHandlerImpl test -> abort.");
        abort = true;
      }

      XInteractionContinuation[] xCont = xInteractionRequest.getContinuations();
      XInteractionSupplyParameters xParamCallback = null;
      for (int i = 0; i < xCont.length; i++) {
        if (abort) {
          XInteractionAbort xAbort = null;
          xAbort = UnoRuntime.queryInterface(XInteractionAbort.class, xCont[i]);
          if (xAbort != null) xAbort.select();
          return;
        } else {
          xParamCallback = UnoRuntime.queryInterface(XInteractionSupplyParameters.class, xCont[i]);
          if (xParamCallback != null) break;
        }
      }
      if (xParamCallback != null) {
        log.println("### _XCompletedExecution.InteractionHandlerImpl: supplying parameters.");
        handlerWasUsed = true;
        PropertyValue[] prop = new PropertyValue[1];
        prop[0] = new PropertyValue();
        prop[0].Name = "param1";
        prop[0].Value = "Hi.";

        xParamCallback.setParameters(prop);
        xParamCallback.select();
      } else { // we should never reach this: abort has to be true first.
        log.println(
            "### _XCompletedExecution.InteractionHandlerImpl: Got no "
                + "'XInteractionSupplyParameters' and no 'XInteractionAbort'.");
      }
    }