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

io.imunity.rest.mappers.registration.RegistrationContextMapper Maven / Gradle / Ivy

There is a newer version: 4.0.4
Show newest version
/*
 * Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package io.imunity.rest.mappers.registration;

import java.util.Optional;

import io.imunity.rest.api.types.registration.RestRegistrationContext;
import pl.edu.icm.unity.base.registration.RegistrationContext;
import pl.edu.icm.unity.base.registration.RegistrationContext.TriggeringMode;

public class RegistrationContextMapper
{
	public static RestRegistrationContext map(RegistrationContext registrationContext)
	{
		return RestRegistrationContext.builder()
				.withIsOnIdpEndpoint(registrationContext.isOnIdpEndpoint)
				.withTriggeringMode(Optional.ofNullable(registrationContext.triggeringMode)
						.map(t -> t.name())
						.orElse(null))
				.build();
	}

	public static RegistrationContext map(RestRegistrationContext restRegistrationContext)
	{
		return new RegistrationContext(restRegistrationContext.isOnIdpEndpoint,
				Optional.ofNullable(restRegistrationContext.triggeringMode)
						.map(TriggeringMode::valueOf)
						.orElse(null));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy