Search in sources :

Example 6 with Name

use of com.vodafone360.people.datatypes.VCardHelper.Name 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)

Example 7 with Name

use of com.vodafone360.people.datatypes.VCardHelper.Name in project 360-Engine-for-Android by 360.

the class NowPlusServiceTestHelper method fetchUsernameState.

/**
 * Synchronously fetches the state of the user name from the NOW+ server
 *
 * @param username The user name to check (entered during registration)
 * @param data On success fills the given bundle with a key called
 *            "UsernameState.mBundleKey" and string data which is one of the
 *            UsernameState enum values.
 * @return SUCCESS or one of the ServiceStatus error codes.
 */
public ServiceStatus fetchUsernameState(String username, Bundle data) {
    ServiceStatus status = ServiceStatus.SUCCESS;
    synchronized (mUiRequestLock) {
        status = startSynchronousRequest(ServiceUiRequest.USERNAME_AVAILABILITY);
        mPeopleService.fetchUsernameState(username);
        status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, 0);
    }
    return status;
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus)

Example 8 with Name

use of com.vodafone360.people.datatypes.VCardHelper.Name in project 360-Engine-for-Android by 360.

the class NativeContactsApiTest method testAccountDataType.

/**
 * Tests the plain Account inner class
 */
@SmallTest
public void testAccountDataType() {
    // Account with null name and type
    Account emptyAccount = new Account(null, null);
    assertNotNull(emptyAccount);
    assertNull(emptyAccount.getName());
    assertNull(emptyAccount.getType());
    emptyAccount = null;
    // Array of accounts
    final int NUM_OBJS_TO_CREATE = 4;
    final String baseName = "AccountBaseName";
    final String baseType = "AccountBaseType";
    for (int i = 0; i < NUM_OBJS_TO_CREATE; i++) {
        Account account = new Account(baseName + i, baseType + i);
        assertNotNull(account);
        assertNotNull(account.getName());
        assertNotNull(account.getType());
        assertNotNull(account.toString());
        assertEquals("Account: name=" + baseName + i + ", type=" + baseType + i, account.toString());
        assertEquals(baseName + i, account.getName());
        assertEquals(baseType + i, account.getType());
        assertFalse(account.isPeopleAccount());
    }
}
Also used : Account(com.vodafone360.people.engine.contactsync.NativeContactsApi.Account) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 9 with Name

use of com.vodafone360.people.datatypes.VCardHelper.Name in project 360-Engine-for-Android by 360.

the class TestModule method createFakeActivitiesList.

/**
 * TODO: fill in the method properly
 * @return
 */
public List<ActivityItem> createFakeActivitiesList() {
    List<ActivityItem> activityList = new ArrayList<ActivityItem>();
    for (int i = 0; i < TABLE_SIZE; i++) {
        ActivityItem activityItem = new ActivityItem();
        /**
         * Unique identifier for the activity. This can be empty when setting
         * a new activity (the id is generated on the server side)
         */
        activityItem.activityId = System.currentTimeMillis();
        /**
         * Timestamp representing the time of the activity.
         * This may not be related to creation/updated time.
         */
        activityItem.time = System.currentTimeMillis();
        /**
         * local id for db
         */
        // activityItem.mLocalId; set by DB insertion
        // activityItem.mMoreInfo; //new Hashtable<ActivityItem, String>
        /**
         * The parent activity for 'grouped' or aggregated activities. This must be empty
         * for normal activities that can be retrieved normally. Normally, a GetActivities
         * without filter will not yield any 'grouped' or 'child' activities.
         * To get activities that have a mParentActivity set, the 'children' filter must
         * be used with a value of the parent Activity's id.
         */
        // activityItem.mParentActivity; // null
        /**
         * Indicates wether this activity 'groups' several child activities. When set,
         * there must be child activities set that refer the main activity. Normally,
         * a GetActivities without filter will not yield any 'grouped' or 'child' activities.
         * To get activities that have a parentactivity set, the 'children' filter
         * must be used with a value of the parent Activity's id.
         */
        // activityItem.mHasChildren = false;
        /**
         * Defines a binary preview for the activity. The preview can be a small thumbnail
         * of the activity. The type of the binary data is defined into the previewmime field.
         */
        // keep null
        // activityItem.mPreview = ByteBuffer.allocate(bytes.length);
        // activityItem.mPreviewMime;
        /**
         * Defines an http url that the client can use to retrieve preview binary data.
         * Can be used to embed the url into an IMG HTML tag.
         */
        // activityItem.mPreviewUrl
        /**
         * Name of the store type for this message. This field contains information about the
         * originator network (local or external community activity).
         * By default, should be set to local
         */
        activityItem.store = "local";
        activityItem.title = generateRandomString();
        activityItem.description = activityItem.description + activityItem.store;
        /**
         * Defines the type of the activity.
         */
        activityItem.type = Type.CONTACT_FRIEND_INVITATION_SENT;
        /**
         * Defines an internal reference (if any) to the source of the activity.
         * The format for the uri is "module:identifier".Some examples of valid uri are:
         * contact:2737b322c9f6476ca152aa6cf3e5ac12 The activity is linked to some
         * changes on a contact identified by id=2737b322c9f6476ca152aa6cf3e5ac12.
         * file:virtual/flickr/2590004126 The activity is linked to some actions
         * on a file identified by id=virtual/flickr/2590004126.
         * message:9efd255359074dd9bd04cc1c8c4743e5 The activity is linked to a message
         * identified by id=9efd255359074dd9bd04cc1c8c4743e5
         */
        activityItem.uri = "virtual/flickr/2590004126";
        // can be 0		activityItem.mActivityFlags;
        /**
         * Miscellaneous flags.
         */
        activityItem.flagList = new ArrayList<Flag>();
        activityItem.flagList.add(Flag.ALREADY_READ);
        /**
         * Defines the contact information of the counter-parties in the activity.
         * This field is not mandatory, because some activity types
         * are not related to contacts, but required if known..
         */
        // keep it simple - empty		activityItem.mContactList = ;
        activityItem.visibility = new ArrayList<Visibility>();
        activityItem.visibility.add(Visibility.ORIGINATOR);
        // keep it 0		activityItem.mVisibilityFlags = 0;
        activityList.add(activityItem);
    }
    return activityList;
}
Also used : ArrayList(java.util.ArrayList) Visibility(com.vodafone360.people.datatypes.ActivityItem.Visibility) Flag(com.vodafone360.people.datatypes.ActivityItem.Flag) ActivityItem(com.vodafone360.people.datatypes.ActivityItem)

