Class SuggestedRevisionHome

java.lang.Object
fr.paris.lutece.plugins.wiki.business.suggestedrevision.SuggestedRevisionHome

public final class SuggestedRevisionHome extends Object
Static facade for SuggestedRevision persistence.
  • Method Details

    • create

      public static SuggestedRevision create(SuggestedRevision suggestion)
      Persists a new suggestion.
      Parameters:
      suggestion - the suggestion to persist
      Returns:
      the persisted suggestion (with its generated id)
    • updateStatus

      public static SuggestedRevision updateStatus(SuggestedRevision suggestion)
      Updates the status, reviewer and review comment of an existing suggestion.
      Parameters:
      suggestion - the suggestion to update
      Returns:
      the updated suggestion
    • remove

      public static void remove(int nKey)
      Removes a suggestion by primary key.
      Parameters:
      nKey - the suggestion id
    • findByPrimaryKey

      public static SuggestedRevision findByPrimaryKey(int nKey)
      Loads a suggestion by its primary key.
      Parameters:
      nKey - the suggestion id
      Returns:
      the suggestion or null
    • countPendingByEntity

      public static int countPendingByEntity(int nEntityId)
      Counts the pending suggestions on a single entity.
      Parameters:
      nEntityId - the entity id
      Returns:
      the count
    • countPendingByEntities

      public static Map<Integer,Integer> countPendingByEntities(List<Integer> entityIds)
      Counts pending suggestions for a batch of entities in a single query.
      Parameters:
      entityIds - the entity ids
      Returns:
      a map of entity id to pending count (entities with no pending suggestion are absent)
    • getAllPending

      public static List<SuggestedRevision> getAllPending()
      Returns all pending suggestions across the wiki.
      Returns:
      every pending suggestion
    • getByAuthor

      public static List<SuggestedRevision> getByAuthor(String strAuthorGuid)
      Returns the suggestions submitted by the given author.
      Parameters:
      strAuthorGuid - the proposer's user guid
      Returns:
      the suggestions submitted by this author
    • getPendingByEntityAndAuthor

      public static Optional<SuggestedRevision> getPendingByEntityAndAuthor(int nEntityId, String strAuthorGuid)
      Returns the pending suggestion from a given author on a given entity, if any.
      Parameters:
      nEntityId - the wiki item id
      strAuthorGuid - the proposer's user guid
      Returns:
      the pending suggestion if exists