Package in.partake.model.daofacade

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

package in.partake.model.daofacade;

import in.partake.model.IPartakeDAOs;
import in.partake.model.dao.DAOException;
import in.partake.model.dao.PartakeConnection;
import in.partake.model.dto.UserImage;
import in.partake.model.dto.User;

import org.apache.commons.lang.StringUtils;

public class ImageDAOFacade {
    public static boolean checkImageOwner(PartakeConnection con, IPartakeDAOs daos, String imageId, User user) throws DAOException {
        // TODO: We don't need to get all image from DB.
        UserImage data = daos.getImageAccess().find(con, imageId);
        if (data == null)
            return false;

        return StringUtils.equals(user.getId(), data.getUserId());
    }
}
TOP

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

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.