Search in sources :

Example 41 with Request

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

the class Contacts method getContactsChanges.

/**
     * Implementation of contacts/getcontactschanges API. Parameters are;
     * [auth], Integer pagenumber, Integer maxpagesize, Long fromrevision, Long
     * torevision
     * 
     * @param engine Handle to ContactSync engine
     * @param pagenumber Page number to request contact changes for.
     * @param maxpagesize Maximum number of contacts retrieved per page.
     * @param fromrevision Starting revision number.
     * @param torevision Final revision number.
     * @param batchRequest If true, this API call will not send the request
     *            until the connection thread is kicked. This allows batching of
     *            requests.
     * @return request id generated for this request.
     */
public static int getContactsChanges(BaseEngine engine, Integer pagenumber, Integer maxpagesize, Long fromrevision, Long torevision, boolean batchRequest) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Contacts.getContactsChanges() Invalid session, return -1");
        return -1;
    }
    if (pagenumber == null) {
        LogUtils.logE("Contacts.getContactsChanges() pagenumber cannot be NULL");
        return -1;
    }
    if (maxpagesize == null) {
        LogUtils.logE("Contacts.getContactsChanges() maxpagesize cannot be NULL");
        return -1;
    }
    if (fromrevision == null) {
        LogUtils.logE("Contacts.getContactsChanges() fromrevision cannot be NULL");
        return -1;
    }
    if (torevision == null) {
        LogUtils.logE("Contacts.getContactsChanges() torevision cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_CONTACT_CHANGES, Request.Type.CONTACT_CHANGES_OR_UPDATES, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_CONTACTS);
    request.addData("pagenumber", pagenumber);
    request.addData("maxpagesize", maxpagesize);
    request.addData("fromrevision", fromrevision);
    request.addData("torevision", torevision);
    // XXX check if this has any implications
    // request.setKickConnectionThread(!batchRequest);
    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 42 with Request

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

the class Contacts method setMe.

/**
     * Implementation of contacts/setme API. Parameters are; [auth],
     * List<ContactDetail> detaillist, String aboutme [opt]
     * 
     * @param engine Handle to ContactSync engine
     * @param detaillist List of ContactDetails for the Me profile.
     * @param aboutme AboutMe string.
     * @param gender - gender.
     * @return request id generated for this request.
     */
public static int setMe(BaseEngine engine, List<ContactDetail> detaillist, String aboutme, Integer gender) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Contacts.SetMe() Invalid session, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_SET_ME, Request.Type.CONTACT_CHANGES_OR_UPDATES, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_CONTACTS);
    if (aboutme != null) {
        request.addData("aboutme", aboutme);
    }
    if (detaillist != null) {
        request.addData("detaillist", ApiUtils.createVectorOfContactDetail(detaillist));
    }
    if (gender != null) {
        request.addData("gender", gender);
    }
    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 43 with Request

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

the class Contacts method deleteContacts.

/**
     * Implementation of contacts/deletecontacts API. Parameters are; [auth],
     * List<Long> contactidlist
     * 
     * @param engine Handle to ContactSync engine
     * @param contactidlist List of contact ids to be deleted.
     * @return request id generated for this request.
     */
public static int deleteContacts(BaseEngine engine, List<Long> contactidlist) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Contacts.deleteContacts() Invalid session, return -1");
        return -1;
    }
    if (contactidlist == null) {
        LogUtils.logE("Contacts.deleteContacts() contactidlist cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_DELETE_CONTACTS, Request.Type.CONTACT_DELETE, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_CONTACTS);
    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 44 with Request

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

the class Identities method getMyIdentities.

/**
     * Implementation of identities/getmyidentities 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 getMyIdentities(BaseEngine engine, Map<String, List<String>> filterlist) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Identities.getMyIdentities() Invalid session, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_MY_IDENTITIES, Request.Type.GET_MY_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 45 with Request

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

the class Identities method setIdentityStatus.

/**
     * @param engine
     * @param network
     * @param identityid
     * @param identityStatus
     * @return
     */
public static int setIdentityStatus(BaseEngine engine, String network, String identityid, String identityStatus) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Identities.setIdentityStatus() Invalid session, return -1");
        return -1;
    }
    if (identityid == null) {
        LogUtils.logE("Identities.setIdentityStatus() identityid cannot be NULL");
        return -1;
    }
    if (network == null) {
        LogUtils.logE("Identities.setIdentityStatus() network cannot be NULL");
        return -1;
    }
    if (identityStatus == null) {
        LogUtils.logE("Identities.setIdentityStatus() identity status cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_SET_IDENTITY_STATUS, Request.Type.EXPECTING_STATUS_ONLY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_IDENTITIES);
    request.addData("network", network);
    request.addData("identityid", identityid);
    request.addData("status", identityStatus);
    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)

Aggregations

Request (com.vodafone360.people.service.io.Request)43 QueueManager (com.vodafone360.people.service.io.QueueManager)27 ServiceStatus (com.vodafone360.people.service.ServiceStatus)16 ArrayList (java.util.ArrayList)16 BaseDataType (com.vodafone360.people.datatypes.BaseDataType)12 ServiceUiRequest (com.vodafone360.people.service.ServiceUiRequest)12 DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)11 Suppress (android.test.suitebuilder.annotation.Suppress)10 DatabaseHelper (com.vodafone360.people.database.DatabaseHelper)9 IEngineEventCallback (com.vodafone360.people.engine.IEngineEventCallback)9 IContactSyncCallback (com.vodafone360.people.engine.contactsync.IContactSyncCallback)9 ProcessorFactory (com.vodafone360.people.engine.contactsync.ProcessorFactory)9 ServerError (com.vodafone360.people.datatypes.ServerError)6 IOException (java.io.IOException)6 Identity (com.vodafone360.people.datatypes.Identity)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Bundle (android.os.Bundle)4 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)4 ContactChanges (com.vodafone360.people.datatypes.ContactChanges)4 ResponseQueue (com.vodafone360.people.service.io.ResponseQueue)4