Search in sources :

Example 11 with CustomRestriction

use of com.qcadoo.model.api.search.CustomRestriction in project mes by qcadoo.

the class NegotiationDetailsHooks method filterStateChangeHistory.

public void filterStateChangeHistory(final ViewDefinitionState view) {
    final GridComponent historyGrid = (GridComponent) view.getComponentByReference("loggingsGrid");
    final CustomRestriction onlySuccessfulRestriction = stateChangeHistoryService.buildStatusRestriction(NegotiationStateChangeFields.STATUS, Lists.newArrayList(SUCCESSFUL.getStringValue()));
    historyGrid.setCustomRestriction(onlySuccessfulRestriction);
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent) CustomRestriction(com.qcadoo.model.api.search.CustomRestriction)

Example 12 with CustomRestriction

use of com.qcadoo.model.api.search.CustomRestriction in project mes by qcadoo.

the class OfferDetailsHooks method filterStateChangeHistory.

public void filterStateChangeHistory(final ViewDefinitionState view) {
    final GridComponent historyGrid = (GridComponent) view.getComponentByReference("loggingsGrid");
    final CustomRestriction onlySuccessfulRestriction = stateChangeHistoryService.buildStatusRestriction(OfferStateChangeFields.STATUS, Lists.newArrayList(SUCCESSFUL.getStringValue()));
    historyGrid.setCustomRestriction(onlySuccessfulRestriction);
}
Also used : CustomRestriction(com.qcadoo.model.api.search.CustomRestriction)

Example 13 with CustomRestriction

use of com.qcadoo.model.api.search.CustomRestriction in project mes by qcadoo.

the class TechnologyDetailsHooks method filterStateChangeHistory.

public void filterStateChangeHistory(final ViewDefinitionState view) {
    final GridComponent historyGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    final CustomRestriction onlySuccessfulRestriction = stateChangeHistoryService.buildStatusRestriction(STATUS, Lists.newArrayList(StateChangeStatus.SUCCESSFUL.getStringValue()));
    historyGrid.setCustomRestriction(onlySuccessfulRestriction);
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent) CustomRestriction(com.qcadoo.model.api.search.CustomRestriction)

Example 14 with CustomRestriction

use of com.qcadoo.model.api.search.CustomRestriction in project qcadoo by qcadoo.

the class MenuAdministrationService method addRestrictionToCategoriesGrid.

public void addRestrictionToCategoriesGrid(final ViewDefinitionState viewDefinitionState) {
    GridComponent categoriesGrid = (GridComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_GRID);
    categoriesGrid.setCustomRestriction(new CustomRestriction() {

        @Override
        public void addRestriction(final SearchCriteriaBuilder searchCriteriaBuilder) {
            SearchDisjunction disjunction = SearchRestrictions.disjunction();
            for (String[] category : HIDDEN_CATEGORIES) {
                disjunction.add(SearchRestrictions.and(SearchRestrictions.eq(MenuCategoryFields.PLUGIN_IDENTIFIER, category[0]), SearchRestrictions.eq(MenuCategoryFields.NAME, category[1])));
            }
            searchCriteriaBuilder.add(SearchRestrictions.not(disjunction));
        }
    });
}
Also used : SearchCriteriaBuilder(com.qcadoo.model.api.search.SearchCriteriaBuilder) SearchDisjunction(com.qcadoo.model.api.search.SearchDisjunction) GridComponent(com.qcadoo.view.api.components.GridComponent) CustomRestriction(com.qcadoo.model.api.search.CustomRestriction)

Example 15 with CustomRestriction

use of com.qcadoo.model.api.search.CustomRestriction in project qcadoo by qcadoo.

the class CustomTranslationsListViewHooks method addDiscriminatorRestrictionToGrid.

public void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view) {
    GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    FieldComponent localeField = (FieldComponent) view.getComponentByReference(LOCALE);
    final String locale = (String) localeField.getFieldValue();
    if (StringUtils.isEmpty(locale)) {
        customTranslationsGrid.setCustomRestriction(null);
    } else {
        customTranslationsGrid.setCustomRestriction(new CustomRestriction() {

            @Override
            public void addRestriction(final SearchCriteriaBuilder searchCriteriaBuilder) {
                searchCriteriaBuilder.add(SearchRestrictions.eq(LOCALE, locale));
            }
        });
    }
}
Also used : SearchCriteriaBuilder(com.qcadoo.model.api.search.SearchCriteriaBuilder) GridComponent(com.qcadoo.view.api.components.GridComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) CustomRestriction(com.qcadoo.model.api.search.CustomRestriction)

Aggregations

CustomRestriction (com.qcadoo.model.api.search.CustomRestriction)16 GridComponent (com.qcadoo.view.api.components.GridComponent)12 SearchCriteriaBuilder (com.qcadoo.model.api.search.SearchCriteriaBuilder)8 Entity (com.qcadoo.model.api.Entity)1 SearchDisjunction (com.qcadoo.model.api.search.SearchDisjunction)1 PossibleUnitConversions (com.qcadoo.model.api.units.PossibleUnitConversions)1 FieldComponent (com.qcadoo.view.api.components.FieldComponent)1 Transactional (org.springframework.transaction.annotation.Transactional)1