Package de.dlr.proseo.model
Klasse SimpleSelectionRule
java.lang.Object
de.dlr.proseo.model.PersistentObject
de.dlr.proseo.model.SimpleSelectionRule
A rule defining the required input ProductTypes for a certain output ProductType using an ordered list of SelectionPolicys.
When selecting applicable Products for a JobStep the matching SelectionPolicy defines, whether a Product satisfies a ProductQuery.
- Autor:
- Dr. Thomas Bassler
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungFormat this rule as a JPQL (Java Persistence Query Language) query.asSqlQuery
(Instant startTime, Instant stopTime, Map<String, Parameter> additionalFilterConditions, Map<String, String> productColumnMapping, String facilityQuerySql, String facilityQuerySqlSubselect) Format this rule as a native SQL query.boolean
Test equality of selection rules based on source and target product classes and processing mode (i. e. there must be only one selection rule for the same source and target classes and the same processing mode).Gets the applicable processor configurationsGets the additional filtering conditionsGets the source product type with filter conditionsCheck whether the selected product is mandatoryGets the minimum percentage of coverage of the desired validity periodgetMode()
Gets the applicable processing modeGets the simple selection policiesGets the source product classes (the input products selected by this rule)Gets the target product class (the one for which input products are selected by this rule)int
hashCode()
Check whether the selected product is mandatory (convenience alias for getIsMandatory())merge
(SimpleSelectionRule anotherSimpleSelectionRule) Merge two simple rules creating a new simple ruleselectItems
(Collection<SelectionItem> items, Instant startTime, Instant stopTime) Select all items from the given collection that fulfil this rule for the given time interval.void
setConfiguredProcessors
(Set<ConfiguredProcessor> configuredProcessors) Sets the applicable processor configurationsvoid
setFilterConditions
(Map<String, Parameter> filterConditions) Sets the additional filtering conditionsvoid
setFilteredSourceProductType
(String filteredSourceProductType) Sets the source product type with filter conditionsvoid
setIsMandatory
(Boolean isMandatory) Indicate whether the selected product is mandatoryvoid
setMinimumCoverage
(Short minimumCoverage) Sets the minimum percentage of coverage of the desired validity periodvoid
Sets the applicable processing modevoid
setSimplePolicies
(List<SimplePolicy> simplePolicies) Sets the simple selection policiesvoid
setSourceProductClass
(ProductClass sourceProductClass) Sets the source product classes (the input products selected by this rule)void
setTargetProductClass
(ProductClass targetProductClass) Sets the target product class (the one for which input products are selected by this rule)toString()
Von Klasse geerbte Methoden de.dlr.proseo.model.PersistentObject
getId, getVersion, incrementVersion, setId
-
Konstruktordetails
-
SimpleSelectionRule
public SimpleSelectionRule()
-
-
Methodendetails
-
getMode
Gets the applicable processing mode- Gibt zurück:
- the mode
-
setMode
Sets the applicable processing mode- Parameter:
mode
- the mode to set
-
getIsMandatory
Check whether the selected product is mandatory- Gibt zurück:
- the isMandatory
-
isMandatory
Check whether the selected product is mandatory (convenience alias for getIsMandatory())- Gibt zurück:
- the isMandatory
-
setIsMandatory
Indicate whether the selected product is mandatory- Parameter:
isMandatory
- the isMandatory to set
-
getMinimumCoverage
Gets the minimum percentage of coverage of the desired validity period- Gibt zurück:
- the minimumCoverage
-
setMinimumCoverage
Sets the minimum percentage of coverage of the desired validity period- Parameter:
minimumCoverage
- the minimumCoverage to set
-
getFilterConditions
Gets the additional filtering conditions- Gibt zurück:
- the filter conditions
-
setFilterConditions
Sets the additional filtering conditions- Parameter:
filterConditions
- the filter conditions to set
-
getFilteredSourceProductType
Gets the source product type with filter conditions- Gibt zurück:
- the filteredSourceProductType
-
setFilteredSourceProductType
Sets the source product type with filter conditions- Parameter:
filteredSourceProductType
- the filteredSourceProductType to set
-
getTargetProductClass
Gets the target product class (the one for which input products are selected by this rule)- Gibt zurück:
- the targetProductClass
-
setTargetProductClass
Sets the target product class (the one for which input products are selected by this rule)- Parameter:
targetProductClass
- the targetProductClass to set
-
getSourceProductClass
Gets the source product classes (the input products selected by this rule)- Gibt zurück:
- the sourceProductClass
-
setSourceProductClass
Sets the source product classes (the input products selected by this rule)- Parameter:
sourceProductClass
- the sourceProductClass to set
-
getConfiguredProcessors
Gets the applicable processor configurations- Gibt zurück:
- the configuredProcessors
-
setConfiguredProcessors
Sets the applicable processor configurations- Parameter:
configuredProcessors
- the configuredProcessors to set
-
getSimplePolicies
Gets the simple selection policies- Gibt zurück:
- the simplePolicies
-
setSimplePolicies
Sets the simple selection policies- Parameter:
simplePolicies
- the simplePolicies to set
-
merge
public SimpleSelectionRule merge(SimpleSelectionRule anotherSimpleSelectionRule) throws IllegalArgumentException Merge two simple rules creating a new simple ruleFor selection rules containing the policy 'LatestValidityClosest' a merge is possible, if and only if all occurrences of this policy in both rules have the same delta times (this policy actually refers to a point in time and not to a time interval, therefore a merge can only be done between policies referring to the same point in time).
- Parameter:
anotherSimpleSelectionRule
- the simple rule to merge this rule with- Gibt zurück:
- a new SimpleRule object whose policies reflect the merged validity periods
- Löst aus:
IllegalArgumentException
- if a merge of simple rules with different product types or with different delta times for a 'LatestValidityClosest' policy is attempted
-
selectItems
public List<Object> selectItems(Collection<SelectionItem> items, Instant startTime, Instant stopTime) throws NoSuchElementException, IllegalArgumentException Select all items from the given collection that fulfil this rule for the given time interval. For all items the item type must match the targetProductClass of the rule.- Parameter:
items
- the collection of items to be searchedstartTime
- the start time of the time interval to check againststopTime
- the end time of the time interval to check against- Gibt zurück:
- a list of all item objects fulfilling the selection rule, or null, if no such qualifying item exists and the selection rule is marked as 'OPTIONAL'
- Löst aus:
NoSuchElementException
- if no item fulfils the selection rule, and the selection rule is marked as 'MANDATORY'IllegalArgumentException
- if any of the items is not of the correct type
-
asJpqlQuery
public String asJpqlQuery(Instant startTime, Instant stopTime, Map<String, Parameter> additionalFilterConditions) Format this rule as a JPQL (Java Persistence Query Language) query. The condition in the "where" clause is set in parentheses, so further conditions/filters can be appended to the resulting query.Limitation: For LatestValidityClosest the query may return two products, one to each side of the centre of the given time interval. It is up to the calling program to select the applicable product.
- Parameter:
startTime
- the start time to use in the database querystopTime
- the stop time to use in the database queryadditionalFilterConditions
- filter conditions to apply in addition to the rule's own filters (optional)- Gibt zurück:
- a JPQL string representing this rule
-
asSqlQuery
public String asSqlQuery(Instant startTime, Instant stopTime, Map<String, Parameter> additionalFilterConditions, Map<String, String> productColumnMapping, String facilityQuerySql, String facilityQuerySqlSubselect) Format this rule as a native SQL query. The condition in the "where" clause is set in parentheses, so further conditions/filters can be appended to the resulting query.Limitation: For LatestValidityClosest the query may return two products, one to each side of the centre of the given time interval. It is up to the calling program to select the applicable product.
- Parameter:
startTime
- the start time to use in the database querystopTime
- the stop time to use in the database queryadditionalFilterConditions
- filter conditions to apply in addition to the rule's own filters (optional)productColumnMapping
- a mapping from attribute names of the Product class to the corresponding SQL column namesfacilityQuerySql
- an SQL selection string to add to the selection rule SQL queryfacilityQuerySqlSubselect
- an SQL selection string to add to sub-SELECTs in selection policy SQL query conditions- Gibt zurück:
- an SQL string representing this rule
-
toString
-
hashCode
public int hashCode()- Setzt außer Kraft:
hashCode
in KlassePersistentObject
-
equals
Test equality of selection rules based on source and target product classes and processing mode (i. e. there must be only one selection rule for the same source and target classes and the same processing mode).- Setzt außer Kraft:
equals
in KlassePersistentObject
- Parameter:
obj
- the reference object with which to compare- Gibt zurück:
- true if this object is the same as the obj argument according to the definition above; false otherwise
- Siehe auch:
-