Package sk.vrto.domain

Examples of sk.vrto.domain.Contact


     * @param user User to create contacts for
     */
    @PostConstruct
    public void initForUser(User user) {
        contacts.putAll(user, Arrays.asList(
                new Contact("Chuck Norris", "gmail@chucknorris.com", user),
                new Contact("Wayne Gretzky", "gretzky@nhl.com", user),
                new Contact("Mario Lemieux", "lemieux@nhl.com", user),
                new Contact("Arnold Schwarzenegger", "schwarzie@expedanbles.com", user),
                new Contact("James Gosling", "gosling@java.com", user),
                new Contact("Walter White", "walter.white@breakingbad.com", user),
                new Contact("Frank Horrigan", "bigbadboss@enclave.com", user),
                new Contact("Alex Ovechkin", "ovi8@caps.com", user)
        ));
    }
View Full Code Here


        return contacts.get(user);
    }

    @Override
    public ContactCreation getOrCreate(String emailAddress, User forUser) {
        Contact found = null;
        boolean freshlyCreated = false;

        for (Contact contact : contacts.get(forUser)) {
            if (contact.getEmail().equals(emailAddress)) {
                found = contact;
View Full Code Here

     * Creates and inserts new contact, and then propagates {@link ContactInsertedEvent}
     * @param name Contact's name
     * @param email Contact's email
     */
    public void createContact(String name, String email) {
        Contact contact = new Contact(name, email, user);
        contactRepository.insert(contact);
        eventBus.post(new ContactInsertedEvent(contact));
    }
View Full Code Here

     * removes it and creates new one.
     * @param e Triggering event
     */
    @Subscribe
    public void onContactUpdated(ContactUpdatedEvent e) {
        Contact contact = e.getUpdatedContact();
        Iterator<com.vaadin.ui.Component> componentIterator = view.getComponentIterator();
        while (componentIterator.hasNext()) {
            ContactView contactView = (ContactView) componentIterator.next();
            if (contactView.getContact().getEmail().equals(contact.getEmail())) {
                int index = view.getComponentIndex(contactView);
                view.removeComponent(contactView);
                view.addComponent(contactViewProvider.get(contact), index);
                break;
            }
View Full Code Here

    }

    @Override
    public ContactCreation getOrCreate(String emailAddress, User forUser) {
        boolean freshlyCreated = false;
        Contact contact = find(emailAddress);

        if (null == contact) {
            freshlyCreated = true;
            contact = contactCreator.mapFromAddress(emailAddress, forUser);
            insert(contact);
View Full Code Here

        try {
            session.beginTransaction();
            Query query = session.createQuery("from Contact c where c.email = :email");
            query.setParameter("email", key);
            List<?> result = query.list();
            Contact contact = result.isEmpty() ? null : (Contact) result.get(0);
            session.getTransaction().commit();
            return contact;
        } finally {
            session.close();
        }
View Full Code Here

    }

    @Test
    public void testMapFromAddressOnlyFirstName() {
        String address = "satan@hell.fi";
        Contact contact = creator.mapFromAddress(address, user);
        assertEquals("Satan", contact.getName());
    }
View Full Code Here

    }

    @Test
    public void testMapFromAddressFirstNameAndSurname() {
        String address = "satan.diablo@hell.fi";
        Contact contact = creator.mapFromAddress(address, user);
        assertEquals("Satan Diablo", contact.getName());
    }
View Full Code Here

        }).when((EmailServiceImpl) emailService).doSend((SimpleEmail) anyObject());

        // try out JavaMail assembling
        emailService.send(
                new EmailAccount("test@test.sk", encrypter.encrypt("skynet")),
                new Email(new Contact("miso", "miso@miso.sk", null), "title", "content"));
        // sending is mocked
        // no exception should be thrown
    }
View Full Code Here

        } else {
            name = namify(atSplit[0]);
            surname = "";
        }

        return new Contact(surname.isEmpty() ? name : name + " " + surname,
                emailAddress, user);
    }
View Full Code Here

TOP

Related Classes of sk.vrto.domain.Contact

Copyright © 2018 www.massapicom. 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.