Klasse SimplePolicy

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

@Entity public class SimplePolicy extends PersistentObject
A product retrieval policy consisting of a retrieval mode and a time interval with delta times as defined in Annex B of ESA's Generic IPF Interface Specifications (MMFI-GSEG-EOPG-TN-07-0003, issue 1.8). From Sentinel-1/Sentinel-3 additional policies have been derived according to the Sentinel-3 Core PDGS IPF ICD (S3IPF.ICD.001, issue 1.4), sec. 2.3.2. Note: As a future extension policy types based on geographical areas are envisioned.
Autor:
Dr. Thomas Bassler
  • Konstruktordetails

    • SimplePolicy

      public SimplePolicy()
      No-argument sets default values for type (ValIntersect) and delta times (0/0)
  • Methodendetails

    • getPolicyType

      public SimplePolicy.PolicyType getPolicyType()
      Gets the policy type
      Gibt zurück:
      the type
    • setPolicyType

      public void setPolicyType(SimplePolicy.PolicyType policyType)
      Sets the policy type
      Parameter:
      policyType - the type to set
    • getDeltaTimes

      public List<SimplePolicy.DeltaTime> getDeltaTimes()
      Gets the delta times
      Gibt zurück:
      the deltaTimes
    • setDeltaTimes

      public void setDeltaTimes(List<SimplePolicy.DeltaTime> deltaTimes) throws IllegalArgumentException
      Sets the delta times
      Parameter:
      deltaTimes - the deltaTimes to set (a list of exactly two entries with non-negative duration values)
      Löst aus:
      IllegalArgumentException - if the list does not contain exactly two entries, or if the duration of any of the delta times is negative
    • getDeltaTimeT0

      public SimplePolicy.DeltaTime getDeltaTimeT0()
      Gets the delta time to apply to the beginning of the interval (T0)
      Gibt zurück:
      the delta time T0
    • setDeltaTimeT0

      public void setDeltaTimeT0(SimplePolicy.DeltaTime deltaTimeT0) throws IllegalArgumentException
      Sets the delta time to apply to the beginning of the interval (T0)
      Parameter:
      deltaTimeT0 - the T0 delta time
      Löst aus:
      IllegalArgumentException - if the duration of the delta time is negative
    • getDeltaTimeT1

      public SimplePolicy.DeltaTime getDeltaTimeT1()
      Gets the delta time to apply to the end of the interval (T1)
      Gibt zurück:
      the deltaTimes
    • setDeltaTimeT1

      public void setDeltaTimeT1(SimplePolicy.DeltaTime deltaTimeT1) throws IllegalArgumentException
      Sets the delta time to apply to the beginning of the interval (T1)
      Parameter:
      deltaTimeT1 - the T1 delta time
      Löst aus:
      IllegalArgumentException - if the duration of the delta time is negative
    • merge

      public SimplePolicy merge(SimplePolicy anotherSimplePolicy) throws IllegalArgumentException
      Merge two simple policies by creating a new simple policy with merged delta times; for the policy 'LatestValidityClosest' a merge is possible, if and only if both policies 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:
      anotherSimplePolicy - the simple policy to merge this one with
      Gibt zurück:
      a new SimplePolicy object covering the united validity periods of the two policies
      Löst aus:
      IllegalArgumentException - if a merge of simple policies of different types, or of 'LatestValidityClosest' policies with different delta times was attempted
    • selectValIntersect

      public Set<SelectionItem> selectValIntersect(Collection<SelectionItem> items, Instant startTime, Instant stopTime)
      Select all items from the given collection that cover partly the given time interval. For all items the item type must match the given productType.
      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 (possibly empty) list of all item objects fulfilling the policy
    • selectLatestValIntersect

      public Set<SelectionItem> selectLatestValIntersect(Collection<SelectionItem> items, Instant startTime, Instant stopTime)
      Select the latest item (by generation time) from the given collection that covers partly the given time interval. For all items the item type must match the given productType.
      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 containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectLatestValidity

      public Set<SelectionItem> selectLatestValidity(Collection<SelectionItem> items)
      Select the latest item (by validity start time) from the given collection that covers partly the given time interval. If multiple items share the same latest validity start time, the item with the latest generation time will be selected. For all items the item type must match the given productType.
      Parameter:
      items - the collection of items to be searched
      Gibt zurück:
      a list containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectLatestStopValidity

      public Set<SelectionItem> selectLatestStopValidity(Collection<SelectionItem> items)
      Select the latest item (by validity stop time) from the given collection that covers partly the given time interval. If multiple items share the same latest validity stop time, the item with the latest generation time will be selected. For all items the item type must match the given productType.
      Parameter:
      items - the collection of items to be searched
      Gibt zurück:
      a list containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectLatestValidityClosest

      public Set<SelectionItem> selectLatestValidityClosest(Collection<SelectionItem> items, Instant startTime, Instant stopTime)
      Select the latest item (by generation time) from the given collection, whose start time is "nearest" to the given time interval. "Nearest" is defined as min(| ValidityStart - ((startTime - deltaTime0) + (stopTime + deltaTime1))/2 |).

      For all items the item type must match the given productType.

      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 containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectClosestStartValidity

      public Set<SelectionItem> selectClosestStartValidity(Collection<SelectionItem> items, Instant startTime)
      Select the latest item (by generation time) from the given collection, whose start time is "nearest" to the start of the given time interval (startTime - deltaTime0). For all items the item type must match the given productType.
      Parameter:
      items - the collection of items to be searched
      startTime - the start time of the time interval to check against
      Gibt zurück:
      a list containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectClosestStopValidity

      public Set<SelectionItem> selectClosestStopValidity(Collection<SelectionItem> items, Instant stopTime)
      Select the latest item (by generation time) from the given collection, whose stop time is "nearest" to the end of the given time interval (stopTime + deltaTime1). For all items the item type must match the given productType.
      Parameter:
      items - the collection of items to be searched
      stopTime - the end time of the time interval to check against
      Gibt zurück:
      a list containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectLatestValCover

      public Set<SelectionItem> selectLatestValCover(Collection<SelectionItem> items, Instant startTime, Instant stopTime)
      Select the latest item (by generation time) from the given collection that fully covers the given time interval. For all items the item type must match the given productType.
      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 containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectLargestOverlap

      public Set<SelectionItem> selectLargestOverlap(Collection<SelectionItem> items, Instant startTime, Instant stopTime)
      Select the item from the given collection that has the largest overlap with the given time interval. If multiple items have the same overlap, the product with the start time that is closest to t0-dt0 is chosen. If multiple items with the same overlap and equally close start times exist, the one with the most recent generation time is selected.
      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 containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectLargestOverlap85

      public Set<SelectionItem> selectLargestOverlap85(Collection<SelectionItem> items, Instant startTime, Instant stopTime)
      Select the item from the given collection that has the largest overlap with the given time interval, where the item covers at least 85 % of the time interval. If multiple items have the same overlap, the product with the start time that is closest to t0-dt0 is chosen. If multiple items with the same overlap and equally close start times exist, the one with the most recent generation time is selected.
      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 containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectLastCreated

      public Set<SelectionItem> selectLastCreated(Collection<SelectionItem> items)
      Select the latest item (by generation time) from the given collection. For all items the item type must match the given productType.
      Parameter:
      items - the collection of items to be searched
      Gibt zurück:
      a list containing the selected item, or an empty list, if no qualifying item exists in the collection
    • selectItems

      public Set<SelectionItem> selectItems(Collection<SelectionItem> items, Instant startTime, Instant stopTime)
      Select all items from the given collection that fulfil this policy for the given time interval. For all items the item type must match the given productType.
      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 (possibly empty) list of all items fulfilling the policy
      Löst aus:
      IllegalArgumentException - if any of the items is not of the given type
    • asJpqlQueryCondition

      public String asJpqlQueryCondition(ProductClass sourceProductClass, Instant startTime, Instant stopTime, Map<String,Parameter> filterConditions)
      Format this policy as a query condition in JPQL (Java Persistence Query Language). It is assumed that the Product class is denoted as "select ... from Product p ..." in the JPQL query, to which the resulting condition is to be appended.

      Limitations:

      • 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.
      • For LargestOverlap and LargestOverlap85 the query returns all items intersecting the interal (like ValIntersect), further selection by the calling program using either selectLargestOverlap(...) or selectLargestOverlap85(...) is required.
      Parameter:
      sourceProductClass - the source product class to use for the query (only required for LatestValidity and LatestValidityClosest)
      startTime - the start time to use in the condition
      stopTime - the stop time to use in the condition
      filterConditions - filter conditions to apply
      Gibt zurück:
      a ProductQuery object representing this policy
    • asSqlQueryCondition

      public String asSqlQueryCondition(ProductClass sourceProductClass, Instant startTime, Instant stopTime, Map<String,Parameter> filterConditions, Map<String,String> productColumnMapping, String facilityQuerySqlSubselect)
      Format this policy as a query condition in native SQL. It is assumed that the Product and ProductClass classes are denoted as "SELECT ... FROM product p JOIN product_class pc ON p.product_class_id = pc.id" in the SQL query, to which the resulting condition is to be appended.

      Limitations:

      • 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.
      • For LargestOverlap and LargestOverlap85 the query returns all items intersecting the interal (like ValIntersect), further selection by the calling program using either selectLargestOverlap(...) or selectLargestOverlap85(...) is required.
      Parameter:
      sourceProductClass - the source product class to use for the query (only required for LatestValidity and LatestValidityClosest)
      startTime - the start time to use in the condition
      stopTime - the stop time to use in the condition
      filterConditions - filter conditions to apply
      productColumnMapping - a mapping from attribute names of the Product class to the corresponding SQL column names
      facilityQuerySqlSubselect - an SQL selection string to add to sub-SELECTs in selection policy SQL query conditions
      Gibt zurück:
      a ProductQuery object representing this policy
    • 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)
      Beschreibung aus Klasse kopiert: PersistentObject
      Test equality of persistent objects based on their unique ID.
      Setzt außer Kraft:
      equals in Klasse PersistentObject
      Parameter:
      obj - the object to compare this object to
      Gibt zurück:
      true, if obj is a persistent object and has the same ID, false otherwise
      Siehe auch: