org.zeroexchange.dao.resource
Class ResourceTenderDAOImpl<T extends ResourceTender>

java.lang.Object
  extended by org.zeroexchange.dao.HibernateSessionHolder
      extended by org.zeroexchange.dao.BaseHibernateDAO<Integer,T>
          extended by org.zeroexchange.dao.BaseIntegerPKDAO<T>
              extended by org.zeroexchange.dao.resource.ResourceTenderDAOImpl<T>
All Implemented Interfaces:
DAO<Integer,T>, IntegerPKDAO<T>, ResourceTenderDAO<T>
Direct Known Subclasses:
NeedDAOImpl, SupplyDAOImpl

public abstract class ResourceTenderDAOImpl<T extends ResourceTender>
extends BaseIntegerPKDAO<T>
implements ResourceTenderDAO<T>

Author:
black

Nested Class Summary
protected  class ResourceTenderDAOImpl.TendersDataSet
           
 
Constructor Summary
ResourceTenderDAOImpl()
           
 
Method Summary
 T getFirstAcceptedTender(Integer resourceId)
          Returns accepted tender (if any) of the specified type.
 T getFirstAcceptedTender(Integer resourceId, Integer userId)
          Returns accepted tender (if any) owned by the specified user.
 Long getTotalTenders(Resource resource, User excludedUser)
          
 T getUserTender(Integer userId, Integer resourceId)
          Returns the tender for the specified resource and user.
 Long getVisitedTendersCount(Resource resource, User user)
          Returns number of unvisited tenders.
 boolean isUserHasTender(Integer resourceId, Integer userId, Boolean isAccepted)
          Returns true if the user have the tenders for the specified resource.
 void remove(Integer userId, Integer resourceId)
          Removes tender by its user and resource.
 
Methods inherited from class org.zeroexchange.dao.BaseHibernateDAO
getById, getEntityClass, removeById, save
 
Methods inherited from class org.zeroexchange.dao.HibernateSessionHolder
getSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zeroexchange.dao.DAO
getById, removeById, save
 

Constructor Detail

ResourceTenderDAOImpl

public ResourceTenderDAOImpl()
Method Detail

isUserHasTender

public boolean isUserHasTender(Integer resourceId,
                               Integer userId,
                               Boolean isAccepted)
Returns true if the user have the tenders for the specified resource. If isAccepted is not null, the method considers wether tender is accepted.

Specified by:
isUserHasTender in interface ResourceTenderDAO<T extends ResourceTender>

getFirstAcceptedTender

public T getFirstAcceptedTender(Integer resourceId,
                                Integer userId)
Returns accepted tender (if any) owned by the specified user.

Specified by:
getFirstAcceptedTender in interface ResourceTenderDAO<T extends ResourceTender>

getFirstAcceptedTender

public T getFirstAcceptedTender(Integer resourceId)
Returns accepted tender (if any) of the specified type.

Specified by:
getFirstAcceptedTender in interface ResourceTenderDAO<T extends ResourceTender>

getUserTender

public T getUserTender(Integer userId,
                       Integer resourceId)
Returns the tender for the specified resource and user.

Specified by:
getUserTender in interface ResourceTenderDAO<T extends ResourceTender>

remove

public void remove(Integer userId,
                   Integer resourceId)
Removes tender by its user and resource.

Specified by:
remove in interface ResourceTenderDAO<T extends ResourceTender>

getVisitedTendersCount

public Long getVisitedTendersCount(Resource resource,
                                   User user)
Returns number of unvisited tenders.

Specified by:
getVisitedTendersCount in interface ResourceTenderDAO<T extends ResourceTender>
user - TODO

getTotalTenders

public Long getTotalTenders(Resource resource,
                            User excludedUser)

Specified by:
getTotalTenders in interface ResourceTenderDAO<T extends ResourceTender>


Copyright © 2013. All Rights Reserved.