Search in sources :

Example 1 with DataSetFilter

use of org.dashbuilder.dataset.filter.DataSetFilter in project jbpm by kiegroup.

the class BusinessAdminTasksPreprocessor method preprocess.

@SuppressWarnings("rawtypes")
@Override
public void preprocess(DataSetLookup lookup) {
    if (identityProvider == null) {
        return;
    }
    if (ADMIN_USER.equals(identityProvider.getName()) || identityProvider.getRoles().stream().filter(s -> s.equals(ADMIN_GROUP)).findFirst().isPresent()) {
        return;
    }
    final List<Comparable> orgEntities = new ArrayList<Comparable>(identityProvider.getRoles());
    orgEntities.add(identityProvider.getName());
    final ColumnFilter columnFilter = equalsTo(COLUMN_ORGANIZATIONAL_ENTITY, orgEntities);
    LOGGER.debug("Adding column filter: {}", columnFilter);
    if (lookup.getFirstFilterOp() != null) {
        lookup.getFirstFilterOp().addFilterColumn(columnFilter);
    } else {
        DataSetFilter filter = new DataSetFilter();
        filter.addFilterColumn(columnFilter);
        lookup.addOperation(filter);
    }
    super.preprocess(lookup);
}
Also used : FilterFactory.equalsTo(org.dashbuilder.dataset.filter.FilterFactory.equalsTo) IdentityProvider(org.kie.internal.identity.IdentityProvider) COLUMN_ORGANIZATIONAL_ENTITY(org.jbpm.services.api.query.QueryResultMapper.COLUMN_ORGANIZATIONAL_ENTITY) DataSetLookup(org.dashbuilder.dataset.DataSetLookup) List(java.util.List) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) ColumnFilter(org.dashbuilder.dataset.filter.ColumnFilter) DataSetMetadata(org.dashbuilder.dataset.DataSetMetadata) DataSetFilter(org.dashbuilder.dataset.filter.DataSetFilter) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) DataSetFilter(org.dashbuilder.dataset.filter.DataSetFilter) ColumnFilter(org.dashbuilder.dataset.filter.ColumnFilter)

Example 2 with DataSetFilter

use of org.dashbuilder.dataset.filter.DataSetFilter in project jbpm by kiegroup.

the class DeploymentIdsPreprocessor method preprocess.

@Override
public void preprocess(DataSetLookup lookup) {
    if (identityProvider == null) {
        return;
    }
    final List<String> deploymentIds = deploymentRolesManager.getDeploymentsForUser(identityProvider);
    final ColumnFilter columnFilter = in(columnId, deploymentIds);
    LOGGER.debug("Adding column filter: {}", columnFilter);
    if (lookup.getFirstFilterOp() != null) {
        lookup.getFirstFilterOp().addFilterColumn(columnFilter);
    } else {
        DataSetFilter filter = new DataSetFilter();
        filter.addFilterColumn(columnFilter);
        lookup.addOperation(filter);
    }
}
Also used : DataSetFilter(org.dashbuilder.dataset.filter.DataSetFilter) ColumnFilter(org.dashbuilder.dataset.filter.ColumnFilter)

Example 3 with DataSetFilter

use of org.dashbuilder.dataset.filter.DataSetFilter in project jbpm by kiegroup.

the class PotOwnerTasksPreprocessor method preprocess.

@SuppressWarnings("rawtypes")
@Override
public void preprocess(DataSetLookup lookup) {
    if (identityProvider == null) {
        return;
    }
    final List<Comparable> orgEntities = new ArrayList<Comparable>(identityProvider.getRoles());
    orgEntities.add(identityProvider.getName());
    final ColumnFilter myGroupFilter = AND(equalsTo(COLUMN_ORGANIZATIONAL_ENTITY, orgEntities), OR(equalsTo(COLUMN_ACTUALOWNER, ""), isNull(COLUMN_ACTUALOWNER)));
    final ColumnFilter columnFilter = AND(OR(isNull(COLUMN_EXCLUDED_OWNER), notEqualsTo(COLUMN_EXCLUDED_OWNER, identityProvider.getName())), OR(myGroupFilter, equalsTo(COLUMN_ACTUALOWNER, identityProvider.getName())));
    LOGGER.debug("Adding column filter: {}", columnFilter);
    if (lookup.getFirstFilterOp() != null) {
        lookup.getFirstFilterOp().addFilterColumn(columnFilter);
    } else {
        DataSetFilter filter = new DataSetFilter();
        filter.addFilterColumn(columnFilter);
        lookup.addOperation(filter);
    }
    super.preprocess(lookup);
}
Also used : ArrayList(java.util.ArrayList) DataSetFilter(org.dashbuilder.dataset.filter.DataSetFilter) ColumnFilter(org.dashbuilder.dataset.filter.ColumnFilter)

Aggregations

ColumnFilter (org.dashbuilder.dataset.filter.ColumnFilter)3 DataSetFilter (org.dashbuilder.dataset.filter.DataSetFilter)3 ArrayList (java.util.ArrayList)2 List (java.util.List)1 DataSetLookup (org.dashbuilder.dataset.DataSetLookup)1 DataSetMetadata (org.dashbuilder.dataset.DataSetMetadata)1 FilterFactory.equalsTo (org.dashbuilder.dataset.filter.FilterFactory.equalsTo)1 COLUMN_ORGANIZATIONAL_ENTITY (org.jbpm.services.api.query.QueryResultMapper.COLUMN_ORGANIZATIONAL_ENTITY)1 IdentityProvider (org.kie.internal.identity.IdentityProvider)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1