use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class ResourcePermissionEventsListener method deleteGroupPermissionOn.
private void deleteGroupPermissionOn(String groupId, Class<?>... resourceClasses) throws IOException, ClassNotFoundException {
FilterBuilder resourceFilter = FilterBuilders.nestedFilter("groupPermissions", FilterBuilders.termFilter("groupPermissions.key", groupId));
deletePermissions(resourceFilter, groupId, ((resource, subjectId) -> resourcePermissionService.revokePermission(resource, Subject.GROUP, subjectId)), resourceClasses);
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class ResourcePermissionEventsListener method deleteApplicationPermissionOn.
private void deleteApplicationPermissionOn(String applicationId, Class<?>... resourceClasses) throws IOException, ClassNotFoundException {
FilterBuilder resourceFilter = FilterBuilders.nestedFilter("applicationPermissions", FilterBuilders.termFilter("applicationPermissions.key", applicationId));
deletePermissions(resourceFilter, applicationId, ((resource, subjectId) -> resourcePermissionService.revokePermission(resource, Subject.APPLICATION, subjectId)), resourceClasses);
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class ResourcePermissionEventsListener method deleteEnvironmentTypePermissionOn.
private void deleteEnvironmentTypePermissionOn(String environmentId, Class<?>... resourceClasses) throws IOException, ClassNotFoundException {
FilterBuilder resourceFilter = FilterBuilders.nestedFilter("environmentTypePermissions", FilterBuilders.termFilter("environmentTypePermissions.key", environmentId));
deletePermissions(resourceFilter, environmentId, ((resource, subjectId) -> resourcePermissionService.revokePermission(resource, Subject.ENVIRONMENT_TYPE, subjectId)), resourceClasses);
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class DeploymentService method getDeployments.
/**
* Get all deployments for a given orchestrator an application
*
* @param orchestratorId Id of the cloud for which to get deployments (can be null to get deployments for all clouds).
* @param sourceId Id of the application for which to get deployments (can be null to get deployments for all applications).
* @param environmentId Id of the environment for which to get deployments (can be null to get deployments for all environments).
* @return An array of deployments.
*/
public Deployment[] getDeployments(String orchestratorId, String sourceId, String environmentId, int from, int size) {
FilterBuilder filterBuilder = buildDeploymentFilters(orchestratorId, sourceId, environmentId);
IESQueryBuilderHelper<Deployment> queryBuilderHelper = alienDao.buildQuery(Deployment.class);
return queryBuilderHelper.setFilters(filterBuilder).prepareSearch().setFieldSort("startDate", true).search(from, size).getData();
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class CsarService method getDependantTopologies.
/**
* Get teh topologies that depends on this csar.
* Do not return a topology if this csar is his own
*
* @return an array of <code>Topology</code>s that depend on this name:version.
*/
public Topology[] getDependantTopologies(String name, String version) {
FilterBuilder notSelf = FilterBuilders.notFilter(FilterBuilders.andFilter(FilterBuilders.termFilter("archiveName", name), FilterBuilders.termFilter("archiveVersion", version)));
GetMultipleDataResult<Topology> result = csarDAO.buildQuery(Topology.class).prepareSearch().setFilters(fromKeyValueCouples("dependencies.name", name, "dependencies.version", version), notSelf).search(0, Integer.MAX_VALUE);
return result.getData();
}
Aggregations