use of com.qcadoo.model.api.search.CustomRestriction in project qcadoo by qcadoo.
the class UnitConversionModelServiceImpl method find.
@Override
@Transactional(readOnly = true)
public List<Entity> find(final String unit, final CustomRestriction customRestriction) {
final CustomRestriction unitMatchingRestriction = new ConversionMatchingUnitRestriction(unit, customRestriction);
final SearchCriteriaBuilder searchCriteriaBuilder = getDataDefinition().find();
unitMatchingRestriction.addRestriction(searchCriteriaBuilder);
return searchCriteriaBuilder.list().getEntities();
}
use of com.qcadoo.model.api.search.CustomRestriction in project mes by qcadoo.
the class WagesListsHooks method addDiscriminatorRestrictionToGrid.
public final void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view) {
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
grid.setCustomRestriction(new CustomRestriction() {
@Override
public void addRestriction(final SearchCriteriaBuilder searchBuilder) {
Entity ownerCompany = companyService.getCompany();
searchBuilder.add(SearchRestrictions.or(SearchRestrictions.belongsTo("workFor", ownerCompany), SearchRestrictions.isNotNull("laborHourlyCost")));
}
});
}
use of com.qcadoo.model.api.search.CustomRestriction in project mes by qcadoo.
the class ProductService method findPossibleUnitConversions.
private PossibleUnitConversions findPossibleUnitConversions(final String unitName, final Entity productEntity) {
CustomRestriction belongsToProductRestriction = new CustomRestriction() {
@Override
public void addRestriction(final SearchCriteriaBuilder scb) {
scb.add(SearchRestrictions.belongsTo(UnitConversionItemFieldsB.PRODUCT, productEntity));
}
};
PossibleUnitConversions possibleUnitConversions = unitConversionService.getPossibleConversions(unitName, belongsToProductRestriction);
if (Objects.isNull(possibleUnitConversions)) {
possibleUnitConversions = unitConversionService.getPossibleConversions(unitName);
}
return possibleUnitConversions;
}
use of com.qcadoo.model.api.search.CustomRestriction in project mes by qcadoo.
the class PalletNumberHelpersListHooks method addDiscriminatorRestrictionToGrid.
public final void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view) {
GridComponent palletNumberHelpersGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
palletNumberHelpersGrid.setCustomRestriction(new CustomRestriction() {
@Override
public void addRestriction(final SearchCriteriaBuilder searchBuilder) {
searchBuilder.add(SearchRestrictions.eq(PalletNumberHelperFields.TEMPORARY, false));
}
});
}
use of com.qcadoo.model.api.search.CustomRestriction in project mes by qcadoo.
the class DeliveryDetailsHooks method filterStateChangeHistory.
private void filterStateChangeHistory(final ViewDefinitionState view) {
final GridComponent historyGrid = (GridComponent) view.getComponentByReference(L_LOGGINGS_GRID);
final CustomRestriction onlySuccessfulRestriction = stateChangeHistoryService.buildStatusRestriction(DeliveryStateChangeFields.STATUS, Lists.newArrayList(StateChangeStatus.SUCCESSFUL.getStringValue()));
historyGrid.setCustomRestriction(onlySuccessfulRestriction);
}
Aggregations