Search in sources :

Example 1 with IdmDelegationFilter

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

the class AbstractDelegationType method delegate.

@Override
public IdmDelegationDto delegate(BaseDto owner, IdmDelegationDefinitionDto definition) {
    IdmDelegationFilter delegationFilter = new IdmDelegationFilter();
    delegationFilter.setOwnerId(DtoUtils.toUuid(owner.getId()));
    delegationFilter.setOwnerType(owner.getClass().getCanonicalName());
    delegationFilter.setDelegationDefinitionId(definition.getId());
    // Check if same delegation already exists.
    IdmDelegationDto delegation = delegationService.find(delegationFilter, null).getContent().stream().findFirst().orElse(null);
    if (delegation != null) {
        LOG.debug("Delegation [{}] for definition [{}] and owner [{}],[{}] already exists.", delegation.getId(), definition.getId(), owner.getId(), owner.getClass().getSimpleName());
        return delegation;
    }
    delegation = new IdmDelegationDto();
    delegation.setOwnerState(new OperationResultDto(OperationState.RUNNING));
    delegation.setDefinition(definition.getId());
    delegation.setOwnerId(DtoUtils.toUuid(owner.getId()));
    delegation.setOwnerType(owner.getClass().getCanonicalName());
    return delegationService.save(delegation);
}
Also used : OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IdmDelegationDto(eu.bcvsolutions.idm.core.api.dto.IdmDelegationDto) IdmDelegationFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmDelegationFilter)

Example 2 with IdmDelegationFilter

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

the class ManualTaskDelegationType method delegate.

@Override
public IdmDelegationDto delegate(BaseDto owner, IdmDelegationDefinitionDto definition) {
    IdmDelegationFilter delegationFilter = new IdmDelegationFilter();
    delegationFilter.setOwnerId(DtoUtils.toUuid(owner.getId()));
    delegationFilter.setOwnerType(owner.getClass().getCanonicalName());
    delegationFilter.setDelegationDefinitionId(definition.getId());
    // Check if same delegation already exists is for manual delegatio disabled.
    IdmDelegationDto delegation = new IdmDelegationDto();
    delegation.setOwnerState(new OperationResultDto(OperationState.RUNNING));
    delegation.setDefinition(definition.getId());
    delegation.setOwnerId(DtoUtils.toUuid(owner.getId()));
    delegation.setOwnerType(owner.getClass().getCanonicalName());
    return delegationService.save(delegation);
}
Also used : OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IdmDelegationDto(eu.bcvsolutions.idm.core.api.dto.IdmDelegationDto) IdmDelegationFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmDelegationFilter)

Example 3 with IdmDelegationFilter

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

the class IdmDelegationController method toFilter.

@Override
protected IdmDelegationFilter toFilter(MultiValueMap<String, Object> parameters) {
    IdmDelegationFilter filter = new IdmDelegationFilter(parameters, getParameterConverter());
    filter.setIncludeOwner(true);
    return filter;
}
Also used : IdmDelegationFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmDelegationFilter)

Example 4 with IdmDelegationFilter

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

the class DefaultIdmDelegationDefinitionService method deleteInternal.

@Override
@Transactional
public void deleteInternal(IdmDelegationDefinitionDto dto) {
    Assert.notNull(dto.getId(), "ID cannot be null!");
    // Referential integrity - delete all delegations for that definition.
    IdmDelegationFilter delegationFilter = new IdmDelegationFilter();
    delegationFilter.setDelegationDefinitionId(dto.getId());
    delegationService.find(delegationFilter, null).getContent().forEach(delegation -> delegationService.delete(delegation));
    super.deleteInternal(dto);
}
Also used : IdmDelegationFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmDelegationFilter) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with IdmDelegationFilter

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

the class DefaultDelegationManager method findDelegationForOwner.

@Override
public List<IdmDelegationDto> findDelegationForOwner(BaseDto owner, BasePermission... permission) {
    Assert.notNull(owner, "Owner cannot be null!");
    IdmDelegationFilter delegationFilter = new IdmDelegationFilter();
    delegationFilter.setOwnerId(DtoUtils.toUuid(owner.getId()));
    delegationFilter.setOwnerType(owner.getClass().getCanonicalName());
    return delegationService.find(delegationFilter, null, permission).getContent();
}
Also used : IdmDelegationFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmDelegationFilter)

Aggregations

IdmDelegationFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmDelegationFilter)6 IdmDelegationDto (eu.bcvsolutions.idm.core.api.dto.IdmDelegationDto)3 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)3 IdmDelegationDefinitionDto (eu.bcvsolutions.idm.core.api.dto.IdmDelegationDefinitionDto)1 WorkflowTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)1 UUID (java.util.UUID)1 ActivitiActivityCancelledEvent (org.activiti.engine.delegate.event.ActivitiActivityCancelledEvent)1 ActivitiEntityEventImpl (org.activiti.engine.delegate.event.impl.ActivitiEntityEventImpl)1 HistoricTaskInstanceEntity (org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity)1 TaskEntity (org.activiti.engine.impl.persistence.entity.TaskEntity)1 Task (org.activiti.engine.task.Task)1 TaskQuery (org.activiti.engine.task.TaskQuery)1 Transactional (org.springframework.transaction.annotation.Transactional)1