Search in sources :

Example 6 with BaseDto

use of eu.bcvsolutions.idm.core.api.dto.BaseDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmIdentityRoleService method toDto.

@Override
protected IdmIdentityRoleDto toDto(IdmIdentityRole entity, IdmIdentityRoleDto dto) {
    dto = super.toDto(entity, dto);
    if (dto == null) {
        return null;
    }
    // 
    IdmAutomaticRole automaticRole = entity.getAutomaticRole();
    if (automaticRole != null) {
        dto.setRoleTreeNode(automaticRole.getId());
        dto.setAutomaticRole(true);
        BaseDto baseDto = null;
        Map<String, BaseDto> embedded = dto.getEmbedded();
        if (automaticRole instanceof IdmAutomaticRoleAttribute) {
            baseDto = lookupService.getDtoService(IdmAutomaticRoleAttributeDto.class).get(automaticRole.getId());
        } else {
            baseDto = lookupService.getDtoService(IdmRoleTreeNodeDto.class).get(automaticRole.getId());
        }
        embedded.put(IdmAutomaticRoleAttributeService.ROLE_TREE_NODE_ATTRIBUTE_NAME, baseDto);
        dto.setEmbedded(embedded);
    }
    // 
    return dto;
}
Also used : IdmAutomaticRole(eu.bcvsolutions.idm.core.model.entity.IdmAutomaticRole) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) IdmAutomaticRoleAttribute(eu.bcvsolutions.idm.core.model.entity.IdmAutomaticRoleAttribute)

Aggregations

BaseDto (eu.bcvsolutions.idm.core.api.dto.BaseDto)6 Embedded (eu.bcvsolutions.idm.core.api.domain.Embedded)2 AbstractDto (eu.bcvsolutions.idm.core.api.dto.AbstractDto)2 BaseEntity (eu.bcvsolutions.idm.core.api.entity.BaseEntity)2 CoreException (eu.bcvsolutions.idm.core.api.exception.CoreException)2 IdmAutomaticRole (eu.bcvsolutions.idm.core.model.entity.IdmAutomaticRole)2 IdmAutomaticRoleAttribute (eu.bcvsolutions.idm.core.model.entity.IdmAutomaticRoleAttribute)2 Field (java.lang.reflect.Field)2 ArrayList (java.util.ArrayList)2 UUID (java.util.UUID)2 PropertyMapping (org.modelmapper.spi.PropertyMapping)2 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)1 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)1 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)1 WorkflowTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)1 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)1 Serializable (java.io.Serializable)1 List (java.util.List)1 Task (org.activiti.engine.task.Task)1 TaskQuery (org.activiti.engine.task.TaskQuery)1