Search in sources :

Example 1 with Organization

use of ezvcard.property.Organization in project android by nextcloud.

the class ContactOperations method convertOrganization.

private void convertOrganization(List<NonEmptyContentValues> contentValues, VCard vcard) {
    NonEmptyContentValues cv = new NonEmptyContentValues(ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE);
    Organization organization = vcard.getOrganization();
    if (organization != null) {
        List<String> values = organization.getValues();
        String[] keys = { ContactsContract.CommonDataKinds.Organization.COMPANY, ContactsContract.CommonDataKinds.Organization.DEPARTMENT, ContactsContract.CommonDataKinds.Organization.OFFICE_LOCATION };
        for (int i = 0; i < values.size(); i++) {
            String key = keys[i];
            String value = values.get(i);
            cv.put(key, value);
        }
    }
    List<Title> titleList = vcard.getTitles();
    if (!titleList.isEmpty()) {
        cv.put(ContactsContract.CommonDataKinds.Organization.TITLE, titleList.get(0).getValue());
    }
    contentValues.add(cv);
}
Also used : Organization(ezvcard.property.Organization) Title(ezvcard.property.Title)

Example 2 with Organization

use of ezvcard.property.Organization in project data-transfer-project by google.

the class ToVCardTransformer method copyBusinessData.

private void copyBusinessData(Map<String, Object> map, VCard card, TransformerContext context) {
    getMap("businessAddress", map).ifPresent(v -> card.addAddress(context.transform(Address.class, v)));
    getMap("otherAddress", map).ifPresent(v -> card.addAddress(context.transform(Address.class, v)));
    getString("jobTitle", map).ifPresent(card::addTitle);
    getString("companyName", map).ifPresent(v -> {
        Organization organization = new Organization();
        organization.getValues().add(v);
        card.addOrganization(organization);
    });
    getString("profession", map).ifPresent(card::addExpertise);
    copyPhones("businessPhones", TelephoneType.WORK, map, card);
}
Also used : Organization(ezvcard.property.Organization)

Example 3 with Organization

use of ezvcard.property.Organization in project ez-vcard by mangstadt.

the class OrganizationScribe method _parseJson.

@Override
protected Organization _parseJson(JCardValue value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
    Organization property = new Organization();
    StructuredValueIterator it = new StructuredValueIterator(value.asStructured());
    while (it.hasNext()) {
        String next = it.nextValue();
        if (next != null) {
            property.getValues().add(next);
        }
    }
    return property;
}
Also used : Organization(ezvcard.property.Organization) StructuredValueIterator(com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator)

Example 4 with Organization

use of ezvcard.property.Organization in project qksms by moezbhatti.

the class ContactOperations method convertOrganization.

private void convertOrganization(List<NonEmptyContentValues> contentValues, VCard vcard) {
    NonEmptyContentValues cv = new NonEmptyContentValues(ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE);
    Organization organization = vcard.getOrganization();
    if (organization != null) {
        List<String> values = organization.getValues();
        String[] keys = { ContactsContract.CommonDataKinds.Organization.COMPANY, ContactsContract.CommonDataKinds.Organization.DEPARTMENT, ContactsContract.CommonDataKinds.Organization.OFFICE_LOCATION };
        for (int i = 0; i < values.size(); i++) {
            String key = keys[i];
            String value = values.get(i);
            cv.put(key, value);
        }
    }
    List<Title> titleList = vcard.getTitles();
    if (!titleList.isEmpty()) {
        cv.put(ContactsContract.CommonDataKinds.Organization.TITLE, titleList.get(0).getValue());
    }
    contentValues.add(cv);
}
Also used : Organization(ezvcard.property.Organization) Title(ezvcard.property.Title)

Example 5 with Organization

use of ezvcard.property.Organization in project ez-vcard by mangstadt.

the class OrganizationScribe method _parseText.

@Override
protected Organization _parseText(String value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
    Organization property = new Organization();
    List<String> values = VObjectPropertyValues.parseSemiStructured(value);
    property.getValues().addAll(values);
    return property;
}
Also used : Organization(ezvcard.property.Organization)

Aggregations

Organization (ezvcard.property.Organization)9 Title (ezvcard.property.Title)2 StructuredValueIterator (com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator)1 Test (org.junit.Test)1