Example 10 with Name

use of com.vodafone360.people.datatypes.VCardHelper.Name in project 360-Engine-for-Android by 360.

the class NowPlusActivitiesTableTest method testUpdateTimelineContactNameAndId5.

/**
 * this method checks the updated contacts are present in the database
 */
public void testUpdateTimelineContactNameAndId5() {
    Log.i(LOG_TAG, "***** testUpdateTimelineContactNameAndId5: create table *****");
    SQLiteDatabase writableDataBase = mTestDatabase.getWritableDatabase();
    ActivitiesTable.create(writableDataBase);
    Log.i(LOG_TAG, "***** testUpdateTimelineContactNameAndId5, not call log though *****");
    ArrayList<TimelineSummaryItem> timeLines = TestModule.generateFakeTimeLinesList();
    ActivitiesTable.addTimelineEvents(timeLines, false, writableDataBase);
    // check if the records are there
    SQLiteDatabase readableDataBase = mTestDatabase.getReadableDatabase();
    Cursor c = ActivitiesTable.fetchTimelineEventList(YESTERDAY_TIME_MILLIS, new TimelineNativeTypes[] { TimelineNativeTypes.SmsLog, TimelineNativeTypes.MmsLog }, readableDataBase);
    ArrayList<TimelineSummaryItem> actualDBTimeLines = new ArrayList<TimelineSummaryItem>();
    while (c.moveToNext()) {
        actualDBTimeLines.add(ActivitiesTable.getTimelineData(c));
    }
    compareTimeLineIds(timeLines, actualDBTimeLines);
    timeLines = actualDBTimeLines;
    final String NAME = "New";
    for (TimelineSummaryItem timeLineSummary : timeLines) {
        ActivitiesTable.updateTimelineContactNameAndId(timeLineSummary.mContactName, timeLineSummary.mContactName += NAME, timeLineSummary.mLocalContactId, TestModule.generateRandomLong(), writableDataBase);
    }
    c.requery();
    actualDBTimeLines.clear();
    c.moveToFirst();
    for (int i = 0, count = c.getCount(); i < count; i++, c.moveToNext()) {
        actualDBTimeLines.add(ActivitiesTable.getTimelineData(c));
    }
    compareTimeLineIds(timeLines, actualDBTimeLines);
    Log.i(LOG_TAG, "***** testUpdateTimelineContactNameAndId5 SUCCEEDED *****");
}
Also used : SQLiteDatabase(android.database.sqlite.SQLiteDatabase) ArrayList(java.util.ArrayList) TimelineSummaryItem(com.vodafone360.people.database.tables.ActivitiesTable.TimelineSummaryItem) Cursor(android.database.Cursor)

Aggregations

ContactDetail (com.vodafone360.people.datatypes.ContactDetail)23 ServiceStatus (com.vodafone360.people.service.ServiceStatus)20 VCardHelper (com.vodafone360.people.datatypes.VCardHelper)13 Cursor (android.database.Cursor)12 Contact (com.vodafone360.people.datatypes.Contact)12 ArrayList (java.util.ArrayList)11 Name (com.vodafone360.people.datatypes.VCardHelper.Name)9 ContentValues (android.content.ContentValues)7 Uri (android.net.Uri)7 ContactSummary (com.vodafone360.people.datatypes.ContactSummary)7 SQLException (android.database.SQLException)6 Organisation (com.vodafone360.people.datatypes.VCardHelper.Organisation)6 QueueManager (com.vodafone360.people.service.io.QueueManager)6 Request (com.vodafone360.people.service.io.Request)6 TimelineSummaryItem (com.vodafone360.people.database.tables.ActivitiesTable.TimelineSummaryItem)5 ActivityItem (com.vodafone360.people.datatypes.ActivityItem)5 Hashtable (java.util.Hashtable)5 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)4 Suppress (android.test.suitebuilder.annotation.Suppress)4 Date (java.util.Date)4