Search in sources :

Example 1 with ActivitiesEngine

use of com.vodafone360.people.engine.activities.ActivitiesEngine in project 360-Engine-for-Android by 360.

the class ActivitiesEngine method processCommsResponse.

/**
 * Handle response received from transport layer (via EngineManager)
 *
 * @param resp Received Response item either a Status/Timeline related push
 *            message or a response to a get activities request.
 */
@Override
protected void processCommsResponse(DecodedResponse resp) {
    LogUtils.logD("ActivitiesEngine processCommsResponse");
    // handle push response
    if (resp.mReqId == 0 && resp.mDataTypes.size() > 0) {
        PushEvent evt = (PushEvent) resp.mDataTypes.get(0);
        handlePushRequest(evt.mMessageType);
    } else {
        dequeueRequest(resp.mReqId);
        handleGetActivitiesResponse(resp.mDataTypes);
    }
}
Also used : PushEvent(com.vodafone360.people.datatypes.PushEvent)

Example 2 with ActivitiesEngine

use of com.vodafone360.people.engine.activities.ActivitiesEngine in project 360-Engine-for-Android by 360.

the class ActivitiesEngineTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
    mApplication.onCreate();
    // EngineManager.createEngineManager(getInstrumentation().getTargetContext(),
    // null);
    mEngineTester = new EngineTestFramework(this);
    mEng = new ActivitiesEngine(getInstrumentation().getTargetContext(), mEngineTester, mApplication.getDatabase());
    mEngineTester.setEngine(mEng);
    mState = ActivityTestState.IDLE;
}
Also used : ActivitiesEngine(com.vodafone360.people.engine.activities.ActivitiesEngine)

Example 3 with ActivitiesEngine

use of com.vodafone360.people.engine.activities.ActivitiesEngine in project 360-Engine-for-Android by 360.

the class EngineManager method createActivitiesEngine.

/**
 * Create instance of ActivitiesEngine.
 */
private synchronized void createActivitiesEngine() {
    final MainApplication app = (MainApplication) mService.getApplication();
    mActivitiesEngine = new ActivitiesEngine(mService, mUiEventCallback, app.getDatabase());
    getLoginEngine().addListener(mActivitiesEngine);
    addEngine(mActivitiesEngine);
}
Also used : ActivitiesEngine(com.vodafone360.people.engine.activities.ActivitiesEngine) MainApplication(com.vodafone360.people.MainApplication)

Example 4 with ActivitiesEngine

use of com.vodafone360.people.engine.activities.ActivitiesEngine in project 360-Engine-for-Android by 360.

the class Activities method getActivities.

/**
 * Implementation of People getactvities API. The required parameters are;
 * [auth], List<Long> activityidlist [opt], Map<String, List<String>>
 * filterlist [opt]
 *
 * @param engine Handle to ActivitiesEngine which handles requests using
 *            this API.
 * @param activityidlist List of Activity IDs to retrieve
 * @param filterlist List of filters to filter Activities request against.
 * @return Request ID generated for this request.
 */
public static int getActivities(BaseEngine engine, List<Long> activityidlist, Map<String, List<String>> filterlist) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Activities.getActivities() Invalid session");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_ACTIVITIES, Request.Type.COMMON, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_ACTIVITIES);
    if (activityidlist != null) {
        request.addData("activityidlist", new Vector<Object>(activityidlist));
    }
    if (filterlist != null) {
        request.addData("filterlist", ApiUtils.createHashTable(filterlist));
    }
    int requestId = QueueManager.getInstance().addRequest(request);
    QueueManager.getInstance().fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request)

Aggregations

ActivitiesEngine (com.vodafone360.people.engine.activities.ActivitiesEngine)2 MainApplication (com.vodafone360.people.MainApplication)1 PushEvent (com.vodafone360.people.datatypes.PushEvent)1 Request (com.vodafone360.people.service.io.Request)1