Search in sources :

Example 6 with ExportDescriptorDto

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

the class RoleExportBulkAction method exportRoleCatalogs.

/**
 * Export role-catalogs for given role.
 *
 * @param role
 */
private void exportRoleCatalogs(IdmRoleDto role) {
    IdmRoleCatalogueRoleFilter filter = new IdmRoleCatalogueRoleFilter();
    filter.setRoleId(role.getId());
    List<IdmRoleCatalogueRoleDto> dtos = roleCatalogueRoleService.find(filter, null).getContent();
    if (dtos.isEmpty()) {
        roleCatalogueRoleService.export(ExportManager.BLANK_UUID, this.getBatch());
    }
    dtos.forEach(dto -> {
        roleCatalogueRoleService.export(dto.getId(), this.getBatch());
    });
    // Set parent field -> set authoritative mode.
    this.getExportManager().setAuthoritativeMode(IdmRoleCatalogueRole_.role.getName(), "roleId", IdmRoleCatalogueRoleDto.class, this.getBatch());
    List<ExportDescriptorDto> exportOrder = getBatch().getExportOrder();
    // Order can be wrong now! Catalog descriptor must be first (then role-catalogue-role)!
    ExportDescriptorDto roleCatalogDescriptor = this.getExportManager().getDescriptor(getBatch(), IdmRoleCatalogueRoleDto.class);
    ExportDescriptorDto catalogDescriptor = this.getExportManager().getDescriptor(getBatch(), IdmRoleCatalogueDto.class);
    if (roleCatalogDescriptor != null && catalogDescriptor != null) {
        int roleCatalogueIndex = exportOrder.indexOf(roleCatalogDescriptor);
        int catalogueIndex = exportOrder.indexOf(catalogDescriptor);
        if (roleCatalogueIndex < catalogueIndex) {
            exportOrder.set(catalogueIndex, roleCatalogDescriptor);
            exportOrder.set(roleCatalogueIndex, catalogDescriptor);
        }
    }
}
Also used : IdmRoleCatalogueRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueRoleFilter) ExportDescriptorDto(eu.bcvsolutions.idm.core.api.dto.ExportDescriptorDto) IdmRoleCatalogueRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueRoleDto)

Example 7 with ExportDescriptorDto

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

the class DefaultIdmRoleGuaranteeService method export.

@Override
public void export(UUID id, IdmExportImportDto batch) {
    Assert.notNull(batch, "Export batch must exist!");
    super.export(id, batch);
    // Advanced pairing
    ExportDescriptorDto descriptorDto = getExportManager().getDescriptor(batch, this.getDtoClass());
    descriptorDto.getAdvancedParingFields().add(IdmRoleGuarantee_.guarantee.getName());
}
Also used : ExportDescriptorDto(eu.bcvsolutions.idm.core.api.dto.ExportDescriptorDto)

Example 8 with ExportDescriptorDto

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

the class DefaultIdmRoleCatalogueService method export.

@Override
public void export(UUID id, IdmExportImportDto batch) {
    Assert.notNull(batch, "Batch cannot be null!");
    // We need to export all catalog items (direct to the root)
    IdmRoleCatalogueDto catalog = this.get(id);
    if (catalog != null) {
        UUID parent = catalog.getParent();
        if (parent != null) {
            this.export(parent, batch);
        }
    }
    super.export(id, batch);
    // Authoritative mode is not set here only parent field could be sets.
    ExportDescriptorDto descriptor = getExportManager().getDescriptor(batch, IdmRoleCatalogueDto.class);
    if (descriptor != null) {
        descriptor.getParentFields().add(IdmRoleCatalogue_.parent.getName());
    }
}
Also used : ExportDescriptorDto(eu.bcvsolutions.idm.core.api.dto.ExportDescriptorDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) UUID(java.util.UUID)

Example 9 with ExportDescriptorDto

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

the class DefaultIdmIncompatibleRoleService method export.

@Override
public void export(UUID id, IdmExportImportDto batch) {
    Assert.notNull(batch, "Export batch must exist!");
    // Export break-recipient
    super.export(id, batch);
    // Advanced pairing
    ExportDescriptorDto descriptorDto = getExportManager().getDescriptor(batch, this.getDtoClass());
    descriptorDto.getAdvancedParingFields().add(IdmIncompatibleRole_.sub.getName());
    descriptorDto.getAdvancedParingFields().add(IdmIncompatibleRole_.superior.getName());
}
Also used : ExportDescriptorDto(eu.bcvsolutions.idm.core.api.dto.ExportDescriptorDto)

Example 10 with ExportDescriptorDto

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

the class DefaultIdmRoleCompositionService method export.

@Override
public void export(UUID id, IdmExportImportDto batch) {
    Assert.notNull(batch, "Export batch must exist!");
    // Export break-recipient
    super.export(id, batch);
    // Advanced pairing
    ExportDescriptorDto descriptorDto = getExportManager().getDescriptor(batch, this.getDtoClass());
    descriptorDto.getAdvancedParingFields().add(IdmRoleComposition_.sub.getName());
    descriptorDto.getAdvancedParingFields().add(IdmRoleComposition_.superior.getName());
}
Also used : ExportDescriptorDto(eu.bcvsolutions.idm.core.api.dto.ExportDescriptorDto)

Aggregations

ExportDescriptorDto (eu.bcvsolutions.idm.core.api.dto.ExportDescriptorDto)20 BaseDto (eu.bcvsolutions.idm.core.api.dto.BaseDto)4 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)4 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)4 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)4 UUID (java.util.UUID)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 Lists (com.google.common.collect.Lists)3 Codeable (eu.bcvsolutions.idm.core.api.domain.Codeable)3 CoreResultCode (eu.bcvsolutions.idm.core.api.domain.CoreResultCode)3 AbstractDto (eu.bcvsolutions.idm.core.api.dto.AbstractDto)3 EmbeddedDto (eu.bcvsolutions.idm.core.api.dto.EmbeddedDto)3 IdmExportImportDto (eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto)3 CoreEvent (eu.bcvsolutions.idm.core.api.event.CoreEvent)3 CoreEventType (eu.bcvsolutions.idm.core.api.event.CoreEvent.CoreEventType)3 IntrospectionException (java.beans.IntrospectionException)3 PropertyDescriptor (java.beans.PropertyDescriptor)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 JsonParseException (com.fasterxml.jackson.core.JsonParseException)2