nl.vpro.domain.constraint.page.BroadcasterConstraint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-domain Show documentation
Show all versions of api-domain Show documentation
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.page;
import jakarta.validation.constraints.Size;
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.page.Page;
import nl.vpro.domain.user.Broadcaster;
/**
* @author Roelof Jan Koekoek
* @since 2.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "broadcasterConstraintType")
public class BroadcasterConstraint extends AbstractTextConstraint {
public BroadcasterConstraint() {
caseHandling = CaseHandling.ASIS;
}
@lombok.Builder
public BroadcasterConstraint(String value) {
super(value);
caseHandling = CaseHandling.ASIS;
}
@Override
@Size(min = 1, max = 255, message = "2 < id < 256")
@jakarta.validation.constraints.Pattern(regexp = "[A-Z0-9_-]{2,}", message = "type should conform to: [A-Z0-9_-]{2,}")
public void setValue(String v) {
super.setValue(v);
}
@Override
public String getESPath() {
return "broadcasters.id";
}
@Override
public boolean test(Page input) {
for(Broadcaster broadcaster : input.getBroadcasters()) {
if(value.equals(broadcaster.getDisplayName())) {
return true;
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy