Class Properties
- java.lang.Object
-
- org.opencastproject.assetmanager.api.fn.Properties
-
public final class Properties extends Object
Utility functions for dealing with singlepropertiesand property streams.
-
-
Field Summary
Fields Modifier and Type Field Description static com.entwinemedia.fn.Fn<Property,Value>getValueProperty.getValue()as a function.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static com.entwinemedia.fn.Pred<Property>byFqnName(PropertyName name)Create a predicate to query a property by its full qualified name which is the tuple of namespace and name.static com.entwinemedia.fn.Pred<Property>byMediaPackageId(String id)Create a predicate to query a property by its media package ID.static com.entwinemedia.fn.Pred<Property>byNamespace(String namespace)Create a predicate to query a property by its namespace.static com.entwinemedia.fn.Pred<Property>byPropertyName(String propertyName)Create a predicate to query a property by its name.static com.entwinemedia.fn.Fn<com.entwinemedia.fn.data.Opt<Property>,Property>get(String propertyName)Apply #get() to the given Opt or throw a RuntimeException if none.static com.entwinemedia.fn.Fn<com.entwinemedia.fn.data.Opt<Property>,Property>get(PropertyName name)Apply #get() to the given Opt or throw a RuntimeException if none.static com.entwinemedia.fn.StreamFold<Property,Boolean>getBoolean(String propertyName)Get a boolean value.static com.entwinemedia.fn.StreamFold<Property,Boolean>getBoolean(PropertyName name)Get a boolean value.static com.entwinemedia.fn.StreamFold<Property,Date>getDate(String propertyName)Get a date value.static com.entwinemedia.fn.StreamFold<Property,Date>getDate(PropertyName name)Get a date value.static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Date>>getDateOpt(String propertyName)Get a date value.static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Date>>getDateOpt(PropertyName name)Get a date value.static com.entwinemedia.fn.StreamFold<Property,Long>getLong(String propertyName)Get a long value.static com.entwinemedia.fn.StreamFold<Property,Long>getLong(PropertyName name)Get a long value.static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Long>>getLongOpt(String propertyName)Get a long value.static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Long>>getLongOpt(PropertyName name)Get a long value.static com.entwinemedia.fn.Stream<Property>getProperties(AResult result)Extract all properties contained in a result.static com.entwinemedia.fn.data.Opt<Property>getProperty(AssetManager am, String mpId, String namespace, String propertyName)static com.entwinemedia.fn.StreamFold<Property,String>getString(String propertyName)Get a string value.static com.entwinemedia.fn.StreamFold<Property,String>getString(PropertyName name)Get a string value.static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<String>>getStringOpt(String propertyName)Get a string value.static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<String>>getStringOpt(PropertyName name)Get a string value.static com.entwinemedia.fn.StreamOp<Property,String>getStrings(String propertyName)Get string values from all properties.static com.entwinemedia.fn.StreamOp<Property,String>getStrings(PropertyName name)Get string values from all properties.static <A> com.entwinemedia.fn.Fn<Property,A>getValue(Value.ValueType<A> ev)Create a function to get a value from a property.static <A> com.entwinemedia.fn.StreamFold<Property,A>getValue(Value.ValueType<A> ev, String propertyName)Create a stream fold to find the first property whose name matches the given one and extract its value.static <A> com.entwinemedia.fn.StreamFold<Property,A>getValue(Value.ValueType<A> ev, PropertyName name)Create a stream fold to find the first property whose full qualified name matches the given one and extract its value.static <A> com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<A>>getValueOpt(Value.ValueType<A> ev, String propertyName)Create a stream fold to find the first property whose name matches the given one and extract its value, wrapped in anOpt.static <A> com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<A>>getValueOpt(Value.ValueType<A> ev, PropertyName name)Create a stream fold to find the first property whose full qualified name matches the given one and extract their values, wrapped in anOpt.static PropertymkProperty(String mpId, String namespace, String name, Value value)Create a property.static <A> PropertymkProperty(PropertyField<A> f, Snapshot e, A value)Create a property.static <A> PropertymkProperty(PropertyField<A> f, org.opencastproject.mediapackage.MediaPackage mp, A value)Create a property.static longremoveProperties(AssetManager am, String owner, String orgId, String mpId, String namespace)static booleansetProperty(AssetManager am, String mpId, String namespace, String propertyName, boolean value)Deprecated.make use of aPropertySchemainstead of creating property IDs manuallystatic booleansetProperty(AssetManager am, String mpId, String namespace, String propertyName, Long value)Deprecated.make use of aPropertySchemainstead of creating property IDs manuallystatic booleansetProperty(AssetManager am, String mpId, String namespace, String propertyName, String value)Deprecated.make use of aPropertySchemainstead of creating property IDs manuallystatic booleansetProperty(AssetManager am, String mpId, String namespace, String propertyName, Date value)Deprecated.make use of aPropertySchemainstead of creating property IDs manuallystatic booleansetProperty(AssetManager am, String mpId, String namespace, String propertyName, Value value)Deprecated.make use of aPropertySchemainstead of creating property IDs manually
-
-
-
Field Detail
-
getValue
public static final com.entwinemedia.fn.Fn<Property,Value> getValue
Property.getValue()as a function.
-
-
Method Detail
-
getProperties
public static com.entwinemedia.fn.Stream<Property> getProperties(AResult result)
Extract all properties contained in a result. They'll appear in the order of the returned records.
-
byMediaPackageId
public static com.entwinemedia.fn.Pred<Property> byMediaPackageId(String id)
Create a predicate to query a property by its media package ID.- See Also:
PropertyId.getMediaPackageId()
-
byNamespace
public static com.entwinemedia.fn.Pred<Property> byNamespace(String namespace)
Create a predicate to query a property by its namespace.- See Also:
PropertyId.getNamespace()
-
byPropertyName
public static com.entwinemedia.fn.Pred<Property> byPropertyName(String propertyName)
Create a predicate to query a property by its name.- See Also:
PropertyId.getName()
-
byFqnName
public static com.entwinemedia.fn.Pred<Property> byFqnName(PropertyName name)
Create a predicate to query a property by its full qualified name which is the tuple of namespace and name.- See Also:
PropertyId.getFqn()
-
setProperty
public static boolean setProperty(AssetManager am, String mpId, String namespace, String propertyName, String value)
Deprecated.make use of aPropertySchemainstead of creating property IDs manuallySet a string property on a media package.
-
setProperty
public static boolean setProperty(AssetManager am, String mpId, String namespace, String propertyName, Date value)
Deprecated.make use of aPropertySchemainstead of creating property IDs manuallySet a date property on a media package.
-
setProperty
public static boolean setProperty(AssetManager am, String mpId, String namespace, String propertyName, Long value)
Deprecated.make use of aPropertySchemainstead of creating property IDs manuallySet a long property on a media package.
-
setProperty
public static boolean setProperty(AssetManager am, String mpId, String namespace, String propertyName, boolean value)
Deprecated.make use of aPropertySchemainstead of creating property IDs manuallySet a boolean property on a media package.
-
setProperty
public static boolean setProperty(AssetManager am, String mpId, String namespace, String propertyName, Value value)
Deprecated.make use of aPropertySchemainstead of creating property IDs manuallySet a property on a media package.
-
removeProperties
public static long removeProperties(AssetManager am, String owner, String orgId, String mpId, String namespace)
-
getProperty
public static com.entwinemedia.fn.data.Opt<Property> getProperty(AssetManager am, String mpId, String namespace, String propertyName)
-
getValue
public static <A> com.entwinemedia.fn.Fn<Property,A> getValue(Value.ValueType<A> ev)
Create a function to get a value from a property.- Parameters:
ev- the expected value type
-
getValue
public static <A> com.entwinemedia.fn.StreamFold<Property,A> getValue(Value.ValueType<A> ev, String propertyName)
Create a stream fold to find the first property whose name matches the given one and extract its value.- Parameters:
ev- the expected value typepropertyName- the name of the property- Throws:
RuntimeException- if the property cannot be found or its type does not match
-
getValue
public static <A> com.entwinemedia.fn.StreamFold<Property,A> getValue(Value.ValueType<A> ev, PropertyName name)
Create a stream fold to find the first property whose full qualified name matches the given one and extract its value.- Parameters:
ev- the expected value typename- the full qualified name of the property- Throws:
RuntimeException- if the property cannot be found or its type does not match
-
getValueOpt
public static <A> com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<A>> getValueOpt(Value.ValueType<A> ev, String propertyName)
Create a stream fold to find the first property whose name matches the given one and extract its value, wrapped in anOpt.- Parameters:
ev- the expected value typepropertyName- the name of the property
-
getValueOpt
public static <A> com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<A>> getValueOpt(Value.ValueType<A> ev, PropertyName name)
Create a stream fold to find the first property whose full qualified name matches the given one and extract their values, wrapped in anOpt.- Parameters:
ev- the expected value typename- the full qualified name of the property
-
get
public static com.entwinemedia.fn.Fn<com.entwinemedia.fn.data.Opt<Property>,Property> get(String propertyName)
Apply #get() to the given Opt or throw a RuntimeException if none. UsepropertyNamefor the exception message.
-
get
public static com.entwinemedia.fn.Fn<com.entwinemedia.fn.data.Opt<Property>,Property> get(PropertyName name)
Apply #get() to the given Opt or throw a RuntimeException if none. Usenamefor the exception message.
-
mkProperty
public static <A> Property mkProperty(PropertyField<A> f, org.opencastproject.mediapackage.MediaPackage mp, A value)
Create a property.
-
mkProperty
public static <A> Property mkProperty(PropertyField<A> f, Snapshot e, A value)
Create a property.
-
mkProperty
public static Property mkProperty(String mpId, String namespace, String name, Value value)
Create a property.
-
getBoolean
public static com.entwinemedia.fn.StreamFold<Property,Boolean> getBoolean(String propertyName)
Get a boolean value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a boolean
-
getBoolean
public static com.entwinemedia.fn.StreamFold<Property,Boolean> getBoolean(PropertyName name)
Get a boolean value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a boolean
-
getString
public static com.entwinemedia.fn.StreamFold<Property,String> getString(String propertyName)
Get a string value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a string
-
getString
public static com.entwinemedia.fn.StreamFold<Property,String> getString(PropertyName name)
Get a string value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a string
-
getStrings
public static com.entwinemedia.fn.StreamOp<Property,String> getStrings(String propertyName)
Get string values from all properties.- Throws:
RuntimeException- if at least one property is not a string
-
getStrings
public static com.entwinemedia.fn.StreamOp<Property,String> getStrings(PropertyName name)
Get string values from all properties.- Throws:
RuntimeException- if at least one property is not a string
-
getDate
public static com.entwinemedia.fn.StreamFold<Property,Date> getDate(String propertyName)
Get a date value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a date
-
getDate
public static com.entwinemedia.fn.StreamFold<Property,Date> getDate(PropertyName name)
Get a date value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a date
-
getLong
public static com.entwinemedia.fn.StreamFold<Property,Long> getLong(String propertyName)
Get a long value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a long
-
getLong
public static com.entwinemedia.fn.StreamFold<Property,Long> getLong(PropertyName name)
Get a long value. Uses the first property with the given name.- Throws:
RuntimeException- if the property does not exist or if the property is not a long
-
getStringOpt
public static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<String>> getStringOpt(String propertyName)
Get a string value. Uses the first property with the given name.- Throws:
RuntimeException- if the property is not a string
-
getStringOpt
public static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<String>> getStringOpt(PropertyName name)
Get a string value. Uses the first property with the given name.- Throws:
RuntimeException- if the property is not a string
-
getDateOpt
public static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Date>> getDateOpt(String propertyName)
Get a date value. Uses the first property with the given name.- Throws:
RuntimeException- if the property is not a date
-
getDateOpt
public static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Date>> getDateOpt(PropertyName name)
Get a date value. Uses the first property with the given name.- Throws:
RuntimeException- if the property is not a date
-
getLongOpt
public static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Long>> getLongOpt(String propertyName)
Get a long value. Uses the first property with the given name.- Throws:
RuntimeException- if the property is not a long
-
getLongOpt
public static com.entwinemedia.fn.StreamFold<Property,com.entwinemedia.fn.data.Opt<Long>> getLongOpt(PropertyName name)
Get a long value. Uses the first property with the given name.- Throws:
RuntimeException- if the property is not a long
-
-