Package org.axonframework.sample.app.query

Examples of org.axonframework.sample.app.query.ContactEntry


        return "contacts/details";
    }

    @RequestMapping(value = "{identifier}/edit", method = RequestMethod.GET)
    public String formEdit(@PathVariable String identifier, Model model) {
        ContactEntry contactEntry = repository.loadContactDetails(identifier);
        model.addAttribute("contact", contactEntry);
        return "contacts/edit";
    }
View Full Code Here


    }

    @RequestMapping(value = "new", method = RequestMethod.GET)
    public String formNew(Model model) {
        ContactEntry attributeValue = new ContactEntry();
        model.addAttribute("contact", attributeValue);
        return "contacts/new";
    }
View Full Code Here

        return "redirect:/contacts";
    }

    @RequestMapping(value = "{identifier}/delete", method = RequestMethod.GET)
    public String formDelete(@PathVariable String identifier, Model model) {
        ContactEntry contactEntry = repository.loadContactDetails(identifier);
        model.addAttribute("contact", contactEntry);
        return "contacts/delete";
    }
View Full Code Here

    }

    @RequestMapping(value = "{identifier}/address/new", method = RequestMethod.GET)
    public String formNewAddress(@PathVariable String identifier, Model model) {
        ContactEntry contactEntry = repository.loadContactDetails(identifier);
        AddressEntry addressEntry = new AddressEntry();
        addressEntry.setIdentifier(contactEntry.getIdentifier());
        addressEntry.setName(contactEntry.getName());
        model.addAttribute("address", addressEntry);
        return "contacts/address";
    }
View Full Code Here

        return "contacts/address";
    }

    @RequestMapping(value = "{identifier}/address/delete/{addressType}", method = RequestMethod.GET)
    public String formDeleteAddress(@PathVariable String identifier, @PathVariable AddressType addressType, Model model) {
        ContactEntry contactEntry = repository.loadContactDetails(identifier);
        AddressEntry addressEntry = new AddressEntry();
        addressEntry.setIdentifier(contactEntry.getIdentifier());
        addressEntry.setName(contactEntry.getName());
        addressEntry.setAddressType(addressType);
        model.addAttribute("address", addressEntry);
        return "contacts/removeAddress";
    }
View Full Code Here

    public void testHandleChangeNameContactCommand_happypath() {
        ChangeContactNameCommand command = new ChangeContactNameCommand();
        command.setContactId(UUID.randomUUID().toString());
        command.setContactNewName("Good New Name");

        ContactEntry mockContactEntry = mock(ContactEntry.class);

        when(mockContactNameRepository.claimContactName("Good New Name"))
                .thenReturn(true);
        when(mockRepository.load(isA(String.class)))
                .thenReturn(mockContact);
        when(mockContactRepository.loadContactDetails(command.getContactId()))
                .thenReturn(mockContactEntry);
        when(mockContactEntry.getName()).thenReturn("Good Old Name");

        ArgumentCaptor<UnitOfWorkListener> unitOfWorkListenerArgumentCaptor =
                ArgumentCaptor.forClass(UnitOfWorkListener.class);

        contactCommandHandler.handle(command, mockUnitOfWork);
View Full Code Here

    @EventHandler
    public void handleContactCreatedEvent(ContactCreatedEvent event) {
        logger.debug("Received a contact created event with name {} and identifier {}",
                     event.getName(), event.getContactId());
        ContactEntry value = new ContactEntry();
        value.setName(event.getName());
        value.setIdentifier(event.getContactId());
        Message<ContactEntry> message = new Message<ContactEntry>("contact-created", value);
        publisher.publish(message);
    }
View Full Code Here

    }

    @EventHandler
    public void handleContactRemovedEvent(ContactDeletedEvent event) {
        logger.debug("Contact removed event with identifier {}", event.getContactId());
        ContactEntry value = new ContactEntry();
        value.setIdentifier(event.getContactId());
        Message<ContactEntry> message = new Message<ContactEntry>("contact-removed", value);
        publisher.publish(message);
    }
View Full Code Here

    @EventHandler
    public void handleContactNameChangedEvent(ContactNameChangedEvent event) {
        logger.debug("Received a contact name changed event with new name {} and identifier {}",
                     event.getNewName(), event.getContactId());
        ContactEntry value = new ContactEntry();
        value.setIdentifier(event.getContactId());
        value.setName(event.getNewName());
        Message<ContactEntry> message = new Message<ContactEntry>("contact-changed", value);
        publisher.publish(message);
    }
View Full Code Here

    @EventHandler
    public void handleAddressCreatedEvent(AddressRegisteredEvent event) {
        logger.debug("Received a address created event with type {} for contactId {}",
                     event.getType().toString(), event.getContactId());
        ContactEntry contactEntry = obtainContactByIdentifier(event.getContactId());
        AddressEntry value = new AddressEntry();
        value.setIdentifier(event.getContactId());
        value.setName(contactEntry.getName());
        value.setAddressType(event.getType());
        value.setStreetAndNumber(event.getAddress().getStreetAndNumber());
        value.setZipCode(event.getAddress().getZipCode());
        value.setCity(event.getAddress().getCity());
        publisher.publish(new Message<AddressEntry>("address-created", value));
View Full Code Here

TOP

Related Classes of org.axonframework.sample.app.query.ContactEntry

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.