private String createPeopleFile( String baseUrl, String containerUrl, Map<String, VCard> importedPeople, SolidUtilities utilities) throws Exception { Model peopleModel = ModelFactory.createDefaultModel(); Resource indexResource = peopleModel.createResource("index.ttl#this"); for (String insertedId : importedPeople.keySet()) { VCard insertedPerson = importedPeople.get(insertedId); String relativePath = insertedId.replace(containerUrl, ""); Resource personResource = peopleModel.createResource(relativePath + "#this"); if (insertedPerson.getFormattedName() != null) { personResource.addProperty(VCARD4.fn, insertedPerson.getFormattedName().getValue()); } personResource.addProperty( peopleModel.createProperty(VCARD4.NS, "inAddressBook"), indexResource); } return utilities.postContent( baseUrl + containerUrl, "people", BASIC_RESOURCE_TYPE, peopleModel); }
r.addProperty(VCARD4.fn, vcard.getFormattedName().getValue());
@Test public void testFromRDF() { VCard vcard = SolidContactsExport.parsePerson(getPersonResource(TestData.RDF_TEST_DATA1)); assertWithMessage("Formatted Name is correct") .that(vcard.getFormattedName().getValue()) .isEqualTo("Cool Kid 1"); assertWithMessage("Note is correct") .that(vcard.getNotes().get(0).getValue()) .isEqualTo("This is a note for Cool Kid 1"); assertWithMessage("One email found") .that(vcard.getEmails()) .hasSize(1); assertWithMessage("email is correct") .that(vcard.getEmails().get(0).getValue()) .isEqualTo("a@b.com"); }
private void checkEquality(VCard input, VCard output) { String name = input.getFormattedName().getValue(); assertWithMessage("Structured names match") .that(output.getStructuredName()) .isEqualTo(input.getStructuredName()); assertWithMessage("Formatted names match for %s", name) .that(output.getFormattedName()) .isEqualTo(input.getFormattedName()); assertWithMessage("telephone numbers match for %s", name) .that(output.getTelephoneNumbers()) .containsAllIn(input.getTelephoneNumbers()); assertWithMessage("emails match for %s", name) .that(output.getEmails()) .containsAllIn(input.getEmails()); } }
String fullName = vcard.getFormattedName().getValue(); String phone = ""; for (Telephone telephone : vcard.getTelephoneNumbers()) {
String refCardId = formattedName.getValue(); GenericValue partyIdentification = EntityQuery.use(delegator).from("PartyIdentification").where("partyIdentificationTypeId", "VCARD_FN_ORIGIN", "idValue", refCardId).queryFirst(); if (partyIdentification != null) { createPartyIdentificationMap.put("partyId", resp.get("partyId")); createPartyIdentificationMap.put("partyIdentificationTypeId", "VCARD_FN_ORIGIN"); createPartyIdentificationMap.put("idValue", formattedName.getValue()); resp = dispatcher.runSync("createPartyIdentification", createPartyIdentificationMap); if (ServiceUtil.isError(resp)) {