Examples of BlackBerryContactList


Examples of net.rim.blackberry.api.pdap.BlackBerryContactList

     **/
    public Record setRecord(Record record, boolean modify) throws DataAccessException {
       
        try {

            BlackBerryContactList list = (BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);

            BlackBerryContact contact = getContact(record.getKey(), list, modify);

            if (contact == null) {
               
                Dialog.inform("BlackBerryContact is null.");
                return null;
            }
           
            String content = fixTag(record.getUid());

            ContactParser parser = ParserFactory.getParserInstance(list, contact, modify);

            parser.parseContact(content);

            contact.commit();

            String uid = contact.getString(BlackBerryContact.UID, 0);

            record.setKey(uid);

            list.close();
           
        }
        catch (Exception e) {
            System.out.println(">>> Improper data from server (vCard instead of SIF-C): " + e.getMessage());
            //e.printStackTrace();
View Full Code Here

Examples of net.rim.blackberry.api.pdap.BlackBerryContactList

     * @param record
     * @throws DataAccessException
     */
    public void deleteRecord(Record record) throws DataAccessException {
        try {
            BlackBerryContactList list = (BlackBerryContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
            BlackBerryContact contact = getContact(record.getKey(), list, true);
            if(contact != null)
                list.removeContact(contact);
            list.close();
        }catch(Exception expn) {
            throw new DataAccessException(expn);
        }
    }
View Full Code Here

Examples of net.rim.blackberry.api.pdap.BlackBerryContactList

         * In case of deleted record, the information would not be available during sync.
         * hence it is store along with the update information. In update/new case it is
         * available in the contact db so it is not store to save space
         */
        if(state == RECORD_STATE_DELETED) {
            BlackBerryContactList list = (BlackBerryContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);

            String data = getContactString(list, contact);

            list.close();

            value += "|" + data;

        }

View Full Code Here

Examples of net.rim.blackberry.api.pdap.BlackBerryContactList

                                    + "associated with a contact. Please select an option.",
                            choices, CREATE_NEW);

            // Manually select contact from address book
            if (answer == SELECT_CONTACT) {
                BlackBerryContactList contacts = null;
                try {
                    contacts =
                            (BlackBerryContactList) PIM.getInstance()
                                    .openPIMList(PIM.CONTACT_LIST,
                                            PIM.READ_WRITE);
                } catch (final PIMException e) {
                    ContactLinkingDemo
                            .errorDialog("Couldn't open contacts list.  PIM.openPIMList() threw "
                                    + e.toString());
                    return;
                }

                final Object choice = contacts.choose();
                if (choice instanceof BlackBerryContact) {
                    bbContact = (BlackBerryContact) choice;
                }

                if (bbContact != null) {
View Full Code Here

Examples of net.rim.blackberry.api.pdap.BlackBerryContactList

     *         was not successful
     */
    private static BlackBerryContact createContactFor(
            final LinkableContact linkableContact) {
        // Obtain list of contacts
        BlackBerryContactList contacts;
        try {
            contacts =
                    (BlackBerryContactList) PIM.getInstance().openPIMList(
                            PIM.CONTACT_LIST, PIM.READ_WRITE);
        } catch (final PIMException e) {
            ContactLinkingDemo
                    .errorDialog("Could not open contacts list.  PIM#openPIMList() threw "
                            + e.toString());
            return null;
        }

        // Create a new BlackBerryContact
        BlackBerryContact contact =
                (BlackBerryContact) contacts.createContact();

        // Set the mobile phone number for the new BlackBerryContact
        final String mobileNumber =
                linkableContact.getString(LinkableContact.MOBILE_PHONE);
        if (mobileNumber != null) {
            contact.addString(Contact.TEL, Contact.ATTR_MOBILE, mobileNumber);
        }

        // Set the email address for the new BlackBerryContact
        final String emailAddress =
                linkableContact.getString(LinkableContact.EMAIL);
        if (emailAddress != null) {
            contact.addString(Contact.EMAIL, Contact.ATTR_PREFERRED,
                    linkableContact.getString(LinkableContact.EMAIL));
        }

        // Set the name for the new BlackBerryContact
        final String[] names =
                StringUtilities.stringToWords(linkableContact
                        .getString(LinkableContact.NAME));
        final String[] nameArray =
                new String[contacts.stringArraySize(Contact.NAME)];
        nameArray[Contact.NAME_FAMILY] = names[1];
        nameArray[Contact.NAME_GIVEN] = names[0];
        contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, nameArray);

        // Invoke the Adress Book application
View Full Code Here

Examples of net.rim.blackberry.api.pdap.BlackBerryContactList

    /**
     * Creates a new CreateContactAction object
     */
    public CreateContactAction() throws PIMException {

        final BlackBerryContactList contacts =
                (BlackBerryContactList) PIM.getInstance().openPIMList(
                        PIM.CONTACT_LIST, PIM.READ_WRITE);

        // Check if there is already an existing contact
        // with phone number 519-555-1111.
        final Enumeration enumeration =
                contacts.itemsByPhoneNumber(PHONE_NUMBER);
        if (!enumeration.hasMoreElements()) {
            final Contact contact = contacts.createContact();

            // Add first and last name to contact
            final String[] name =
                    new String[contacts.stringArraySize(Contact.NAME)];
            name[Contact.NAME_FAMILY] = "Warren";
            name[Contact.NAME_GIVEN] = "Clyde";
            contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, name);

            // Add address info to contact
            final String[] addr =
                    new String[contacts.stringArraySize(Contact.ADDR)];
            addr[Contact.ADDR_LOCALITY] = "Waterloo";
            addr[Contact.ADDR_COUNTRY] = "Canada";
            contact.addStringArray(Contact.ADDR, Contact.ATTR_HOME, addr);

            // Add email and phone info to contact
            contact.addString(Contact.EMAIL, Contact.ATTR_WORK
                    | Contact.ATTR_PREFERRED, "cwarren@rim.com");
            contact.addString(Contact.TEL, Contact.ATTR_MOBILE, PHONE_NUMBER);

            contact.commit();
            contacts.close();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.