nl.vpro.domain.media.RecursiveParentChildRelation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of media-domain Show documentation
Show all versions of media-domain Show documentation
The basic domain classes for 'media', the core of POMS. Also, the 'update' XML bindings for it.
It also contains some closely related domain classes like the enum to contain NICAM kijkwijzer settings.
package nl.vpro.domain.media;
import java.util.SortedSet;
import java.util.TreeSet;
/**
*
*
* @author Michiel Meeuwissen
* @since 5.13.1
*/
public interface RecursiveParentChildRelation extends ParentChildRelation {
SortedSet getMemberOf();
void setMemberOf(SortedSet memberOf);
default SortedSet getOrCreateMemberOf() {
if (getMemberOf() == null) {
setMemberOf(new TreeSet<>());
}
return getMemberOf();
}
SortedSet getEpisodeOf();
void setEpisodeOf(SortedSet episodeOf);
default SortedSet getOrCreateEpisodeOf() {
if (getEpisodeOf() == null) {
setEpisodeOf(new TreeSet<>());
}
return getEpisodeOf();
}
default SortedSet getOrCreate(StandaloneMemberRef.ObjectType type) {
switch(type) {
case memberRef: return getOrCreateMemberOf();
case episodeRef: return getOrCreateEpisodeOf();
}
throw new UnsupportedOperationException();
}
RecursiveMemberRef getSegmentOf();
void setSegmentOf(RecursiveMemberRef recursiveMemberRef);
}