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

nl.vpro.domain.api.profile.ProfileRepository Maven / Gradle / Ivy

package nl.vpro.domain.api.profile;

import java.time.Instant;
import java.util.Map;
import java.util.SortedSet;

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

import nl.vpro.domain.media.MediaObject;
import nl.vpro.domain.page.Page;

/**
 * @author Michiel Meeuwissen
 * @since 2.0
 */
public interface ProfileRepository {

    @Nullable
    default SortedSet getProfiles(String name) {
        if (name == null) {
            return null;
        }
        return getProfiles().get(name);
    }

    Map> getProfiles();


    default  ProfileDefinition getPageProfileDefinition(String name) {
        if (name == null) {
            return null;
        }
        SortedSet definitions = getProfiles(name);
        Profile profile = definitions == null || definitions.isEmpty() ? null : definitions.first();
        return profile != null ? profile.getPageProfile() : null;
    }

    default  ProfileDefinition getMediaProfileDefinition(String name) {
        SortedSet definitions = getProfiles(name);
        Profile profile = definitions == null || definitions.isEmpty() ? null : definitions.first();
        return profile != null ? profile.getMediaProfile() : null;
    }

    default ProfileDefinition getMediaProfileDefinition(String name, Instant since) {
        throw new UnsupportedOperationException();
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy