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

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

Go to download

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

The newest version!
/*
 * Copyright (C) 2013 Licensed under the Apache License, Version 2.0
 * VPRO The Netherlands
 */
package nl.vpro.domain.constraint.media;

import org.checkerframework.checker.nullness.qual.Nullable;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;

import nl.vpro.domain.constraint.AbstractTextConstraint;
import nl.vpro.domain.media.MediaObject;
import nl.vpro.domain.user.Portal;

/**
 * @author Michiel Meeuwissen
 * @since 3.1
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "portalConstraintType")
public class PortalConstraint extends AbstractTextConstraint {

    public PortalConstraint() {
        caseHandling = CaseHandling.ASIS;
    }

    @lombok.Builder
    public PortalConstraint(Portal value) {
        super(value.getId());
        caseHandling = CaseHandling.ASIS;
    }

    @Override
    public String getESPath() {
        return "portals.id";
    }

    @Override
    public boolean test(@Nullable MediaObject input) {
        if (input == null) return false;
        for (Portal e : input.getPortals()) {
            if (value.equals(e.getId())) {
                return true;
            }
        }
        return false;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy