Class MediaObjects
MediaObject
s, like copying and filling.
See TextualObjects
, and Embargos
for methods like this (because media objects are TextualObject
and MutableEmbargo
- Since:
- 1.5
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAll
(@NonNull MediaObject mediaObject, Iterable<Location> i) protected static void
appendReason
(MediaObject media, String reason, Object... args) protected static void
autoCorrectPrediction
(Prediction prediction, MediaObject mediaObject) // TODO: I think is is a bit odd that this kind of logic happens here.static void
copy
(@NonNull MediaObject from, @NonNull MediaObject to) Copies most field values from one media object to another.static void
copyFull
(@NonNull MediaObject from, @NonNull MediaObject to) A more full copy, also copying field that you could normally would not copy, like MID.static void
copyFullProgram
(@NonNull Program from, @NonNull Program to) A more full copy, also copying field that you could normally not copy, like MID.protected static void
correctPrediction
(Prediction prediction, MediaObject mediaObject, nl.vpro.logging.simple.Level level, Instant now, BiConsumer<Prediction.State, Prediction> onChange) static <T extends MediaObject>
TdeepCopy
(T media) Perfomrs of deep copy of the media object, this is currently implemented by serializing/deserializing it.static boolean
equalsOnAnyId
(MediaObject first, MediaObject second) static boolean
equalsOnCrid
(MediaObject first, MediaObject second) static <T extends PublishableObject<?>>
TfilterOnWorkflow
(T object, Predicate<Workflow> predicate) static <T extends PublishableObject<?>>
TfilterPublishable
(T object, Instant now) Filters a PublishableObject.static SortedSet<ScheduleEvent>
filterScheduleEvents
(Collection<ScheduleEvent> events, Collection<Channel> channelList) static SortedSet<ScheduleEvent>
filterScheduleEvents
(Collection<ScheduleEvent> events, Channel... channels) static ScheduleEvent
findScheduleEvent
(Channel channel, LocalDateTime start, Collection<ScheduleEvent> events) static ScheduleEvent
findScheduleEvent
(Channel channel, Date start, Collection<ScheduleEvent> events) static ScheduleEvent
findScheduleEventHonoringOffset
(Program media, ScheduleEvent source) static void
forOwner
(MediaObject media, nl.vpro.domain.media.support.OwnerType owner) Sets the owner of all titles, descriptions, locations and images found in given MediaObjectgetAvailableLocation
(Platform platform, MediaObject m, Instant now) Determines if for a given platform, the media object has a location, and returns (one) if there is.static Channel
getChannel
(@NonNull Program program) Returns the channel associated with this program.static Stream<GTAARecord>
getGTAARecords
(MediaObject media) static String
getKijkwijzer
(@NonNull MediaObject media) getPath
(MediaObject parent, MediaObject child, List<? extends MediaObject> descendants) TODO: javadocgetPath
(MediaObject parent, MediaObject child, Map<String, MediaObject> descendants) static @Nullable Prediction
getPrediction
(Platform platform, @Nullable Collection<Prediction> preds) static Prediction
getPredictionOrNew
(Platform platform, Collection<Prediction> preds, Function<Platform, Prediction> constructor) static Relation
getRelation
(@NonNull MediaObject object, String relationType) static String
getRelationText
(@NonNull MediaObject object, String relationType) static SortedSet<ScheduleEvent>
getScheduleEvents
(MediaObject media) Returns theScheduleEvent
s associated with the media object.static Instant
getSortInstant
(@NonNull MediaObject mo) static TwitterRef
getTwitterAccount
(@NonNull MediaObject object) static TwitterRef
getTwitterHash
(@NonNull MediaObject object) static boolean
hasChannel
(Program media, Collection<Channel> channels) static boolean
hasChannel
(Program media, Channel... channels) static Long
static <T extends UpdatableIdentifiable<?,
T>>
voidstatic boolean
isPlayable
(MediaObject media) Whether this media object is playable in a NPO player.static boolean
isWebonly
(MediaObject media) protected static boolean
Returnfalse
if the given location is not actually playable.static boolean
markForDeletionIfNeeded
(@NonNull MediaObject media, @Pattern(regexp="[a-z, ]+",flags=CASE_INSENSITIVE) String reason) static boolean
markForRepublication
(@NonNull MediaObject media, String reason, Object... args) static boolean
markForUnDeletionIfNeeded
(@NonNull MediaObject media, String reason) static void
markPublished
(@NonNull MediaObject media, @NonNull Instant now) Marks the fields of the media object related to publishing as published.static void
markPublishedAndSetCorrectWorkflow
(@NonNull MediaObject media, @NonNull Instant now) Sets the workflow of the media object to the 'published' state version of the workflow (Workflow.isPublishable()
()}static void
matchBroadcasters
(BroadcasterService broadcasterService, MediaObject mediaObject) static void
mergeAudioAttributes
(AVAttributes incomingAttributes, AVAttributes attributesToUpdate) static void
mergeAvAttributes
(Location incomingLocation, Location locationToUpdate) static void
mergeVideoAttributes
(AVAttributes incomingAttributes, AVAttributes attributesToUpdate) nowPlayable
(@NonNull MediaObject mediaObject) On which platform the given mediaobject is currently playable.static boolean
nowPlayable
(@NonNull Platform platform, @NonNull MediaObject mediaObject) Whether the given mediaobject is now playable at given platformplayableRange
(@NonNull Platform platform, @NonNull MediaObject mediaObject) Returns for a certain platform the range it which a mediaobject is playable.playableRanges
(@NonNull MediaObject mediaObject) AsplayableRanges(MediaObject, ZoneId)
, but returning ranges ofInstant
, indicating absolute times.static Map<Platform,
com.google.common.collect.Range<LocalDateTime>> playableRanges
(@NonNull MediaObject mediaObject, ZoneId zoneId) Given aMediaObject
returns a map with for every platform for which that is relevant aRange
ofLocalDateTime
is return indicating the period this object is playable at that platformstatic void
removeLocations
(@NonNull MediaObject mediaObject) static int
static Workflow
setWorkflowPublished
(@NonNull MediaObject media) Sets the workflow of the mediaobject, and its subobjects to appropriate value for current date.static boolean
static boolean
trim
(@NonNull Collection<?> collection) protected static void
unappendReason
(MediaObject media, Predicate<String> reason) static <T extends MediaObject>
List<Location>updateAndRemoveLocationsForOwner
(T incomingMedia, T mediaToUpdate, Predicate<nl.vpro.domain.media.support.Ownable> owns, nl.vpro.domain.media.support.OwnerType owner) static <T extends MediaObject>
List<Location>updateAndRemoveLocationsForOwner
(T incomingMedia, T mediaToUpdate, nl.vpro.domain.media.support.OwnerType owner) static <T extends MediaObject>
voidupdateLocationsForOwner
(T incomingMedia, T mediaToUpdate, Predicate<nl.vpro.domain.media.support.Ownable> owns, nl.vpro.domain.media.support.OwnerType owner, boolean steal) static <T extends MediaObject>
voidupdateLocationsForOwner
(T incomingMedia, T mediaToUpdate, nl.vpro.domain.media.support.OwnerType owner, boolean steal) static Prediction
updatePrediction
(MediaObject media, Platform platform, Embargo embargo, Encryption drm) static Prediction
updatePrediction
(MediaObject media, Platform platform, Prediction.State state) wasPlayable
(@NonNull MediaObject mediaObject) static boolean
wasPlayable
(@NonNull Platform platform, @NonNull MediaObject mediaObject) willBePlayable
(@NonNull MediaObject mediaObject) static boolean
willBePlayable
(@NonNull Platform platform, @NonNull MediaObject mediaObject) Returns whether the mediaobject for given platform is now not playable, but will be.static Optional<LocalDateTime>
willBePlayableAt
(@NonNull Platform platform, @Nullable MediaObject mediaObject) Determines for a certainPlatform
s andMediaObject
when it might become playable.
-
Field Details
-
GROUPS
- Since:
- 7.7
-
ANY_MEDIA
A predicate onClass
to determine if it represents some poms media object. That isMediaObject
orMediaUpdate
- Since:
- 7.7
-
NO_GROUPS
- Since:
- 7.7
-
autoCorrectPredictions
public static boolean autoCorrectPredictions
-
-
Method Details
-
equalsOnAnyId
-
equalsOnCrid
-
forOwner
Sets the owner of all titles, descriptions, locations and images found in given MediaObject -
deepCopy
Perfomrs of deep copy of the media object, this is currently implemented by serializing/deserializing it. -
copy
Copies most field values from one media object to another.Principally, this should be all fields of which the value logically can exist on more than one mediaobject the same time, so not unique fields like id and mid.
Also, membership of groups will not be automatically filled. This would need write access on those objects.
ScheduleEvents, workflow, subtitles status are not copied too, since this would not make sense.
- See Also:
-
copyFull
A more full copy, also copying field that you could normally would not copy, like MID.The assumption is that both objects are not yet persistent, or e.g. a type conversion is happening
- Since:
- 5.11
- See Also:
-
copyFullProgram
A more full copy, also copying field that you could normally not copy, like MID.The assumption is that both objects are not yet persistent
- Since:
- 5.11
-
matchBroadcasters
public static void matchBroadcasters(BroadcasterService broadcasterService, MediaObject mediaObject) throws NotFoundException - Throws:
NotFoundException
-
hasChannel
-
hasChannel
-
findScheduleEventHonoringOffset
-
findScheduleEvent
public static ScheduleEvent findScheduleEvent(Channel channel, Date start, Collection<ScheduleEvent> events) -
findScheduleEvent
public static ScheduleEvent findScheduleEvent(Channel channel, LocalDateTime start, Collection<ScheduleEvent> events) -
filterScheduleEvents
public static SortedSet<ScheduleEvent> filterScheduleEvents(Collection<ScheduleEvent> events, Channel... channels) -
filterScheduleEvents
public static SortedSet<ScheduleEvent> filterScheduleEvents(Collection<ScheduleEvent> events, Collection<Channel> channelList) -
getChannel
Returns the channel associated with this program. That is the channel of the earliest schedule event that is not a rerun. -
getScheduleEvents
Returns theScheduleEvent
s associated with the media object.An empty collection for all non programs.
- Since:
- 5.11
-
getRelationText
- Since:
- 2.2.3
-
getRelation
- Since:
- 3.3.0
-
getTwitterHash
-
getTwitterAccount
-
getKijkwijzer
-
idFromUrn
-
removeLocations
-
addAll
-
getSortInstant
-
trim
-
integrate
public static <T extends UpdatableIdentifiable<?,T>> void integrate(@NonNull List<T> existing, @NonNull List<T> updates) -
markForRepublication
public static boolean markForRepublication(@NonNull MediaObject media, String reason, Object... args) -
markForDeletionIfNeeded
public static boolean markForDeletionIfNeeded(@NonNull MediaObject media, @Pattern(regexp="[a-z, ]+",flags=CASE_INSENSITIVE) @Pattern(regexp="[a-z, ]+",flags=CASE_INSENSITIVE) String reason) -
appendReason
-
unappendReason
-
markForUnDeletionIfNeeded
-
markPublished
Marks the fields of the media object related to publishing as published.the last publish instant will be set, and the reason and destinations will be cleared.
The workflow itself will remain untouched, and would be set to
Workflow.PUBLISHED
,Workflow.REVOKED
orWorkflow.MERGED
- See Also:
-
setWorkflowPublished
Sets the workflow of the mediaobject, and its subobjects to appropriate value for current date. -
removeUnpublishedSubObjects
- Since:
- 7.10
-
markPublishedAndSetCorrectWorkflow
public static void markPublishedAndSetCorrectWorkflow(@NonNull MediaObject media, @NonNull Instant now) Sets the workflow of the media object to the 'published' state version of the workflow (Workflow.isPublishable()
()}And calls
markPublished(MediaObject, Instant)
- Since:
- 5.20.2
-
getPrediction
public static @Nullable Prediction getPrediction(Platform platform, @Nullable Collection<Prediction> preds) -
getAvailableLocation
public static Optional<Location> getAvailableLocation(Platform platform, MediaObject m, Instant now) Determines if for a given platform, the media object has a location, and returns (one) if there is. If there is no location for a certain platform thePrediction.getState()
should bePrediction.State.REVOKED
,Prediction.State.ANNOUNCED
orPrediction.State.NOT_ANNOUNCED
.Otherwise, it must be
Prediction.State.REALIZED
;- Since:
- 5.32
-
getPlannedPlatformNamesInLowerCaseOrAll
-
getPredictionOrNew
public static Prediction getPredictionOrNew(Platform platform, Collection<Prediction> preds, Function<Platform, Prediction> constructor) -
updatePrediction
public static Prediction updatePrediction(MediaObject media, Platform platform, Prediction.State state) -
updatePrediction
public static Prediction updatePrediction(MediaObject media, Platform platform, Embargo embargo, Encryption drm) -
subtitlesMayBePublished
-
filterPublishable
Filters a PublishableObject. Removes all subobject which dont' have a correct workflow.TODO work in progress. This may replace the hibernate filter solution now in place.
-
filterOnWorkflow
public static <T extends PublishableObject<?>> T filterOnWorkflow(T object, Predicate<Workflow> predicate) -
isWebonly
-
getPath
public static Optional<List<MemberRef>> getPath(MediaObject parent, MediaObject child, List<? extends MediaObject> descendants) TODO: javadoc -
updateLocationsForOwner
public static <T extends MediaObject> void updateLocationsForOwner(T incomingMedia, T mediaToUpdate, Predicate<nl.vpro.domain.media.support.Ownable> owns, nl.vpro.domain.media.support.OwnerType owner, boolean steal) -
updateLocationsForOwner
public static <T extends MediaObject> void updateLocationsForOwner(T incomingMedia, T mediaToUpdate, nl.vpro.domain.media.support.OwnerType owner, boolean steal) -
updateAndRemoveLocationsForOwner
public static <T extends MediaObject> List<Location> updateAndRemoveLocationsForOwner(T incomingMedia, T mediaToUpdate, Predicate<nl.vpro.domain.media.support.Ownable> owns, nl.vpro.domain.media.support.OwnerType owner) -
updateAndRemoveLocationsForOwner
public static <T extends MediaObject> List<Location> updateAndRemoveLocationsForOwner(T incomingMedia, T mediaToUpdate, nl.vpro.domain.media.support.OwnerType owner) -
mergeAvAttributes
-
mergeAudioAttributes
public static void mergeAudioAttributes(AVAttributes incomingAttributes, AVAttributes attributesToUpdate) -
mergeVideoAttributes
public static void mergeVideoAttributes(AVAttributes incomingAttributes, AVAttributes attributesToUpdate) -
getPath
protected static Optional<List<MemberRef>> getPath(MediaObject parent, MediaObject child, Map<String, MediaObject> descendants) -
getMemberRefs
-
getPersons
-
getGTAARecords
-
isPlayable
Whether this media object is playable in a NPO player.- Since:
- 5.11
-
nowPlayable
Whether the given mediaobject is now playable at given platform- Since:
- 5.31
-
nowPlayable
On which platform the given mediaobject is currently playable.- Since:
- 5.31
-
wasPlayable
- Since:
- 5.31
-
wasPlayable
- Since:
- 5.31
-
willBePlayable
Returns whether the mediaobject for given platform is now not playable, but will be.- Since:
- 5.31
-
willBePlayableAt
public static Optional<LocalDateTime> willBePlayableAt(@NonNull Platform platform, @Nullable MediaObject mediaObject) Determines for a certainPlatform
s andMediaObject
when it might become playable.- Since:
- 5.31
-
willBePlayable
- Since:
- 5.31
-
playableRange
public static Optional<com.google.common.collect.Range<Instant>> playableRange(@NonNull Platform platform, @NonNull MediaObject mediaObject) Returns for a certain platform the range it which a mediaobject is playable. -
playableRanges
public static Map<Platform,com.google.common.collect.Range<LocalDateTime>> playableRanges(@NonNull MediaObject mediaObject, ZoneId zoneId) Given aMediaObject
returns a map with for every platform for which that is relevant aRange
ofLocalDateTime
is return indicating the period this object is playable at that platform- Parameters:
zoneId
- The timezone for which this must be evaluated ornull
, to fall back toSchedule.ZONE_ID
- Since:
- 5.31
-
playableRanges
public static Map<Platform,com.google.common.collect.Range<Instant>> playableRanges(@NonNull MediaObject mediaObject) AsplayableRanges(MediaObject, ZoneId)
, but returning ranges ofInstant
, indicating absolute times.- Since:
- 5.31
- See Also:
-
locationFilter
Returnfalse
if the given location is not actually playable.Either it is
PublishableObject.isDeleted()
, which may occur if dealing with unpublished data, or we're dealing with some legacy and the location has a format which is known not to be playable any-more (like WMV)- Since:
- 5.31
-
autoCorrectPrediction
// TODO: I think is is a bit odd that this kind of logic happens here. It ensures consistency, that's the good thing, but it seems a patch any way! -
correctPrediction
protected static void correctPrediction(Prediction prediction, MediaObject mediaObject, nl.vpro.logging.simple.Level level, Instant now, BiConsumer<Prediction.State, Prediction> onChange)
-