Package de.dlr.proseo.model
Klasse SimplePolicy
java.lang.Object
de.dlr.proseo.model.PersistentObject
de.dlr.proseo.model.SimplePolicy
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
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic class
Class representing a single overlapping time periodstatic enum
Available policy types as defined in ESA's Generic IPF Interface Specifications and other sources (e. g. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungNo-argument sets default values for type (ValIntersect) and delta times (0/0) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungasJpqlQueryCondition
(ProductClass sourceProductClass, Instant startTime, Instant stopTime, Map<String, Parameter> filterConditions) Format this policy as a query condition in JPQL (Java Persistence Query Language).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.boolean
Test equality of persistent objects based on their unique ID.Gets the delta timesGets the delta time to apply to the beginning of the interval (T0)Gets the delta time to apply to the end of the interval (T1)Gets the policy typeint
hashCode()
merge
(SimplePolicy anotherSimplePolicy) 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).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).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).selectItems
(Collection<SelectionItem> items, Instant startTime, Instant stopTime) Select all items from the given collection that fulfil this policy for the given time interval.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.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.selectLastCreated
(Collection<SelectionItem> items) Select the latest item (by generation time) from the given collection.Select the latest item (by validity stop time) from the given collection that covers partly the given time interval.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.Select the latest item (by validity start time) from the given collection that covers partly the given time interval.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.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.selectValIntersect
(Collection<SelectionItem> items, Instant startTime, Instant stopTime) Select all items from the given collection that cover partly the given time interval.void
setDeltaTimes
(List<SimplePolicy.DeltaTime> deltaTimes) Sets the delta timesvoid
setDeltaTimeT0
(SimplePolicy.DeltaTime deltaTimeT0) Sets the delta time to apply to the beginning of the interval (T0)void
setDeltaTimeT1
(SimplePolicy.DeltaTime deltaTimeT1) Sets the delta time to apply to the beginning of the interval (T1)void
setPolicyType
(SimplePolicy.PolicyType policyType) Sets the policy typetoString()
Von Klasse geerbte Methoden de.dlr.proseo.model.PersistentObject
getId, getVersion, incrementVersion, setId
-
Konstruktordetails
-
SimplePolicy
public SimplePolicy()No-argument sets default values for type (ValIntersect) and delta times (0/0)
-
-
Methodendetails
-
getPolicyType
Gets the policy type- Gibt zurück:
- the type
-
setPolicyType
Sets the policy type- Parameter:
policyType
- the type to set
-
getDeltaTimes
Gets the delta times- Gibt zurück:
- the deltaTimes
-
setDeltaTimes
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
Gets the delta time to apply to the beginning of the interval (T0)- Gibt zurück:
- the delta time T0
-
setDeltaTimeT0
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
Gets the delta time to apply to the end of the interval (T1)- Gibt zurück:
- the deltaTimes
-
setDeltaTimeT1
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
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 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 (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 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 containing the selected item, or an empty list, if no qualifying item exists in the collection
-
selectLatestValidity
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
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 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 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 searchedstartTime
- 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 searchedstopTime
- 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 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 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 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 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 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 containing the selected item, or an empty list, if no qualifying item exists in the collection
-
selectLastCreated
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 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 (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 conditionstopTime
- the stop time to use in the conditionfilterConditions
- 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 conditionstopTime
- the stop time to use in the conditionfilterConditions
- filter conditions to applyproductColumnMapping
- a mapping from attribute names of the Product class to the corresponding SQL column namesfacilityQuerySqlSubselect
- 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
-
hashCode
public int hashCode()- Setzt außer Kraft:
hashCode
in KlassePersistentObject
-
equals
Beschreibung aus Klasse kopiert:PersistentObject
Test equality of persistent objects based on their unique ID.- Setzt außer Kraft:
equals
in KlassePersistentObject
- 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:
-