1 Reply Latest reply on May 18, 2016 10:01 AM by Rodrigo Sepulveda

    How to create custom remote commands

    giovanni galantucci Newbie

      Hi all,

      we use BPM for our business processes.

      We communicate with BPM via remote REST API.

       

      We were wondering if we could create custom Remote Commands to execute on the remote Task Service.

       

      We just need a custom Command, similar to the GetTaskAssignedAsPotentialOwnerCommand, but with a few other search filters:

      - pagination

      - max result per page

      - order by

       

      Anyone knows if this is possible?

       

      Thank you,

      Gianluca

        • 1. Re: How to create custom remote commands
          Rodrigo Sepulveda Newbie

          Hola, este ejemplo realiza una busqueda con paginación y tal vez se pueda ordenar con el método queryFilter.setOrderBy(1);

           

          /**
          * Obtiene las tareas potenciales del usuario en forma paginada y filtradas
          * por los criterios de busqueda indicados como parámetro.
          */
          @Override
          public TareasUsuarioResponse getTaskAssignedAsPotentialOwnerPaged(
          TareasPaginadasRequest tareasPaginadasRequest) throws Exception {

           

           

          TareasUsuarioResponse response = new TareasUsuarioResponse();

           

           

          try {

           

           

          ConexionBpms conexionBpms = SingletonBpmsConection.getInstance()
          .getCliente(tareasPaginadasRequest.getUsuario(),
          tareasPaginadasRequest.getPassword());

           

           

          GetTaskAssignedAsPotentialOwnerCommand command = new GetTaskAssignedAsPotentialOwnerCommand();

           

           

          QueryFilter queryFilter = new QueryFilter();
          //queryFilter.setOrderBy(1);
          queryFilter.setOffset(tareasPaginadasRequest.getPage());

           

           

          queryFilter.setCount(tareasPaginadasRequest.getPageSize());

           

           

          StringKeyObjectValueMap params = new StringKeyObjectValueMap();

           

           

          params.put("taskOwner", tareasPaginadasRequest.getUsuario());

           

           

          params.putAll(tareasPaginadasRequest.getFiltros());

           

           

          LOGGER.info("Sea agrego el filtro.......................................................... <<<<<");

           

           

          queryFilter.setParams(params);

           

           

          queryFilter.setAscending(true);

           

           

          command.setFilter(queryFilter);

           

           

          command.setUserId(tareasPaginadasRequest.getUsuario());

           

           

          List<TaskSummary> listaTaskSumary = (List<TaskSummary>) conexionBpms
          .getKsession().execute(command);

           

           

          response.setTaskList(this.convertirListaTaskVO(listaTaskSumary));

           

           

          } catch (BPMSConfigurationPropertyNotFound | MalformedURLException error) {

           

           

          response.setError("Error. " + error.getMessage());

           

           

          LOGGER.error(response.getError());

           

           

          }

           

           

          return response;

           

           

          }