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

com.megaport.api.dto.notifications.NotificationPreferencesDto Maven / Gradle / Ivy

The newest version!
package com.megaport.api.dto.notifications;

import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonGetter;

public class NotificationPreferencesDto {

	private EnumMap> destinations;

	public NotificationPreferencesDto() {
		destinations = new EnumMap<>(MessageDestination.class);
	}

	public NotificationPreferencesDto(MessageDestination messageDestination,
	                                  List preferences) {
		this();
		addPreferences(preferences, messageDestination);
	}

	public void addPreferences(List preferences, MessageDestination forDestination) {
		List existing = destinations.get(forDestination);
		if (existing == null) {
			existing = new ArrayList<>();
		}
		existing.addAll(preferences);
	}

	public void addPreference(MessageGroupPreferencesDto preference, MessageDestination forDestination) {
		addPreferences(Collections.singletonList(preference), forDestination);
	}


	@JsonGetter
	public EnumMap> getDestinations() {
		return destinations;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy