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

com.eurodyn.qlack.fuse.aaa.mapper.SessionAttributeMapperImpl Maven / Gradle / Ivy

There is a newer version: 3.8.9
Show newest version
package com.eurodyn.qlack.fuse.aaa.mapper;

import com.eurodyn.qlack.fuse.aaa.dto.SessionAttributeDTO;
import com.eurodyn.qlack.fuse.aaa.model.Session;
import com.eurodyn.qlack.fuse.aaa.model.SessionAttribute;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2020-01-23T10:00:01+0000",
    comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_232 (Private Build)"
)
@Component
public class SessionAttributeMapperImpl implements SessionAttributeMapper {

    @Override
    public List mapToDTO(List entity) {
        if ( entity == null ) {
            return null;
        }

        List list = new ArrayList( entity.size() );
        for ( SessionAttribute sessionAttribute : entity ) {
            list.add( mapToDTO( sessionAttribute ) );
        }

        return list;
    }

    @Override
    public SessionAttribute mapToEntity(SessionAttributeDTO dto) {
        if ( dto == null ) {
            return null;
        }

        SessionAttribute sessionAttribute = new SessionAttribute();

        sessionAttribute.setId( dto.getId() );
        sessionAttribute.setName( dto.getName() );
        sessionAttribute.setValue( dto.getValue() );

        return sessionAttribute;
    }

    @Override
    public void mapToExistingEntity(SessionAttributeDTO dto, SessionAttribute entity) {
        if ( dto == null ) {
            return;
        }

        entity.setId( dto.getId() );
        entity.setName( dto.getName() );
        entity.setValue( dto.getValue() );
    }

    @Override
    public List mapToEntity(List dto) {
        if ( dto == null ) {
            return null;
        }

        List list = new ArrayList( dto.size() );
        for ( SessionAttributeDTO sessionAttributeDTO : dto ) {
            list.add( mapToEntity( sessionAttributeDTO ) );
        }

        return list;
    }

    @Override
    public SessionAttributeDTO mapToDTO(SessionAttribute sessionAttribute) {
        if ( sessionAttribute == null ) {
            return null;
        }

        SessionAttributeDTO sessionAttributeDTO = new SessionAttributeDTO();

        sessionAttributeDTO.setSessionId( sessionAttributeSessionId( sessionAttribute ) );
        sessionAttributeDTO.setId( sessionAttribute.getId() );
        sessionAttributeDTO.setName( sessionAttribute.getName() );
        sessionAttributeDTO.setValue( sessionAttribute.getValue() );

        return sessionAttributeDTO;
    }

    private String sessionAttributeSessionId(SessionAttribute sessionAttribute) {
        if ( sessionAttribute == null ) {
            return null;
        }
        Session session = sessionAttribute.getSession();
        if ( session == null ) {
            return null;
        }
        String id = session.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy