All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.domain.constraint.media.ChannelConstraint Maven / Gradle / Ivy

Go to download

Contains the objects used by the Frontend API, like forms and result objects

There is a newer version: 8.3.3
Show newest version
/*
 * Copyright (C) 2013 All rights reserved
 * VPRO The Netherlands
 */
package nl.vpro.domain.constraint.media;

import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

import nl.vpro.domain.constraint.EnumConstraint;
import nl.vpro.domain.media.Channel;
import nl.vpro.domain.media.MediaObject;
import nl.vpro.domain.media.Program;
import nl.vpro.domain.media.ScheduleEvent;

/**
 * @author Michiel Meeuwissen
 * @since 3.1
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "channelConstraintType")
public class ChannelConstraint extends EnumConstraint {

    public ChannelConstraint() {
        super(Channel.class);
    }

    public ChannelConstraint(Channel value) {
        super(Channel.class, value);
    }

    @Override
    public String getESPath() {
        return "scheduleEvents.channel";
    }

    @Override
    protected Collection getEnumValues(MediaObject input) {
        if (input instanceof Program) {
            return ((Program) input).getScheduleEvents().stream().map(ScheduleEvent::getChannel).collect(Collectors.toList());
        } else {
            return Collections.emptyList();
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy