55 lines
3.5 KiB
Java
55 lines
3.5 KiB
Java
package com.jkgroller.identitymanagement.converter;
|
|
|
|
import com.jkgroller.identitymanagement.entity.AuthenticatedSessionEntity;
|
|
import com.jkgroller.identitymanagement.entity.IndividualCustomerEntity;
|
|
import com.jkgroller.identitymanagement.entity.OnlineAccountEntity;
|
|
import com.jkgroller.identitymanagement.meta.OnlineAccountMeta;
|
|
import com.jkgroller.identitymanagement.resource.AuthenticatedSessionResource;
|
|
import com.jkgroller.identitymanagement.resource.IndividualCustomerResource;
|
|
import com.jkgroller.identitymanagement.resource.OnlineAccountResource;
|
|
import org.mapstruct.*;
|
|
|
|
import java.util.List;
|
|
|
|
@Mapper(componentModel = "spring")
|
|
public interface IdentityManagementConverter {
|
|
|
|
@Mapping(target = "id", source = "identifier")
|
|
@Mapping(target = "dbId", source = "id")
|
|
AuthenticatedSessionResource authenticatedSessionEntityToAuthenticatedSessionResource(AuthenticatedSessionEntity authenticatedSessionEntity, @Context CycleAvoidingMappingContext context);
|
|
List<AuthenticatedSessionResource> authenticatedSessionEntitiesToAuthenticatedSessionResources(List<AuthenticatedSessionEntity> authenticatedSessionEntities, @Context CycleAvoidingMappingContext context);
|
|
|
|
@Mapping(target = "identifier", source = "id")
|
|
@Mapping(target = "id", source = "dbId")
|
|
AuthenticatedSessionEntity authenticatedSessionResourceToAuthenticatedSessionEntity(AuthenticatedSessionResource authenticatedSessionResource, @Context CycleAvoidingMappingContext context);
|
|
|
|
@Mapping(target = "id", source = "identifier")
|
|
@Mapping(target = "dbId", source = "id")
|
|
IndividualCustomerResource individualCustomerEntityToIndividualCustomerResource(IndividualCustomerEntity individualCustomerEntity, @Context CycleAvoidingMappingContext context);
|
|
List<IndividualCustomerResource> individualCustomerEntitiesToIndividualCustomerResources(List<IndividualCustomerEntity> individualCustomerEntities, @Context CycleAvoidingMappingContext context);
|
|
|
|
@Mapping(target = "identifier", source = "id")
|
|
@Mapping(target = "id", source = "dbId")
|
|
IndividualCustomerEntity individualCustomerResourceToIndividualCustomerEntity(IndividualCustomerResource individualCustomerResource, @Context CycleAvoidingMappingContext context);
|
|
|
|
@Mapping(target = "identifier", source = "id")
|
|
@Mapping(target = "id", source = "dbId")
|
|
@Mapping(target = "accountStatus", source = "onlineAccountMeta.accountStatus")
|
|
@Mapping(target = "passwordStatus", source = "onlineAccountMeta.passwordStatus")
|
|
OnlineAccountEntity onlineAccountResourceToOnlineAccountEntity(OnlineAccountResource onlineAccountResource, @Context CycleAvoidingMappingContext context);
|
|
|
|
@Mapping(target = "id", source = "identifier")
|
|
@Mapping(target = "dbId", source = "id")
|
|
OnlineAccountResource onlineAccountEntityToOnlineAccountResource(OnlineAccountEntity onlineAccountEntity, @Context CycleAvoidingMappingContext context);
|
|
List<OnlineAccountResource> onlineAccountEntitiesToOnlineAccountResources(List<OnlineAccountEntity> onlineAccountEntities, @Context CycleAvoidingMappingContext context);
|
|
|
|
@AfterMapping
|
|
default void setOnlineAccountResourceMeta(OnlineAccountEntity onlineAccountEntity, @MappingTarget OnlineAccountResource onlineAccountResource) {
|
|
OnlineAccountMeta onlineAccountMeta = new OnlineAccountMeta();
|
|
onlineAccountMeta.setAccountStatus(onlineAccountEntity.getAccountStatus());
|
|
onlineAccountMeta.setPasswordStatus(onlineAccountEntity.getPasswordStatus());
|
|
onlineAccountResource.setOnlineAccountMeta(onlineAccountMeta);
|
|
}
|
|
|
|
}
|