Search in sources :

Example 26 with QueueManager

use of com.vodafone360.people.service.io.QueueManager in project 360-Engine-for-Android by 360.

the class GroupPrivacy method deleteContactGroupRelationsExt.

/**
 * Implementation of groupprivacy/deletecontactgrouprelationsext API.
 * Parameters are; [auth], Long groupid, List<Long> contactidlist
 *
 * @param engine handle to IdentitiesEngine
 * @param groupid Group ID.
 * @param contactidlist List of contact IDs to delete group relations.
 * @return request id generated for this request
 */
public static int deleteContactGroupRelationsExt(BaseEngine engine, Long groupid, List<Long> contactidlist) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("GroupPrivacy.deleteContactGroupRelationsExt() Invalid session, return -1");
        return -1;
    }
    if (groupid == null) {
        LogUtils.logE("GroupPrivacy.deleteContactGroupRelationsExt() groupid cannot be NULL");
        return -1;
    }
    if (contactidlist == null) {
        LogUtils.logE("GroupPrivacy.deleteContactGroupRelationsExt() contactidlist cannot be NULL");
        return -1;
    }
    if (contactidlist.size() == 0) {
        LogUtils.logE("GroupPrivacy.deleteContactGroupRelationsExt() contactidlist.size cannot be 0");
        return -1;
    }
    Request request = new Request(FUNCTION_DELETE_CONTACT_GROUP_RELATIONS_EXT, Request.Type.DELETE_CONTACT_GROUP_RELATIONS, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_GROUP_PRIVACY);
    request.addData("groupid", groupid);
    request.addData("contactidlist", new Vector<Object>(contactidlist));
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 27 with QueueManager

use of com.vodafone360.people.service.io.QueueManager in project 360-Engine-for-Android by 360.

the class GroupPrivacy method addContactGroupRelations.

/**
 * Implementation of groupprivacy/addcontactgrouprelations API. Parameters
 * are; [auth], List<Long> contactidlist, List<Group> grouplist
 *
 * @param engine handle to ContactSyncEngine
 * @param contactidlist List of contacts ids associated with this request.
 * @param grouplist List of groups associated with this request.
 * @return request id generated for this request
 */
public static int addContactGroupRelations(BaseEngine engine, List<Long> contactidlist, List<GroupItem> grouplist) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("GroupPrivacy.addContactGroupRelations() Invalid session, return -1");
        return -1;
    }
    if (contactidlist == null) {
        LogUtils.logE("GroupPrivacy.addContactGroupRelations() contactidlist cannot be NULL");
        return -1;
    }
    if (grouplist == null) {
        LogUtils.logE("GroupPrivacy.addContactGroupRelations() grouplist cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_ADD_CONTACT_GROUP_RELATIONS, Request.Type.CONTACT_GROUP_RELATIONS, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_GROUP_PRIVACY);
    request.addData("contactidlist", new Vector<Object>(contactidlist));
    request.addData("grouplist", ApiUtils.createVectorOfGroup(grouplist));
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 28 with QueueManager

use of com.vodafone360.people.service.io.QueueManager in project 360-Engine-for-Android by 360.

the class Identities method getAvailableIdentities.

/**
 * Implementation of identities/getavailableidentities API. Parameters are;
 * [auth], Map<String, List<String>> filterlist [opt]
 *
 * @param engine handle to IdentitiesEngine
 * @param filterlist List of filters the get identities request is filtered
 *            against.
 * @return request id generated for this request
 */
public static int getAvailableIdentities(BaseEngine engine, Map<String, List<String>> filterlist) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Identities.getAvailableIdentities() Invalid session, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_AVAILABLE_IDENTITIES, Request.Type.GET_AVAILABLE_IDENTITIES, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_IDENTITIES);
    if (filterlist != null) {
        request.addData("filterlist", ApiUtils.createHashTable(filterlist));
    }
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 29 with QueueManager

use of com.vodafone360.people.service.io.QueueManager in project 360-Engine-for-Android by 360.

the class Identities method deleteIdentity.

/**
 * Implementation of identities/deleteIdentity API. Parameters are; [auth],
 * String network, String identityid.
 *
 * @param engine
 *            Handle to IdentitiesEngine.
 * @param network
 *            Name of network.
 * @param identityId
 *            The user's identity ID.
 * @return requestId The request ID generated for this request.
 */
public static int deleteIdentity(final BaseEngine engine, final String network, final String identityId) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Identities.deleteIdentity() Invalid session, return -1");
        return -1;
    }
    if (network == null) {
        LogUtils.logE("Identities.deleteIdentity() network cannot be NULL");
        return -1;
    }
    if (identityId == null) {
        LogUtils.logE("Identities.deleteIdentity() identityId cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_DELETE_IDENITY, Request.Type.DELETE_IDENTITY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_IDENTITIES);
    request.addData("network", network);
    request.addData("identityid", identityId);
    LogUtils.logI("Identity to be removed : " + network + " : " + identityId);
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 30 with QueueManager

use of com.vodafone360.people.service.io.QueueManager in project 360-Engine-for-Android by 360.

the class HttpConnectionThread method addErrorToResponseQueue.

/**
 * Adds errors to the response queue whenever there is an HTTP error on the
 * backend.
 *
 * @param reqIds The request IDs the error happened for.
 */
public void addErrorToResponseQueue(List<Integer> reqIds) {
    EngineId source = null;
    QueueManager requestQueue = QueueManager.getInstance();
    ResponseQueue responseQueue = ResponseQueue.getInstance();
    for (Integer reqId : reqIds) {
        // attempt to get type from request
        Request req = requestQueue.getRequest(reqId);
        if (req != null)
            source = req.mEngineId;
        responseQueue.addToResponseQueue(new DecodedResponse(reqId, null, source, DecodedResponse.ResponseType.SERVER_ERROR.ordinal()));
    }
}
Also used : DecodedResponse(com.vodafone360.people.service.io.ResponseQueue.DecodedResponse) EngineId(com.vodafone360.people.engine.EngineManager.EngineId) Request(com.vodafone360.people.service.io.Request) ResponseQueue(com.vodafone360.people.service.io.ResponseQueue) QueueManager(com.vodafone360.people.service.io.QueueManager)

Aggregations

QueueManager (com.vodafone360.people.service.io.QueueManager)29 Request (com.vodafone360.people.service.io.Request)28 ResponseQueue (com.vodafone360.people.service.io.ResponseQueue)2 DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)2 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)1 BaseDataType (com.vodafone360.people.datatypes.BaseDataType)1 ServerError (com.vodafone360.people.datatypes.ServerError)1 EngineId (com.vodafone360.people.engine.EngineManager.EngineId)1 ServiceUiRequest (com.vodafone360.people.service.ServiceUiRequest)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1