Package in.partake.model.daofacade

Source Code of in.partake.model.daofacade.UserDAOFacade

package in.partake.model.daofacade;

import in.partake.model.IPartakeDAOs;
import in.partake.model.UserEx;
import in.partake.model.dao.DAOException;
import in.partake.model.dao.PartakeConnection;
import in.partake.model.dao.access.IUserAccess;
import in.partake.model.dao.access.IUserTwitterLinkAccess;
import in.partake.model.dto.User;
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;
    }

    public static UserEx getUserEx(PartakeConnection con, IPartakeDAOs daos, String userId) throws DAOException {
        IUserAccess userAccess = daos.getUserAccess();
        IUserTwitterLinkAccess twitterDAO = daos.getTwitterLinkageAccess();

        User user = userAccess.find(con, userId);
        if (user == null) { return null; }

        UserTwitterLink linkage = twitterDAO.findByUserId(con, userId);
        return new UserEx(user, linkage);
    }

}
TOP

Related Classes of in.partake.model.daofacade.UserDAOFacade

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.