use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType in project ddf by codice.
the class RegistryPackageTypeHelperTest method testGetPersonsFromRegistryObjectList.
@Test
public void testGetPersonsFromRegistryObjectList() throws Exception {
RegistryObjectListType registryObjectList = ((RegistryPackageType) registryObject).getRegistryObjectList();
List<PersonType> persons = rptHelper.getPersons(registryObjectList);
assertPersons(persons);
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType in project ddf by codice.
the class RegistryPackageTypeHelperTest method assertPersons.
private void assertPersons(List<PersonType> persons) {
// Values from xml file
int expectedPersonsSize = 3;
int expectedSize = 1;
String expectedFirstName = "john";
String expectedMiddleName = "middleName";
String expectedLastname = "doe";
String expectedCity = "Phoenix";
String expectedCountry = "USA";
String expectedPostalCode = "85037";
String expectedState = "AZ";
String expectedStreet = "1234 Some Street";
String expectedAreaCode = "111";
String expectedNumber = "111-1111";
String expectedExtension = "1234";
String expectedCountryCode = "country";
String expectedPhoneType = "cell phone";
String expectedEmail = "emailaddress@something.com";
assertThat(persons, hasSize(expectedPersonsSize));
PersonType person = persons.get(0);
assertThat(person.isSetPersonName(), is(true));
assertPersonName(person.getPersonName(), expectedFirstName, expectedMiddleName, expectedLastname);
assertThat(person.isSetAddress(), is(true));
List<PostalAddressType> addresses = person.getAddress();
assertThat(addresses, hasSize(expectedSize));
assertAddress(addresses.get(0), expectedCity, expectedCountry, expectedPostalCode, expectedState, expectedStreet);
assertThat(person.isSetTelephoneNumber(), is(true));
List<TelephoneNumberType> phoneNumbers = person.getTelephoneNumber();
assertThat(phoneNumbers, hasSize(expectedSize));
assertPhoneNumbers(phoneNumbers.get(0), expectedAreaCode, expectedNumber, expectedExtension, expectedCountryCode, expectedPhoneType);
assertThat(person.isSetEmailAddress(), is(true));
assertThat(person.getEmailAddress(), hasSize(expectedSize));
List<EmailAddressType> emailAddresses = person.getEmailAddress();
assertThat(emailAddresses.get(0).getAddress(), is(equalTo(expectedEmail)));
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType in project tesb-rt-se by Talend.
the class LibraryServerImpl method seekBook.
@Override
public ListOfBooks seekBook(SearchFor body) throws SeekBookError {
System.out.println("***************************************************************");
System.out.println("*** seekBook request (Request-Response operation) is received *");
System.out.println("***************************************************************");
showSeekBookRequest(body);
List<String> authorsLastNames = body.getAuthorLastName();
if (authorsLastNames != null && authorsLastNames.size() > 0) {
String authorsLastName = authorsLastNames.get(0);
if (authorsLastName != null && authorsLastName.length() > 0 && !"Icebear".equalsIgnoreCase(authorsLastName)) {
SeekBookError e = prepareException("No book available from author " + authorsLastName);
System.out.println("No book available from author " + authorsLastName);
System.out.println("\nSending business fault (SeekBook error) with parameters:");
throw e;
}
}
ListOfBooks result = new ListOfBooks();
BookType book = new BookType();
result.getBook().add(book);
PersonType author = new PersonType();
book.getAuthor().add(author);
author.setFirstName("Jack");
author.setLastName("Icebear");
Calendar dateOfBirth = new GregorianCalendar(101, Calendar.JANUARY, 2);
author.setDateOfBirth(dateOfBirth.getTime());
book.getTitle().add("Survival in the Arctic");
book.getPublisher().add("Frosty Edition");
book.setYearPublished("2010");
System.out.println("Book(s) is found:");
showSeekBookResponse(result);
return result;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType in project tesb-rt-se by Talend.
the class Utils method showBooks.
/**
* Show books.
*
* @param booksList the books list
*/
public static void showBooks(final ListOfBooks booksList) {
if (booksList != null && booksList.getBook() != null && !booksList.getBook().isEmpty()) {
List<BookType> books = booksList.getBook();
System.out.println("\nNumber of books: " + books.size());
int cnt = 0;
for (BookType book : books) {
System.out.println("\nBookNum: " + (cnt++ + 1));
List<PersonType> authors = book.getAuthor();
if (authors != null && !authors.isEmpty()) {
for (PersonType author : authors) {
System.out.println("Author: " + author.getFirstName() + " " + author.getLastName());
}
}
System.out.println("Title: " + book.getTitle());
System.out.println("Year: " + book.getYearPublished());
if (book.getISBN() != null) {
System.out.println("ISBN: " + book.getISBN());
}
}
} else {
System.out.println("List of books is empty");
}
System.out.println("");
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType in project tesb-rt-se by Talend.
the class LibraryPublisher method publishNewBooksNotifications.
public void publishNewBooksNotifications() throws InterruptedException {
for (int ndx = 1; ndx < 6; ndx++) {
Thread.sleep(4000L);
List<BookType> newBooks = new LinkedList<BookType>();
BookType book = new BookType();
newBooks.add(book);
PersonType author = new PersonType();
book.getAuthor().add(author);
author.setFirstName("Jack");
author.setLastName("Icebear");
Calendar dateOfBirth = new GregorianCalendar(101, Calendar.JANUARY, 2);
author.setDateOfBirth(dateOfBirth.getTime());
book.getTitle().add("More About Survival in the Arctic - Volume " + ndx);
book.getPublisher().add("Frosty Edition");
book.setYearPublished("2011");
System.out.println("Publishing notification about a new book:");
System.out.println("Jack Icebear - More About Survival in the Arctic - Volume " + ndx);
library.newBooks(new Date(), newBooks);
}
}
Aggregations