Class Collection<T>

    • Constructor Detail

      • Collection

        public Collection​(com.mongodb.client.MongoDatabase mongoDatabase,
                          String collectionName,
                          Class<T> entityClass,
                          boolean filtered)
        Parameters:
        mongoDatabase -
        collectionName - the name of the mongo collection
        entityClass - the
        filtered - if the Collection is subject to context filtering i.e. if the context parameters delivered by the ObjectFilters of the ObjectHookRegistry may be appended to the queries run against this collection
    • Method Detail

      • isFiltered

        public boolean isFiltered()
        Returns:
        true if the filter defined by the ObjectFilter of the ObjectHookRegistry have to be applied when performing a search
      • distinct

        public List<String> distinct​(String columnName,
                                     org.bson.conversions.Bson query)
        Parameters:
        columnName - the name of the column (field)
        query - : the query filter
        Returns:
        the distinct values of the column
      • distinct

        public List<String> distinct​(String columnName)
        Parameters:
        columnName - the name of the column (field)
        Returns:
        the distinct values of the column
      • getAdditionalQueryFragments

        public List<org.bson.conversions.Bson> getAdditionalQueryFragments​(javax.json.JsonObject queryParameters)
        Parameters:
        queryParameters - some context parameters that might be required to generate the additional query fragments
        Returns:
        a list of query fragments to be appended to the queries when calling the method find()
      • getQueryFragmentForColumnSearch

        public org.bson.conversions.Bson getQueryFragmentForColumnSearch​(String columnName,
                                                                         String searchValue)
        Parameters:
        columnName - the name of the column on which the search is applied
        searchValue - the value entered by the end user
        Returns:
        a list of query fragments to be appended to the queries when performing a column search
      • getEntityClass

        public Class<?> getEntityClass()
      • enrichEntity

        protected T enrichEntity​(T element)
        This hook can be called for each element returned by the find() methods and allows enrichment of the returned objects
        Parameters:
        element - the element to be modified
        Returns:
        the modified element
      • export

        public void export​(org.bson.conversions.Bson query,
                           Map<String,​CollectionField> columns,
                           PrintWriter writer)
        Export data to CSV
        Parameters:
        query -
        columns -
        writer -