Package in.partake.model.dto

Examples of in.partake.model.dto.UserPreference


import in.partake.model.dto.UserPreference;
import in.partake.model.dto.UserTwitterLink;

public class UserDAOFacade extends AbstractPartakeDAOFacade {
    public static UserPreference getPreference(PartakeConnection con, IPartakeDAOs daos, String userId) throws DAOException {
        UserPreference pref = daos.getUserPreferenceAccess().find(con, userId);
        if (pref == null)
            pref = UserPreference.getDefaultPreference(userId);
        return pref;
    }
View Full Code Here


    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        if (!daos.getUserAccess().exists(con, userId))
            throw new PartakeException(UserErrorCode.INVALID_USER_ID);

        // If |user| does not publish their events, return immediately.
        UserPreference pref = daos.getUserPreferenceAccess().find(con, userId);
        if (pref == null)
            pref = UserPreference.getDefaultPreference(userId);
        if (!pref.isProfilePublic())
            throw new PartakeException(UserErrorCode.INVALID_USER_PRIVATE);

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

        getEventsFromDB(con, daos);
View Full Code Here

        List<UserTicket> participations = daos.getEnrollmentAccess().findByEventId(con, eventId, 0, Integer.MAX_VALUE);
        for (UserTicket participation : participations) {
            if (!participation.getStatus().isEnrolled())
                continue;

            UserPreference pref = daos.getUserPreferenceAccess().find(con, participation.getUserId());
            if (pref == null)
                pref = UserPreference.getDefaultPreference(participation.getUserId());

            MessageDelivery delivery = pref.isReceivingTwitterMessage() ? MessageDelivery.INQUEUE : MessageDelivery.NOT_DELIVERED;

            UUID userMessageId = daos.getUserReceivedMessageAccess().getFreshId(con);
            UserReceivedMessage userMessage = new UserReceivedMessage(userMessageId, sender.getId(), participation.getUserId(), eventId, messageId.toString(),
                    false, delivery, null, null, TimeUtil.getCurrentDateTime(), null);
            daos.getUserReceivedMessageAccess().put(con, userMessage);
View Full Code Here

import in.partake.model.dao.postgres9.Postgres9EntityDataMapper;
import in.partake.model.dto.UserPreference;

class EntityUserPreferenceMapper extends Postgres9EntityDataMapper<UserPreference> {
    public UserPreference map(ObjectNode obj) {
        return new UserPreference(obj).freeze();
    }
View Full Code Here

    /**
     * Updates UserPreference. Null arguments won't be updated.
     */
    public Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        final UserPreference pref = daos.getUserPreferenceAccess().find(con, user.getId());
        UserPreference newPref = new UserPreference(pref != null ? pref : UserPreference.getDefaultPreference(user.getId()));

        if (profilePublic != null)
            newPref.setProfilePublic(profilePublic);
        if (receivingTwitterMessage != null)
            newPref.setReceivingTwitterMessage(receivingTwitterMessage);
        if (tweetingAttendanceAutomatically != null)
            newPref.setTweetingAttendanceAutomatically(tweetingAttendanceAutomatically);

        daos.getUserPreferenceAccess().put(con, newPref);
        return null;
    }
View Full Code Here

TOP

Related Classes of in.partake.model.dto.UserPreference

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.