Klasse SimpleSelectionRule

java.lang.Object
de.dlr.proseo.model.PersistentObject
de.dlr.proseo.model.SimpleSelectionRule

@Entity public class SimpleSelectionRule extends PersistentObject
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
  • Konstruktordetails

    • SimpleSelectionRule

      public SimpleSelectionRule()
  • Methodendetails

    • getMode

      public String getMode()
      Gets the applicable processing mode
      Gibt zurück:
      the mode
    • setMode

      public void setMode(String mode)
      Sets the applicable processing mode
      Parameter:
      mode - the mode to set
    • getIsMandatory

      public Boolean getIsMandatory()
      Check whether the selected product is mandatory
      Gibt zurück:
      the isMandatory
    • isMandatory

      public Boolean isMandatory()
      Check whether the selected product is mandatory (convenience alias for getIsMandatory())
      Gibt zurück:
      the isMandatory
    • setIsMandatory

      public void setIsMandatory(Boolean isMandatory)
      Indicate whether the selected product is mandatory
      Parameter:
      isMandatory - the isMandatory to set
    • getMinimumCoverage

      public Short getMinimumCoverage()
      Gets the minimum percentage of coverage of the desired validity period
      Gibt zurück:
      the minimumCoverage
    • setMinimumCoverage

      public void setMinimumCoverage(Short minimumCoverage)
      Sets the minimum percentage of coverage of the desired validity period
      Parameter:
      minimumCoverage - the minimumCoverage to set
    • getFilterConditions

      public Map<String,Parameter> getFilterConditions()
      Gets the additional filtering conditions
      Gibt zurück:
      the filter conditions
    • setFilterConditions

      public void setFilterConditions(Map<String,Parameter> filterConditions)
      Sets the additional filtering conditions
      Parameter:
      filterConditions - the filter conditions to set
    • getFilteredSourceProductType

      public String getFilteredSourceProductType()
      Gets the source product type with filter conditions
      Gibt zurück:
      the filteredSourceProductType
    • setFilteredSourceProductType

      public void setFilteredSourceProductType(String filteredSourceProductType)
      Sets the source product type with filter conditions
      Parameter:
      filteredSourceProductType - the filteredSourceProductType to set
    • getTargetProductClass

      public ProductClass getTargetProductClass()
      Gets the target product class (the one for which input products are selected by this rule)
      Gibt zurück:
      the targetProductClass
    • setTargetProductClass

      public void setTargetProductClass(ProductClass targetProductClass)
      Sets the target product class (the one for which input products are selected by this rule)
      Parameter:
      targetProductClass - the targetProductClass to set
    • getSourceProductClass

      public ProductClass getSourceProductClass()
      Gets the source product classes (the input products selected by this rule)
      Gibt zurück:
      the sourceProductClass
    • setSourceProductClass

      public void setSourceProductClass(ProductClass sourceProductClass)
      Sets the source product classes (the input products selected by this rule)
      Parameter:
      sourceProductClass - the sourceProductClass to set
    • getConfiguredProcessors

      public Set<ConfiguredProcessor> getConfiguredProcessors()
      Gets the applicable processor configurations
      Gibt zurück:
      the configuredProcessors
    • setConfiguredProcessors

      public void setConfiguredProcessors(Set<ConfiguredProcessor> configuredProcessors)
      Sets the applicable processor configurations
      Parameter:
      configuredProcessors - the configuredProcessors to set
    • getSimplePolicies

      public List<SimplePolicy> getSimplePolicies()
      Gets the simple selection policies
      Gibt zurück:
      the simplePolicies
    • setSimplePolicies

      public void setSimplePolicies(List<SimplePolicy> simplePolicies)
      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 rule

      For 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 searched
      startTime - the start time of the time interval to check against
      stopTime - 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 query
      stopTime - the stop time to use in the database query
      additionalFilterConditions - 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 query
      stopTime - the stop time to use in the database query
      additionalFilterConditions - 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 names
      facilityQuerySql - an SQL selection string to add to the selection rule SQL query
      facilityQuerySqlSubselect - 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

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse PersistentObject
    • equals

      public boolean equals(Object obj)
      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 Klasse PersistentObject
      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: