JBoss Community

Re: How get completed/release time for a task?

created by José Luis Granda in jBPM - View the full discussion

Thanks Nick for the idea, I will try it.

 

About retrieve content data, you can use JBPM BlockingGetContentResponseHandler pass contentId, that is useful for retrieve  any content in the task. Then you can cast the byte array to object and cast to map for explore variables by one by.

 

protected Content getTaskContent(Long contentId) {

        BlockingGetContentResponseHandler responseHandler = new BlockingGetContentResponseHandler();

        client.getContent(contentId, responseHandler);

        return responseHandler.getContent();

    }

 

    protected Object getTaskContentAsObject(Long contentId) {

        Object objectReturn = null;

        byte[] buf = getTaskContent(contentId).getContent();

        // Do something with the data read here

        ByteArrayInputStream bais = new ByteArrayInputStream(buf);

        try {

            ObjectInputStream is = new ObjectInputStream(bais);

 

            boolean okRead = false;

            // Map map = new LinkedHashMap<String, Object>();

            while (!okRead && (objectReturn = is.readObject()) != null) {

                okRead = true;

                System.out.println("getTaskContentAsObject object: "

                        + objectReturn);

            }

 

        } catch (Exception e) {

            System.err

                    .print("There was an error reading content task input...");

            e.printStackTrace();

        }

 

        return objectReturn;

    }

Reply to this message by going to Community

Start a new discussion in jBPM at Community