Search in sources :

Example 1 with IdmAttachmentFilter

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

the class DefaultAttachmentManager method getAttachments.

@Override
@Transactional
public Page<IdmAttachmentDto> getAttachments(Identifiable owner, Pageable pageable, BasePermission... permission) {
    Assert.notNull(owner);
    // 
    IdmAttachmentFilter filter = new IdmAttachmentFilter();
    filter.setOwnerType(getOwnerType(owner));
    filter.setOwnerId(getOwnerId(owner));
    filter.setLastVersionOnly(Boolean.TRUE);
    // 
    return find(filter, pageable, permission);
}
Also used : IdmAttachmentFilter(eu.bcvsolutions.idm.core.ecm.api.dto.filter.IdmAttachmentFilter) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with IdmAttachmentFilter

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

the class DefaultAttachmentManager method getAttachmentVersions.

@Override
@Transactional
public List<IdmAttachmentDto> getAttachmentVersions(UUID attachmentId, BasePermission... permission) {
    Assert.notNull(attachmentId);
    // 
    IdmAttachmentFilter filter = new IdmAttachmentFilter();
    filter.setVersionsFor(attachmentId);
    // 
    return find(filter, new PageRequest(0, Integer.MAX_VALUE, new Sort(Direction.DESC, IdmAttachment_.versionNumber.getName())), permission).getContent();
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) Sort(org.springframework.data.domain.Sort) IdmAttachmentFilter(eu.bcvsolutions.idm.core.ecm.api.dto.filter.IdmAttachmentFilter) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with IdmAttachmentFilter

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

the class DefaultAttachmentManager method findLastVersionByOwnerAndName.

private List<IdmAttachmentDto> findLastVersionByOwnerAndName(String ownerType, UUID ownerId, String name, BasePermission... permission) {
    Assert.notNull(ownerType, "Insert type of owner");
    Assert.notNull(ownerId, "Insert ID of owner");
    Assert.notNull(name, "Insert name of attachment");
    // 
    IdmAttachmentFilter filter = new IdmAttachmentFilter();
    filter.setOwnerType(ownerType);
    filter.setOwnerId(ownerId);
    filter.setName(name);
    filter.setLastVersionOnly(Boolean.TRUE);
    // 
    return find(filter, new PageRequest(0, Integer.MAX_VALUE, new Sort(Direction.ASC, IdmAttachment_.name.getName())), permission).getContent();
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) Sort(org.springframework.data.domain.Sort) IdmAttachmentFilter(eu.bcvsolutions.idm.core.ecm.api.dto.filter.IdmAttachmentFilter)

Aggregations

IdmAttachmentFilter (eu.bcvsolutions.idm.core.ecm.api.dto.filter.IdmAttachmentFilter)3 PageRequest (org.springframework.data.domain.PageRequest)2 Sort (org.springframework.data.domain.Sort)2 Transactional (org.springframework.transaction.annotation.Transactional)2