Search in sources :

Example 6 with QueueManager

use of com.vodafone360.people.service.io.QueueManager 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 7 with QueueManager

use of com.vodafone360.people.service.io.QueueManager 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 8 with QueueManager

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

the class Contacts method bulkUpdateContacts.

/**
 * Implementation of contacts/bulkupdatecontacts API. Parameters are;
 * [auth], List<Contact> contactlist
 *
 * @param engine Handle to ContactSync engine
 * @param contactlist List containing the contacts to be updated on server.
 * @return request id generated for this request.
 */
public static int bulkUpdateContacts(BaseEngine engine, List<Contact> contactlist) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Contacts.bulkUpdateContacts() Invalid session, return -1");
        return -1;
    }
    if (contactlist == null) {
        LogUtils.logE("Contacts.bulkUpdateContacts() contactidlist cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_BULK_UPDATE_CONTACTS, Request.Type.CONTACT_CHANGES_OR_UPDATES, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_CONTACTS);
    request.addData("contactlist", ApiUtils.createVectorOfContact(contactlist));
    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 9 with QueueManager

use of com.vodafone360.people.service.io.QueueManager 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 10 with QueueManager

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

the class Identities method validateIdentityCredentials.

/**
 * Implementation of identities/validateidentitycredentials API. Parameters
 * are; [auth], Boolean dryrun [opt], String network [opt], String username,
 * String password, String server [opt], String contactdetail [opt], Map
 * identitycapabilitystatus [opt]
 *
 * @param engine handle to IdentitiesEngine
 * @param dryrun Whether this is a dry-run request.
 * @param network Name of network.
 * @param username User-name.
 * @param password Password.
 * @param server
 * @param contactdetail
 * @param identitycapabilitystatus Capabilities for this identity/network.
 * @return request id generated for this request
 */
public static int validateIdentityCredentials(BaseEngine engine, Boolean dryrun, String network, String username, String password, String server, String contactdetail, Map<String, Boolean> identitycapabilitystatus) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Identities.validateIdentityCredentials() Invalid session, return -1");
        return -1;
    }
    if (network == null) {
        LogUtils.logE("Identities.validateIdentityCredentials() network cannot be NULL");
        return -1;
    }
    if (username == null) {
        LogUtils.logE("Identities.validateIdentityCredentials() username cannot be NULL");
        return -1;
    }
    if (password == null) {
        LogUtils.logE("Identities.validateIdentityCredentials() password cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_VALIDATE_IDENTITY_CREDENTIALS, Request.Type.EXPECTING_STATUS_ONLY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_IDENTITIES);
    if (dryrun != null) {
        request.addData("dryrun", dryrun);
    }
    request.addData("network", network);
    request.addData("username", username);
    request.addData("password", password);
    if (server != null) {
        request.addData("server", server);
    }
    if (contactdetail != null) {
        request.addData("contactdetail", contactdetail);
    }
    if (identitycapabilitystatus != null) {
        request.addData("identitycapabilitystatus", new Hashtable<String, Object>(identitycapabilitystatus));
    }
    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

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