Package com.captechconsulting.core.domain

Examples of com.captechconsulting.core.domain.Ticket


    private MappingService mappingService;

    @RequestMapping(value = "/ticket/{ticketId}/scan/{locationId}", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    public LocationVO addLocationScan(@PathVariable long ticketId, @PathVariable long locationId) {
        Ticket ticket = ticketService.get(ticketId);
        Location location = ticketService.addLocationScan(ticket, locationId);
        return mappingService.map(location, LocationVO.class);
    }
View Full Code Here


        locationDao.save(location3);
        Location location4 = createLocation("Sorting Hub", createAddress("321 Other Street", "Some City", "123 89"));
        locationDao.save(location4);

        // Version 1 tickets (without email)
        Ticket ticket1 = createTicket("John", "Doe", null, "ab-123-12345", createAddress("123 Street", "City", "123 45"));
        Ticket ticket2 = createTicket("John", "Doe", null, "ab-123-12345", createAddress("123 Street", "City", "123 45"));

        // Version 2 tickets (with email)
        Ticket ticket3 = createTicket("John", "Doe", "john.doe@email.com", "cd-456-67890", createAddress("123 Street", "City", "123 45"));

        // Adding scans to Location 1
        ticket1.getLocationScans().add(createLocationScan(location1, new LocalDateTime().minusDays(35).toDate()));
        ticket1.getLocationScans().add(createLocationScan(location2, new LocalDateTime().minusDays(30).toDate()));
        ticket1.getLocationScans().add(createLocationScan(location3, new LocalDateTime().minusDays(25).toDate()));

        // Adding scans to Location 2
        ticket2.getLocationScans().add(createLocationScan(location1, new LocalDateTime().minusDays(5).toDate()));
        ticket2.getLocationScans().add(createLocationScan(location2, new LocalDateTime().minusDays(4).toDate()));

        // Adding scans to Location 3
        ticket3.getLocationScans().add(createLocationScan(location1, new LocalDateTime().minusDays(7).toDate()));
        ticket3.getLocationScans().add(createLocationScan(location2, new LocalDateTime().minusDays(3).toDate()));
        ticket3.getLocationScans().add(createLocationScan(location3, new LocalDateTime().minusDays(2).toDate()));
        ticket3.getLocationScans().add(createLocationScan(location4, new LocalDateTime().minusDays(1).toDate()));

        ticketDao.save(ticket1);
        ticketDao.save(ticket2);
        ticketDao.save(ticket3);
    }
View Full Code Here

        location.setAddress(address);
        return location;
    }

    private Ticket createTicket(String firstName, String lastName, String email, String packageNumber, Address address) {
        Ticket ticket = new Ticket();
        ticket.setFirstName(firstName);
        ticket.setLastName(lastName);
        ticket.setEmail(email);
        ticket.setPackageNumber(packageNumber);
        ticket.setAddress(address);
        return ticket;
    }
View Full Code Here

    @Autowired
    private LocationDao locationDao;

    public Ticket get(final long id) {
        Ticket ticket = ticketDao.findOne(id);
        if (ticket != null) {
            return ticket;
        }
        throw new ObjectRetrievalFailureException(Ticket.class, id);
    }
View Full Code Here

        return mappingService.map(tickets, TicketVO.class);
    }

    @RequestMapping(value = "/{ticketId}", method = RequestMethod.GET)
    public TicketVO read(@PathVariable long ticketId) {
        Ticket ticket = ticketService.get(ticketId);
        return mappingService.map(ticket, TicketVO.class);
    }
View Full Code Here

        return mappingService.map(ticket, TicketVO.class);
    }

    @RequestMapping(value = "/{ticketId}", method = RequestMethod.PATCH)
    public TicketVO update(@PathVariable long ticketId, @Valid @RequestBody TicketVO ticket) {
        Ticket previouslyPersisted = ticketService.get(ticketId);
        mappingService.map(ticket, previouslyPersisted);
        Ticket persisted = ticketService.store(previouslyPersisted);
        return mappingService.map(persisted, TicketVO.class);
    }
View Full Code Here

        return mappingService.map(persisted, TicketVO.class);
    }

    @RequestMapping(value = "/{ticketId}", method = RequestMethod.PUT)
    public TicketVO replace(@PathVariable long ticketId, @Valid @RequestBody TicketVO ticket) {
        Ticket previouslyPersisted = ticketService.get(ticketId);
        Ticket newTicket = mappingService.map(ticket, Ticket.class);
        newTicket.setId(previouslyPersisted.getId());
        Ticket persisted = ticketService.store(newTicket);
        return mappingService.map(persisted, TicketVO.class);
    }
View Full Code Here

    }

    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    public TicketVO create(@Valid @RequestBody TicketVO ticket) {
        Ticket mappedTicket = mappingService.map(ticket, Ticket.class);
        Ticket persisted = ticketService.store(mappedTicket);
        return mappingService.map(persisted, TicketVO.class);
    }
View Full Code Here

    }

    @RequestMapping(value = "/{ticketId}", method = RequestMethod.DELETE)
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void remove(@PathVariable long ticketId) {
        Ticket ticket = ticketService.get(ticketId);
        ticketService.delete(ticket);
    }
View Full Code Here

        return mappingService.map(tickets, TicketVO.class);
    }

    @RequestMapping(value = "/{ticketId}", method = RequestMethod.GET)
    public TicketVO read(@PathVariable long ticketId) {
        Ticket ticket = ticketService.get(ticketId);
        return mappingService.map(ticket, TicketVO.class);
    }
View Full Code Here

TOP

Related Classes of com.captechconsulting.core.domain.Ticket

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.