//Tender owner criteria
Integer resourcesParticipantId = filterData.getResourcesParticipantId();
Criterion participantCriterion = null;
if(resourcesParticipantId != null) {
TenderType tenderType = filterData.getUsageType();
String supplierAlias = criteriaDescriptor.getFieldAlias(Resource.FIELD_SUPPLIES + "." + ResourceTender.FIELD_USER + "." + User.FIELD_ID(), Criteria.LEFT_JOIN);
String neederAlias = criteriaDescriptor.getFieldAlias(Resource.FIELD_NEEDS + "." + ResourceTender.FIELD_USER + "." + User.FIELD_ID(), Criteria.LEFT_JOIN);
participantCriterion =
tenderType == TenderType.NEED ? Restrictions.eq(neederAlias, resourcesParticipantId) :
tenderType == TenderType.SUPPLY ? Restrictions.eq(supplierAlias, resourcesParticipantId) :