Examples of BoxEventCollection


Examples of com.box.boxjavalibv2.dao.BoxEventCollection

    @Test
    public void testGetEvents() throws Exception {
        // using com.box.boxjavalibv2.requests.requestobjects.BoxEventRequestObject message body for single parameter "eventRequest"
        final BoxEventRequestObject requestObject =
                BoxEventRequestObject.getEventsRequestObject(BoxEventRequestObject.STREAM_POSITION_NOW);
        BoxEventCollection result = requestBody("direct://GETEVENTS", requestObject);

        assertNotNull("getEvents result", result);
        LOG.debug("getEvents: " + result);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxEventCollection

                                    // get events
                                    final BoxEventRequestObject requestObject =
                                        BoxEventRequestObject.getEventsRequestObject(currentStreamPosition);
                                    requestObject.setStreamType(streamType);
                                    requestObject.setLimit(limit);
                                    final BoxEventCollection events = eventsManager.getEvents(requestObject);

                                    // notify callback
                                    callback.onEvent(events);

                                    // update stream position
                                    currentStreamPosition = events.getNextStreamPosition();

                                } else if (RECONNECT.equals(message) || MAX_RETRIES.equals(message)) {
                                    LOG.debug("Long poll reconnect for " + cachedBoxClient);
                                    realTimeServer = null;
                                } else if (OUT_OF_DATE.equals(message)) {
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxEventCollection

    private long getCurrentStreamPosition(IBoxEventsManager eventsManager, long streamPosition)
        throws BoxRestException, BoxServerException, AuthFatalFailureException {

        final BoxEventRequestObject requestObject =
            BoxEventRequestObject.getEventsRequestObject(streamPosition);
        final BoxEventCollection events = eventsManager.getEvents(requestObject);
        streamPosition = events.getNextStreamPosition();
        return streamPosition;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxEventCollection

    }

    @Override
    public Object splitResult(Object result) {
        if (result instanceof BoxEventCollection && splitResult) {
            BoxEventCollection eventCollection = (BoxEventCollection) result;
            final ArrayList<BoxTypedObject> entries = eventCollection.getEntries();
            return entries.toArray(new BoxTypedObject[entries.size()]);
        }
        return result;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxEventCollection

    }

    @Override
    public void interceptResult(Object result, Exchange resultExchange) {
        if (result instanceof BoxEventCollection) {
            BoxEventCollection boxEventCollection = (BoxEventCollection) result;
            resultExchange.getIn().setHeader(BoxConstants.CHUNK_SIZE_PROPERTY,
                boxEventCollection.getChunkSize());
            resultExchange.getIn().setHeader(BoxConstants.NEXT_STREAM_POSITION_PROPERTY,
                boxEventCollection.getNextStreamPosition());
        }
    }
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.