Package fr.openwide.maven.artifact.notifier.core.business.artifact.dao

Source Code of fr.openwide.maven.artifact.notifier.core.business.artifact.dao.FollowedArtifactDaoImpl

package fr.openwide.maven.artifact.notifier.core.business.artifact.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.mysema.query.jpa.impl.JPAQuery;

import fr.openwide.core.jpa.business.generic.dao.GenericEntityDaoImpl;
import fr.openwide.maven.artifact.notifier.core.business.artifact.model.Artifact;
import fr.openwide.maven.artifact.notifier.core.business.artifact.model.FollowedArtifact;
import fr.openwide.maven.artifact.notifier.core.business.user.model.QUser;
import fr.openwide.maven.artifact.notifier.core.business.user.model.User;

@Repository("followedArtifactDao")
public class FollowedArtifactDaoImpl extends GenericEntityDaoImpl<Long, FollowedArtifact> implements IFollowedArtifactDao {
 
  private static final QUser qUser = QUser.user;
 
  @Override
  public List<User> listFollowers(Artifact artifact) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qUser)
      .where(qUser.followedArtifacts.any().artifact.eq(artifact));
   
    return query.list(qUser);
  }
}
TOP

Related Classes of fr.openwide.maven.artifact.notifier.core.business.artifact.dao.FollowedArtifactDaoImpl

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.