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

nl.vpro.domain.constraint.media.HasPredictionConstraint 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 lombok.Getter;
import lombok.Setter;

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

import nl.vpro.domain.constraint.ExistsConstraint;
import nl.vpro.domain.media.MediaObject;
import nl.vpro.domain.media.Platform;

/**
 * @author Rico Jansen
 * @since 3.1
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "hasPredictionConstraintType")
public class HasPredictionConstraint implements ExistsConstraint {

    @XmlAttribute
    @Getter
    @Setter
    private Platform platform;

    @Override
    public String getESPath() {
        return "predictions.platform";
    }

    @Override
    public boolean test(MediaObject input) {
        if (platform == null) {
            return !input.getPredictions().isEmpty();
        } else {
            return input.getPrediction(platform) != null;
        }
    }

    @Override
    public String toString() {
        return getClass().getSimpleName();
    }



}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy