nl.vpro.domain.media.search.MediaSortField 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.search;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import nl.vpro.domain.media.*;
import nl.vpro.domain.media.support.Image;
import nl.vpro.domain.media.support.OwnerType;
import static nl.vpro.domain.media.search.SortField.Type.INSTANT;
/**
* @author Michiel Meeuwissen
* @since 5.0
*/
public enum MediaSortField implements SortField {
sortTitle(Type.STRING, null, "titles.main"),
sortTitle_NPO(Type.STRING, null, "titles_NPO.main"),
mid(Type.STRING),
/**
* @deprecated use {@link #mediaType} instead
*/
@Deprecated
type(Type.STRING, null),
mediaType(Type.STRING) {
@Override
public String[] derivedFrom(Class extends MediaObject> clazz) {
return new String[] {"type"};
}
@Override
public Optional nulls() {
return Optional.of(MediaType.MEDIA.name());
}
},
sortDate(INSTANT, "sortInstant", null) {
@Override
public String[] derivedFrom(Class extends MediaObject> clazz) {
if (clazz.equals(Program.class)) {
return new String[]{"scheduleEvents", "creationInstant"};
} else if (clazz.equals(Segment.class)) {
return new String[]{"parent"};
} else {
return super.derivedFrom(clazz);
}
}
@Override
public Set> forClasses() {
return Set.of(Program.class, Segment.class, Group.class);
}
},
lastModified(INSTANT),
creationDate(INSTANT, "creationInstant", "creationDate"),
publishStop(INSTANT) {
@Override
public Optional nulls() {
return Optional.of(MAX_INSTANT);
}
},
publishStart(INSTANT) {
@Override
public Optional nulls() {
return Optional.of(MIN_INSTANT);
}
},
lastPublished(INSTANT),
lastModifiedBy(Type.STRING, null, null),
createdBy(Type.STRING, null, null),
/**
* Sort on location count
*/
locations(Type.COUNT, "locations", "locationCount"),
/**
* @since 7.12
*/
publishedLocations(Type.COUNT, "locations", "locationPublishedCount") {
@Override
public Predicate