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

nl.vpro.domain.media.TargetGroups Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 8.3.1
Show newest version
package nl.vpro.domain.media;

import lombok.Getter;
import lombok.Setter;
import lombok.Singular;

import java.io.Serial;
import java.util.List;
import java.util.stream.Collectors;

import jakarta.persistence.Entity;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;

import org.checkerframework.checker.nullness.qual.NonNull;

import com.fasterxml.jackson.annotation.JsonIgnore;

import nl.vpro.domain.media.support.AbstractMediaObjectOwnableList;
import nl.vpro.domain.media.support.OwnerType;

@Entity
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "targetGroupsType")
@Getter
@Setter
public class TargetGroups  extends AbstractMediaObjectOwnableList {

    @Serial
    private static final long serialVersionUID = -4237232154628528835L;

    public TargetGroups() {}

    public static TargetGroups empty(@NonNull  OwnerType owner) {
        return TargetGroups.builder().owner(owner).build();
    }

    @lombok.Builder(builderClassName = "Builder")
    private TargetGroups(
        @NonNull @Singular  List values,
        @NonNull OwnerType owner) {
        this.values = values.stream().map(TargetGroup::new).collect(Collectors.toList());
        this.owner = owner;
        //To help Hibernate understand the relationship we
        //explicitly set the parent!
        this.values.forEach(v -> v.setParent(this));
    }

    @Override
    @NonNull
    @XmlElement(name="targetGroup")
    @JsonIgnore
    public List getValues() {
        return values;
    }

    public void setValues(List list) {
        this.values = list;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy