Package step.core.accessors.collections
Class Collection<T>
- java.lang.Object
-
- step.core.accessors.collections.Collection<T>
-
- Direct Known Subclasses:
ExecutionCollection
,ParameterCollection
,PlanCollection
,ReportNodeCollection
public class Collection<T> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
CSV_DELIMITER
-
Constructor Summary
Constructors Constructor Description Collection(com.mongodb.client.MongoDatabase mongoDatabase, String collectionName, Class<T> entityClass, boolean filtered)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
distinct(String columnName)
List<String>
distinct(String columnName, org.bson.conversions.Bson query)
protected T
enrichEntity(T element)
This hook can be called for each element returned by the find() methods and allows enrichment of the returned objectsvoid
export(org.bson.conversions.Bson query, Map<String,CollectionField> columns, PrintWriter writer)
Export data to CSVCollectionFind<T>
find(org.bson.conversions.Bson query, SearchOrder order, Integer skip, Integer limit)
CollectionFind<T>
find(org.bson.conversions.Bson query, SearchOrder order, Integer skip, Integer limit, int maxTime)
List<org.bson.conversions.Bson>
getAdditionalQueryFragments(javax.json.JsonObject queryParameters)
Class<?>
getEntityClass()
protected Map<String,CollectionField>
getExportFields()
org.bson.conversions.Bson
getQueryFragmentForColumnSearch(String columnName, String searchValue)
boolean
isFiltered()
-
-
-
Field Detail
-
CSV_DELIMITER
protected static final String CSV_DELIMITER
- See Also:
- Constant Field Values
-
-
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 collectionentityClass
- thefiltered
- if theCollection
is subject to context filtering i.e. if the context parameters delivered by theObjectFilter
s of theObjectHookRegistry
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 theObjectHookRegistry
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
-
find
public CollectionFind<T> find(org.bson.conversions.Bson query, SearchOrder order, Integer skip, Integer limit)
-
find
public CollectionFind<T> find(org.bson.conversions.Bson query, SearchOrder order, Integer skip, Integer limit, int maxTime)
-
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 appliedsearchValue
- 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
-
-
getExportFields
protected Map<String,CollectionField> getExportFields()
-
-