Examples of IUserTicketAccess


Examples of in.partake.model.dao.access.IUserTicketAccess

        array.add(new UserTicket("id", "userId", new UUID(0, 0), "comment", "eventId", ParticipationStatus.ENROLLED, ModificationStatus.ENROLLED, AttendanceStatus.PRESENT, null, new DateTime(0L), new DateTime(0L), new DateTime(0L)));
        return array;
    }

    public void createFixtures(PartakeConnection con, IPartakeDAOs daos) throws DAOException {
        IUserTicketAccess dao = daos.getEnrollmentAccess();

        dao.truncate(con);
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                EVENT_ENROLLED_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.ENROLLED,
                ModificationStatus.CHANGED, AttendanceStatus.PRESENT, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                EVENT_RESERVED_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.RESERVED,
                ModificationStatus.CHANGED, AttendanceStatus.PRESENT, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                EVENT_CANCELLED_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.CANCELLED,
                ModificationStatus.CHANGED, AttendanceStatus.PRESENT, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));

        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                ATTENDANCE_PRESENT_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.ENROLLED,
                ModificationStatus.CHANGED, AttendanceStatus.PRESENT, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                ATTENDANCE_ABSENT_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.ENROLLED,
                ModificationStatus.CHANGED, AttendanceStatus.ABSENT, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                ATTENDANCE_UNKNOWN_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.ENROLLED,
                ModificationStatus.CHANGED, AttendanceStatus.UNKNOWN, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));

        // Enrollment for private event
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                EVENT_ENROLLED_USER_ID, PRIVATE_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.ENROLLED,
                ModificationStatus.CHANGED, AttendanceStatus.PRESENT, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));
    }
View Full Code Here

Examples of in.partake.model.dao.access.IUserTicketAccess

        updateAttendanceStatus(con, daos);
        return null;
    }

    private void updateAttendanceStatus(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IUserTicketAccess enrollmentAccess = daos.getEnrollmentAccess();

        // We have already checked the event exists, so when no enrollment is found, we throw an "invalid user id"
        // exception here.
        UserTicket enrollment = enrollmentAccess.findByTicketIdAndUserId(con, ticketId, userId);
        if (enrollment == null)
            throw new PartakeException(UserErrorCode.INVALID_USER_ID);

        UserTicket newEnrollment = new UserTicket(enrollment);
        newEnrollment.setAttendanceStatus(status);
        enrollmentAccess.put(con, newEnrollment);
    }
View Full Code Here

Examples of in.partake.model.dao.access.IUserTicketAccess

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        getEventsFromDB(con, daos);

        IUserTicketAccess enrollmentAccess = daos.getEnrollmentAccess();

        this.eventStatuses = new ArrayList<EventStatus>();
        for (Event event : eventsRetrieved) {
            if (event == null)
                continue;

            List<EventTicket> tickets = daos.getEventTicketAccess().findEventTicketsByEventId(con, event.getId());
            boolean isBeforeDeadline = event.acceptsSomeTicketsTill(tickets).isBefore(TimeUtil.getCurrentDateTime());
            int numEnrolledUsers = enrollmentAccess.countByEventId(con, event.getId(), ParticipationStatus.ENROLLED);
            int numReservedUsers = enrollmentAccess.countByEventId(con, event.getId(), ParticipationStatus.RESERVED);
            int numCancelledUsers = enrollmentAccess.countByEventId(con, event.getId(), ParticipationStatus.CANCELLED);

            int amount = 0;
            boolean isAmountInfinite = false;
            for (EventTicket ticket : tickets) {
                isAmountInfinite |= ticket.isAmountInfinite();
View Full Code Here

Examples of in.partake.model.dao.access.IUserTicketAccess

        else
            return doAllQuery(con, daos);
    }

    private Void doAllQuery(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IUserTicketAccess enrollmentAccess = daos.getEnrollmentAccess();
        List<UserTicket> enrollments = enrollmentAccess.findByUserId(con, userId, offset, limit);
        this.numTotalTickets = enrollmentAccess.countByUserId(con, userId);

        for (UserTicket enrollment : enrollments) {
            if (enrollment == null)
                continue;
View Full Code Here

Examples of in.partake.model.dao.access.IUserTicketAccess

        return null;
    }

    // TODO(mayah): too slow. Actually this should be done in DB.
    private Void doUpcomingQuery(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IUserTicketAccess dao = daos.getEnrollmentAccess();

        DateTime now = TimeUtil.getCurrentDateTime();

        List<UserTicket> rawTickets = dao.findByUserId(con, userId, 0, Integer.MAX_VALUE);
        List<Pair<UserTicket, Event>> filtered = new ArrayList<Pair<UserTicket, Event>>();

        for (UserTicket userTicket : rawTickets) {
            if (userTicket == null)
                continue;
View Full Code Here

Examples of in.partake.model.dao.access.IUserTicketAccess

        this.statuses = new ArrayList<TicketAndStatus>();
    }

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IUserTicketAccess enrollmentAccess = daos.getEnrollmentAccess();
        List<UserTicket> enrollments = enrollmentAccess.findByUserId(con, userId, offset, limit);

        this.totalTicketCount = enrollmentAccess.countByUserId(con, userId);

        for (UserTicket enrollment : enrollments) {
            if (enrollment == null)
                continue;
View Full Code Here

Examples of in.partake.model.dao.access.IUserTicketAccess

        user = UserDAOFacade.getUserEx(con, daos, userId);

        getEventsFromDB(con, daos);

        IUserTicketAccess enrollmentAccess = daos.getEnrollmentAccess();
        this.eventStatuses = new ArrayList<EventStatus>();
        for (Event event : eventsRetrieved) {
            if (event == null)
                continue;

            List<EventTicket> tickets = daos.getEventTicketAccess().findEventTicketsByEventId(con, event.getId());
            boolean isBeforeDeadline = event.acceptsSomeTicketsTill(tickets).isBefore(TimeUtil.getCurrentDateTime());
            int numEnrolledUsers = enrollmentAccess.countByEventId(con, event.getId(), ParticipationStatus.ENROLLED);
            int numReservedUsers = enrollmentAccess.countByEventId(con, event.getId(), ParticipationStatus.RESERVED);
            int numCancelledUsers = enrollmentAccess.countByEventId(con, event.getId(), ParticipationStatus.CANCELLED);

            int amount = 0;
            boolean isAmountInfinite = false;
            for (EventTicket ticket : tickets) {
                isAmountInfinite |= ticket.isAmountInfinite();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.