Class ModelUtil


  • public class ModelUtil
    extends java.lang.Object
    Model related utility functions.
    Since:
    3.5
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.Object> buildPaging​(int totalItems, int maxItems, int skipCount)
      Returns representation of paging object
      static java.util.Map<java.lang.String,​java.lang.Object> buildPaging​(int totalItems, int maxItems, int skipCount, ScriptPagingDetails.ItemsSizeConfidence confidence, int totalItemsRangeEnd)
      Returns representation of paging object
      static java.util.Map<java.lang.String,​java.lang.Object> buildPaging​(ScriptPagingDetails paging)
      Returns representation of paging object
      static java.lang.String getProductName​(RepoAdminService repoAdminService)
      Returns the name of the product currently running, determined by the current license.
      static <T> java.util.List<T> page​(java.util.Collection<T> objects, int maxItems, int skipCount)  
      static <T> java.util.List<T> page​(java.util.Collection<T> objects, ScriptPagingDetails paging)  
      static <T> T[] page​(T[] objects, int maxItems, int skipCount)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PAGING_MAX_ITEMS

        public static final java.lang.String PAGING_MAX_ITEMS
        See Also:
        Constant Field Values
      • PAGING_SKIP_COUNT

        public static final java.lang.String PAGING_SKIP_COUNT
        See Also:
        Constant Field Values
      • PAGING_TOTAL_ITEMS

        public static final java.lang.String PAGING_TOTAL_ITEMS
        See Also:
        Constant Field Values
      • PAGING_TOTAL_ITEMS_RANGE_END

        public static final java.lang.String PAGING_TOTAL_ITEMS_RANGE_END
        See Also:
        Constant Field Values
      • PAGING_CONFIDENCE

        public static final java.lang.String PAGING_CONFIDENCE
        See Also:
        Constant Field Values
    • Constructor Detail

      • ModelUtil

        public ModelUtil()
    • Method Detail

      • getProductName

        public static java.lang.String getProductName​(RepoAdminService repoAdminService)
        Returns the name of the product currently running, determined by the current license.
        Parameters:
        repoAdminService - The RepoAdminService
        Returns:
        "Share" or "Team"
      • buildPaging

        public static java.util.Map<java.lang.String,​java.lang.Object> buildPaging​(int totalItems,
                                                                                         int maxItems,
                                                                                         int skipCount,
                                                                                         ScriptPagingDetails.ItemsSizeConfidence confidence,
                                                                                         int totalItemsRangeEnd)
        Returns representation of paging object
        Parameters:
        totalItems - all count of object
        maxItems - max count of object that should be returned
        skipCount - count of skipped objects
        confidence - the confidence in the total, default is exact
        totalItemsRangeEnd - if the total is a range, what is the upper end of it
        Returns:
        A model map of the details
      • buildPaging

        public static java.util.Map<java.lang.String,​java.lang.Object> buildPaging​(int totalItems,
                                                                                         int maxItems,
                                                                                         int skipCount)
        Returns representation of paging object
        Parameters:
        totalItems - all count of object
        maxItems - max count of object that should be returned
        skipCount - count of skipped objects
        Returns:
        A model map of the details
      • buildPaging

        public static java.util.Map<java.lang.String,​java.lang.Object> buildPaging​(ScriptPagingDetails paging)
        Returns representation of paging object
        Parameters:
        paging - The paging object with total, skip, max etc
      • page

        public static <T> java.util.List<T> page​(java.util.Collection<T> objects,
                                                 int maxItems,
                                                 int skipCount)
      • page

        public static <T> java.util.List<T> page​(java.util.Collection<T> objects,
                                                 ScriptPagingDetails paging)
      • page

        public static <T> T[] page​(T[] objects,
                                   int maxItems,
                                   int skipCount)