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

com.eurodyn.qlack.fuse.aaa.mappers.UserGroupHasOperationMapperImpl Maven / Gradle / Ivy

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

import com.eurodyn.qlack.fuse.aaa.dto.UserGroupDTO;
import com.eurodyn.qlack.fuse.aaa.dto.UserGroupHasOperationDTO;
import com.eurodyn.qlack.fuse.aaa.model.UserGroup;
import com.eurodyn.qlack.fuse.aaa.model.UserGroupHasOperation;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Generated;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2019-05-03T08:55:23+0000",
    comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_161 (Oracle Corporation)"
)
@Component
public class UserGroupHasOperationMapperImpl implements UserGroupHasOperationMapper {

    @Autowired
    private OperationMapper operationMapper;

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

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

        return list;
    }

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

        UserGroupHasOperation userGroupHasOperation = new UserGroupHasOperation();

        userGroupHasOperation.setId( dto.getId() );
        userGroupHasOperation.setDeny( dto.isDeny() );

        return userGroupHasOperation;
    }

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

        entity.setId( dto.getId() );
        entity.setDeny( dto.isDeny() );
    }

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

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

        return list;
    }

    @Override
    public UserGroupHasOperationDTO mapToDTO(UserGroupHasOperation userGroupHasOperation) {
        if ( userGroupHasOperation == null ) {
            return null;
        }

        UserGroupHasOperationDTO userGroupHasOperationDTO = new UserGroupHasOperationDTO();

        userGroupHasOperationDTO.setOperationDTO( operationMapper.mapToDTO( userGroupHasOperation.getOperation() ) );
        userGroupHasOperationDTO.setUserGroupDTO( userGroupToUserGroupDTO( userGroupHasOperation.getUserGroup() ) );
        userGroupHasOperationDTO.setId( userGroupHasOperation.getId() );
        userGroupHasOperationDTO.setDeny( userGroupHasOperation.isDeny() );

        return userGroupHasOperationDTO;
    }

    protected Set userGroupListToUserGroupDTOSet(List list) {
        if ( list == null ) {
            return null;
        }

        Set set = new HashSet( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
        for ( UserGroup userGroup : list ) {
            set.add( userGroupToUserGroupDTO( userGroup ) );
        }

        return set;
    }

    protected UserGroupDTO userGroupToUserGroupDTO(UserGroup userGroup) {
        if ( userGroup == null ) {
            return null;
        }

        UserGroupDTO userGroupDTO = new UserGroupDTO();

        userGroupDTO.setId( userGroup.getId() );
        userGroupDTO.setName( userGroup.getName() );
        userGroupDTO.setObjectId( userGroup.getObjectId() );
        userGroupDTO.setDescription( userGroup.getDescription() );
        userGroupDTO.setChildren( userGroupListToUserGroupDTOSet( userGroup.getChildren() ) );

        return userGroupDTO;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy