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);
}
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();
}
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();
}
Aggregations