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

nl.vpro.domain.media.update.GeoLocationUpdate 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.update;

import lombok.Getter;

import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;

import org.apache.commons.lang3.builder.ToStringBuilder;

import nl.vpro.domain.media.GeoLocation;
import nl.vpro.domain.media.GeoRoleType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "geoLocationUpdateType")
@XmlRootElement(name = "geoLocation")
public class GeoLocationUpdate {

    @XmlAttribute(required = true)
    @Getter
    private String gtaaUri;

    @XmlAttribute(required = true)
    @Enumerated(EnumType.STRING)
    @Getter
    protected GeoRoleType role;

    public GeoLocationUpdate(String gtaaUri, GeoRoleType role) {
        this.gtaaUri = gtaaUri;
        this.role = role;
    }

    public GeoLocationUpdate(GeoLocation geoLocation) {
        this(geoLocation.getGtaaUri(), geoLocation.getRole());
    }

    public GeoLocationUpdate() {
        // needed for jaxb
    }

    public GeoLocation toGeoLocation() {
        return GeoLocation.builder().uri(gtaaUri).role(role).build();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
            .append("gtaaUri", gtaaUri)
            .append("role", role)
            .toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy