Class SuggestedRevisionDAO

java.lang.Object
fr.paris.lutece.plugins.wiki.business.suggestedrevision.SuggestedRevisionDAO
All Implemented Interfaces:
ISuggestedRevisionDAO

@ApplicationScoped public class SuggestedRevisionDAO extends Object implements ISuggestedRevisionDAO
Data Access methods for SuggestedRevision objects.
  • Constructor Details

    • SuggestedRevisionDAO

      public SuggestedRevisionDAO()
  • Method Details

    • insert

      public void insert(SuggestedRevision suggestion, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Inserts a new suggestion.
      Specified by:
      insert in interface ISuggestedRevisionDAO
      Parameters:
      suggestion - the suggestion to persist
      plugin - the wiki plugin
    • updateStatus

      public void updateStatus(SuggestedRevision suggestion, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Updates the status, reviewer and review comment of a suggestion.
      Specified by:
      updateStatus in interface ISuggestedRevisionDAO
      Parameters:
      suggestion - the suggestion to update
      plugin - the wiki plugin
    • delete

      public void delete(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Removes a suggestion by primary key.
      Specified by:
      delete in interface ISuggestedRevisionDAO
      Parameters:
      nKey - the suggestion id
      plugin - the wiki plugin
    • load

      public Optional<SuggestedRevision> load(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Loads a suggestion by primary key.
      Specified by:
      load in interface ISuggestedRevisionDAO
      Parameters:
      nKey - the suggestion id
      plugin - the wiki plugin
      Returns:
      the suggestion if found
    • selectAllPending

      public List<SuggestedRevision> selectAllPending(fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Returns every pending suggestion, ordered by creation date desc.
      Specified by:
      selectAllPending in interface ISuggestedRevisionDAO
      Parameters:
      plugin - the wiki plugin
      Returns:
      all pending suggestions
    • selectByAuthor

      public List<SuggestedRevision> selectByAuthor(String strAuthorGuid, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Returns the suggestions submitted by the given author, ordered by creation date desc.
      Specified by:
      selectByAuthor in interface ISuggestedRevisionDAO
      Parameters:
      strAuthorGuid - the proposer's user guid
      plugin - the wiki plugin
      Returns:
      the suggestions submitted by this author
    • selectPendingByEntityAndAuthor

      public Optional<SuggestedRevision> selectPendingByEntityAndAuthor(int nEntityId, String strAuthorGuid, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Returns the pending suggestion from a given author on a given entity, if any.
      Specified by:
      selectPendingByEntityAndAuthor in interface ISuggestedRevisionDAO
      Parameters:
      nEntityId - the wiki item id
      strAuthorGuid - the proposer's user guid
      plugin - the wiki plugin
      Returns:
      the pending suggestion if exists
    • countPendingByEntities

      public Map<Integer,Integer> countPendingByEntities(List<Integer> entityIds, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Counts pending suggestions for a batch of entities in a single query. Entities with no pending suggestion are absent from the result.
      Specified by:
      countPendingByEntities in interface ISuggestedRevisionDAO
      Parameters:
      entityIds - the entity ids to count for
      plugin - the wiki plugin
      Returns:
      a map of entity id to pending count
    • countPendingByEntity

      public int countPendingByEntity(int nEntityId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Counts pending suggestions for a single entity.
      Specified by:
      countPendingByEntity in interface ISuggestedRevisionDAO
      Parameters:
      nEntityId - the entity id
      plugin - the wiki plugin
      Returns:
      the number of pending suggestions on this entity