Examples of IEventAccess


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

        // Create 20 events here.
        new Transaction<Void>() {
            @Override
            protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
                IEventAccess dao = daos.getEventAccess();
                dao.truncate(con);

                for (int i = 0; i < N; ++i) {
                    dao.put(con, new Event(ids.get(i), "title", "summary", "category",
                            new DateTime(i), null, "url", "place",
                            "address", "description", "#hashTag", TestDataProvider.EVENT_OWNER_ID,
                            null, null, null, false,
                            Collections.singletonList(TestDataProvider.EVENT_EDITOR_ID), new ArrayList<String>(), null,
                            new DateTime(i), new DateTime(i), -1));
View Full Code Here

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

        array.add(new Event("id", "title", "summary", "category", new DateTime(0), new DateTime(0), "url", "place", "address", "description", "hashTag", "ownerId", "foreImageId", "backImageId", "passcode", false, new ArrayList<String>(), new ArrayList<String>(), null, new DateTime(0), new DateTime(0), 1));
        return array;
    }

    public void createFixtures(PartakeConnection con, IPartakeDAOs daos) throws DAOException {
        IEventAccess dao = daos.getEventAccess();
        dao.truncate(con);

        DateTime now = TimeUtil.getCurrentDateTime();
        DateTime late = now.nDayAfter(1);
        String category = EventCategory.getCategories().get(0).getKey();

        dao.put(con, new Event(DEFAULT_EVENT_ID, "title", "summary", category,
                late, late, "http://www.example.com/", "place",
                "address", "description", "#hashTag", EVENT_OWNER_ID,
                EVENT_FOREIMAGE_ID, EVENT_BACKIMAGE_ID, null, false,
                Collections.singletonList(EVENT_EDITOR_ID), new ArrayList<String>(), null,
                now, now, -1));

        dao.put(con, new Event(PRIVATE_EVENT_ID, "title", "summary", category,
                late, late, "http://www.example.com/", "place",
                "address", "description", "#hashTag", EVENT_OWNER_ID,
                EVENT_FOREIMAGE_ID, EVENT_BACKIMAGE_ID, "passcode", false,
                Collections.singletonList(EVENT_EDITOR_ID), new ArrayList<String>(), null,
                now, now, -1));

        dao.put(con, new Event(JAPANESE_EVENT_ID, "title", "summary", category,
                late, late, "http://www.example.com/", "place",
                "address", "unique identifier -- " + JAPANESE_IDENTIFIER, "#hashTag", EVENT_OWNER_ID,
                EVENT_FOREIMAGE_ID, EVENT_BACKIMAGE_ID, null, false,
                Collections.singletonList(EVENT_EDITOR_ID), new ArrayList<String>(), null,
                now, now, -1));

        dao.put(con, new Event(UNIQUEIDENTIFIER_EVENT_ID, "title", "summary", category,
                late, late, "http://www.example.com/", "place",
                "address", "unique identifier -- " + UNIQUE_IDENTIFIER, "#hashTag", EVENT_OWNER_ID,
                EVENT_FOREIMAGE_ID, EVENT_BACKIMAGE_ID, null, false,
                Collections.singletonList(EVENT_EDITOR_ID), new ArrayList<String>(), null,
                now, now, -1));

        dao.put(con, new Event(UNPUBLISHED_EVENT_ID, "title", "summary", category,
                late, late, "http://www.example.com/", "place",
                "address", "description", "#hashTag", EVENT_OWNER_ID,
                EVENT_FOREIMAGE_ID, EVENT_BACKIMAGE_ID, null, true,
                Collections.singletonList(EVENT_EDITOR_ID), new ArrayList<String>(), null,
                now, now, -1));

        dao.put(con, new Event(PUBLISHED_EVENT_ID, "title", "summary", category,
                late, late, "http://www.example.com/", "place",
                "address", "description", "#hashTag", EVENT_OWNER_ID,
                EVENT_FOREIMAGE_ID, EVENT_BACKIMAGE_ID, null, false,
                Collections.singletonList(EVENT_EDITOR_ID), new ArrayList<String>(), null,
                now, now, -1));

        dao.put(con, new Event(NO_PARTICIPANTS_EVENT_ID, "title", "summary", category,
                late, late, "http://www.example.com/", "place",
                "address", "description", "#hashTag", EVENT_OWNER_ID,
                EVENT_FOREIMAGE_ID, EVENT_BACKIMAGE_ID, null, true,
                Collections.singletonList(EVENT_EDITOR_ID), new ArrayList<String>(), null,
                now, now, -1));
View Full Code Here

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

        // Create 20 events here.
        new Transaction<Void>() {
            @Override
            protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
                IEventAccess dao = daos.getEventAccess();
                dao.truncate(con);

                for (int i = 0; i < N; ++i) {
                    boolean isPrivate = i % 8 == 0;
                    boolean draft = i % 8 == 1;
                    dao.put(con, new Event(ids.get(i), "title", "summary", "category",
                            new DateTime(i), null, "url", "place",
                            "address", "description", "#hashTag", TestDataProvider.EVENT_OWNER_ID,
                            null, null, isPrivate ? "passcode" : null, draft,
                            Collections.singletonList(TestDataProvider.EVENT_EDITOR_ID), new ArrayList<String>(), null,
                            new DateTime(i), new DateTime(i), -1));
View Full Code Here

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

        return null;
    }

    private void getEventsFromDB(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IEventAccess eventDao = daos.getEventAccess();

        if ("owner".equalsIgnoreCase(queryType)) {
            this.numTotalEvents = eventDao.countEventsByOwnerId(con, user.getId(), EventFilterCondition.PUBLISHED_EVENT_ONLY);
            this.eventsRetrieved = eventDao.findByOwnerId(con, user.getId(), EventFilterCondition.PUBLISHED_EVENT_ONLY, offset, limit);
        } else if ("draft".equalsIgnoreCase(queryType)) {
            this.numTotalEvents = eventDao.countEventsByOwnerId(con, user.getId(), EventFilterCondition.DRAFT_EVENT_ONLY);
            this.eventsRetrieved = eventDao.findByOwnerId(con, user.getId(), EventFilterCondition.DRAFT_EVENT_ONLY, offset, limit);
        } else if ("editor".equalsIgnoreCase(queryType)) {
            this.numTotalEvents = eventDao.countByEditorUserId(con, user.getId(), EventFilterCondition.PUBLISHED_EVENT_ONLY);
            this.eventsRetrieved = eventDao.findByEditorUserId(con, user.getId(), EventFilterCondition.PUBLISHED_EVENT_ONLY, offset, limit);
        } else if ("upcomingManaging".equalsIgnoreCase(queryType)) {
            // TODO(mayah): This is work around ugly patch. Maybe we should have sortType besides queryType?
            this.numTotalEvents = eventDao.countEventsByOwnerIdAndEditorId(con, user.getId(), EventFilterCondition.UPCOMING_EVENT_ONLY);
            this.eventsRetrieved = eventDao.findByOwnerIdAndEditorId(con, user.getId(), EventFilterCondition.UPCOMING_EVENT_ONLY);

            // Sort by beginDate.
            Collections.sort(this.eventsRetrieved, new Comparator<Event>() {
                @Override
                public int compare(Event e1, Event e2) {
View Full Code Here

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

     * @param calendar
     * @throws DAOException
     */
    // TODO: Consider the method name again.
    public static void addCalendarByCategoryName(PartakeConnection con, IPartakeDAOs daos, String categoryName, Calendar calendar) throws DAOException {
        IEventAccess dao = daos.getEventAccess();

        DataIterator<Event> it = dao.getIterator(con, EventFilterCondition.PUBLISHED_PUBLIC_EVENT_ONLY);
        try {
            while (it.hasNext()) {
                Event event = it.next();
                assert event != null;
                if (event == null)
View Full Code Here

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

        this.eventId = eventId;
    }

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IEventAccess dao = daos.getEventAccess();

        Event event = dao.find(con, eventId);
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_EVENT_ID);

        if (!EventRemovePermission.check(event, user))
            throw new PartakeException(UserErrorCode.FORBIDDEN_EVENT_EDIT);

        dao.remove(con, event.getId());
        return null;
    }
View Full Code Here

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

        return null;
    }

    private void getEventsFromDB(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IEventAccess eventDao = daos.getEventAccess();

        if ("owner".equalsIgnoreCase(queryType)) {
            this.numTotalEvents = eventDao.countEventsByOwnerId(con, user.getId(), EventFilterCondition.PUBLISHED_PUBLIC_EVENT_ONLY);
            this.eventsRetrieved = eventDao.findByOwnerId(con, user.getId(), EventFilterCondition.PUBLISHED_PUBLIC_EVENT_ONLY, offset, limit);
        } else if ("editor".equalsIgnoreCase(queryType)) {
            this.numTotalEvents = eventDao.countByEditorUserId(con, user.getId(), EventFilterCondition.PUBLISHED_PUBLIC_EVENT_ONLY);
            this.eventsRetrieved = eventDao.findByEditorUserId(con, user.getId(), EventFilterCondition.PUBLISHED_PUBLIC_EVENT_ONLY, offset, limit);
        } else {
            throw new PartakeException(UserErrorCode.INVALID_ARGUMENT);
        }
    }
View Full Code Here

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

    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        EventTicket ticket = daos.getEventTicketAccess().find(con, ticketId);
        if (ticket == null)
            throw new PartakeException(UserErrorCode.INVALID_TICKET_ID);

        IEventAccess eventDao = daos.getEventAccess();
        Event event = eventDao.find(con, ticket.getEventId());
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_TICKET_ID);

        if (!EventEditParticipantsPermission.check(event, user))
            throw new PartakeException(UserErrorCode.FORBIDDEN_EVENT_ATTENDANT_EDIT);
View Full Code Here

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

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IUserAccess userAccess = daos.getUserAccess();
        countUser = userAccess.count(con);

        IEventAccess eventAccess = daos.getEventAccess();
        countEvent = eventAccess.count(con);
        countPublicEvent = eventAccess.count(con, EventFilterCondition.PUBLIC_EVENT_ONLY);
        countPrivateEvent = eventAccess.count(con, EventFilterCondition.PRIVATE_EVENT_ONLY);
        countDraftEvent = eventAccess.count(con, EventFilterCondition.DRAFT_EVENT_ONLY);
        countPublishedEvent = eventAccess.count(con, EventFilterCondition.PUBLISHED_EVENT_ONLY);

        configurationMap = new HashMap<String, String>();
        for (String key : ConfigurationKeyConstants.configurationkeySet) {
            ConfigurationItem item = daos.getConfiguraitonItemAccess().find(con, key);
            if (item != null)
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.