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

io.imunity.rest.mappers.registration.RegistrationFormLayoutsMapper 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.RestRegistrationFormLayouts;
import io.imunity.rest.mappers.registration.layout.FormLayoutMapper;
import pl.edu.icm.unity.base.registration.RegistrationFormLayouts;

public class RegistrationFormLayoutsMapper
{
	public static RestRegistrationFormLayouts map(RegistrationFormLayouts registrationFormLayouts)
	{

		return RestRegistrationFormLayouts.builder()
				.withLocalSignupEmbeddedAsButton(registrationFormLayouts.isLocalSignupEmbeddedAsButton())
				.withPrimaryLayout(Optional.ofNullable(registrationFormLayouts.getPrimaryLayout())
						.map(FormLayoutMapper::map)
						.orElse(null))
				.withSecondaryLayout(Optional.ofNullable(registrationFormLayouts.getSecondaryLayout())
						.map(FormLayoutMapper::map)
						.orElse(null))
				.build();
	}

	public static RegistrationFormLayouts map(RestRegistrationFormLayouts restRegistrationFormLayouts)
	{
		RegistrationFormLayouts registrationFormLayouts = new RegistrationFormLayouts();
		registrationFormLayouts.setLocalSignupEmbeddedAsButton(restRegistrationFormLayouts.localSignupEmbeddedAsButton);
		registrationFormLayouts.setPrimaryLayout(Optional.ofNullable(restRegistrationFormLayouts.primaryLayout)
				.map(FormLayoutMapper::map)
				.orElse(null));
		registrationFormLayouts.setSecondaryLayout(Optional.ofNullable(restRegistrationFormLayouts.secondaryLayout)
				.map(FormLayoutMapper::map)
				.orElse(null));
		return registrationFormLayouts;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy