Search in sources :

Example 1 with AccessDeniedException

use of io.automatiko.engine.api.auth.AccessDeniedException in project automatiko-engine by automatiko-io.

the class CassandraProcessInstances method findByIdOrTag.

@Override
public Collection findByIdOrTag(ProcessInstanceReadMode mode, int status, String... values) {
    LOGGER.debug("findByIdOrTag() called for values {}", values);
    List<Row> collected = new ArrayList<Row>();
    Set<String> distinct = new HashSet<String>();
    Select select = selectFrom(config.keyspace().orElse("automatiko"), tableName).column(INSTANCE_ID_FIELD).column(CONTENT_FIELD).column(VERSION_FIELD).column(TAGS_FIELD).whereColumn(STATUS_FIELD).isEqualTo(literal(status));
    ResultSet rs = cqlSession.execute(select.build());
    rs.all().stream().filter(r -> !distinct.contains(r.getString(INSTANCE_ID_FIELD))).filter(r -> {
        if (values == null || values.length == 0) {
            return true;
        }
        Set<String> tags = r.getSet(TAGS_FIELD, String.class);
        return Stream.of(values).anyMatch(v -> tags.contains(v));
    }).forEach(r -> {
        distinct.add(r.getString(INSTANCE_ID_FIELD));
        collected.add(r);
    });
    return collected.stream().map(item -> {
        try {
            byte[] content = ByteUtils.getArray(item.getByteBuffer(CONTENT_FIELD));
            return mode == MUTABLE ? marshaller.unmarshallProcessInstance(codec.decode(content), process, item.getLong(VERSION_FIELD)) : marshaller.unmarshallReadOnlyProcessInstance(codec.decode(content), process);
        } catch (AccessDeniedException e) {
            return null;
        }
    }).filter(pi -> pi != null).collect(Collectors.toList());
}
Also used : QueryBuilder.insertInto(com.datastax.oss.driver.api.querybuilder.QueryBuilder.insertInto) QueryBuilder(com.datastax.oss.driver.api.querybuilder.QueryBuilder) ConflictingVersionException(io.automatiko.engine.api.workflow.ConflictingVersionException) LoggerFactory(org.slf4j.LoggerFactory) Insert(com.datastax.oss.driver.api.querybuilder.insert.Insert) CreateKeyspace(com.datastax.oss.driver.api.querybuilder.schema.CreateKeyspace) Delete(com.datastax.oss.driver.api.querybuilder.delete.Delete) SimpleStatement(com.datastax.oss.driver.api.core.cql.SimpleStatement) ByteBuffer(java.nio.ByteBuffer) CreateTable(com.datastax.oss.driver.api.querybuilder.schema.CreateTable) JacksonObjectMarshallingStrategy(io.automatiko.engine.addons.persistence.common.JacksonObjectMarshallingStrategy) Map(java.util.Map) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) ConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel) Select(com.datastax.oss.driver.api.querybuilder.select.Select) Model(io.automatiko.engine.api.Model) ByteUtils(com.datastax.oss.driver.api.core.data.ByteUtils) QueryBuilder.bindMarker(com.datastax.oss.driver.api.querybuilder.QueryBuilder.bindMarker) Collection(java.util.Collection) QueryExecutionException(com.datastax.oss.driver.api.core.servererrors.QueryExecutionException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) StoredDataCodec(io.automatiko.engine.api.workflow.encrypt.StoredDataCodec) Set(java.util.Set) QueryBuilder.selectFrom(com.datastax.oss.driver.api.querybuilder.QueryBuilder.selectFrom) ProcessInstance(io.automatiko.engine.api.workflow.ProcessInstance) Collectors(java.util.stream.Collectors) SchemaBuilder(com.datastax.oss.driver.api.querybuilder.SchemaBuilder) List(java.util.List) DataTypes(com.datastax.oss.driver.api.core.type.DataTypes) Stream(java.util.stream.Stream) QueryBuilder.literal(com.datastax.oss.driver.api.querybuilder.QueryBuilder.literal) ExportedProcessInstance(io.automatiko.engine.api.workflow.ExportedProcessInstance) ProcessInstanceDuplicatedException(io.automatiko.engine.api.workflow.ProcessInstanceDuplicatedException) ProcessInstanceReadMode(io.automatiko.engine.api.workflow.ProcessInstanceReadMode) Optional(java.util.Optional) CassandraPersistenceConfig(io.automatiko.engine.api.config.CassandraPersistenceConfig) QueryBuilder.deleteFrom(com.datastax.oss.driver.api.querybuilder.QueryBuilder.deleteFrom) CreateIndex(com.datastax.oss.driver.api.querybuilder.schema.CreateIndex) MutableProcessInstances(io.automatiko.engine.api.workflow.MutableProcessInstances) AbstractProcessInstance(io.automatiko.engine.workflow.AbstractProcessInstance) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) CqlSession(com.datastax.oss.driver.api.core.CqlSession) Process(io.automatiko.engine.api.workflow.Process) Row(com.datastax.oss.driver.api.core.cql.Row) LinkedHashSet(java.util.LinkedHashSet) Logger(org.slf4j.Logger) ResultSet(com.datastax.oss.driver.api.core.cql.ResultSet) MUTABLE(io.automatiko.engine.api.workflow.ProcessInstanceReadMode.MUTABLE) ProcessInstanceMarshaller(io.automatiko.engine.workflow.marshalling.ProcessInstanceMarshaller) SchemaBuilder.createKeyspace(com.datastax.oss.driver.api.querybuilder.SchemaBuilder.createKeyspace) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) Set(java.util.Set) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) ResultSet(com.datastax.oss.driver.api.core.cql.ResultSet) ArrayList(java.util.ArrayList) Select(com.datastax.oss.driver.api.querybuilder.select.Select) ResultSet(com.datastax.oss.driver.api.core.cql.ResultSet) Row(com.datastax.oss.driver.api.core.cql.Row) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 2 with AccessDeniedException

use of io.automatiko.engine.api.auth.AccessDeniedException in project automatiko-engine by automatiko-io.

the class DynamoDBProcessInstances method values.

@Override
public Collection values(ProcessInstanceReadMode mode, int status, int page, int size) {
    LOGGER.debug("values() called");
    Map<String, AttributeValue> attrValues = new HashMap<String, AttributeValue>();
    StringBuilder condition = new StringBuilder();
    attrValues.put(":status", AttributeValue.builder().n(String.valueOf(status)).build());
    condition.append(STATUS_FIELD + " = :status ");
    ScanRequest request = ScanRequest.builder().tableName(tableName).filterExpression(condition.toString()).expressionAttributeValues(attrValues).limit(page * size).build();
    return dynamodb.scanPaginator(request).items().stream().map(item -> {
        try {
            byte[] content = item.get(CONTENT_FIELD).b().asByteArray();
            return mode == MUTABLE ? marshaller.unmarshallProcessInstance(codec.decode(content), process, Long.parseLong(item.get(VERSION_FIELD).n())) : marshaller.unmarshallReadOnlyProcessInstance(codec.decode(content), process);
        } catch (AccessDeniedException e) {
            return null;
        }
    }).filter(pi -> pi != null).skip(calculatePage(page, size)).limit(size).collect(Collectors.toList());
}
Also used : ConflictingVersionException(io.automatiko.engine.api.workflow.ConflictingVersionException) LoggerFactory(org.slf4j.LoggerFactory) DynamoDBPersistenceConfig(io.automatiko.engine.api.config.DynamoDBPersistenceConfig) SdkBytes(software.amazon.awssdk.core.SdkBytes) JacksonObjectMarshallingStrategy(io.automatiko.engine.addons.persistence.common.JacksonObjectMarshallingStrategy) Map(java.util.Map) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) Select(software.amazon.awssdk.services.dynamodb.model.Select) WaiterResponse(software.amazon.awssdk.core.waiters.WaiterResponse) ConditionalCheckFailedException(software.amazon.awssdk.services.dynamodb.model.ConditionalCheckFailedException) ScalarAttributeType(software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType) ResourceInUseException(software.amazon.awssdk.services.dynamodb.model.ResourceInUseException) DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) Model(io.automatiko.engine.api.Model) AttributeValueUpdate(software.amazon.awssdk.services.dynamodb.model.AttributeValueUpdate) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) StoredDataCodec(io.automatiko.engine.api.workflow.encrypt.StoredDataCodec) KeyType(software.amazon.awssdk.services.dynamodb.model.KeyType) ProcessInstance(io.automatiko.engine.api.workflow.ProcessInstance) Collectors(java.util.stream.Collectors) PutItemRequest(software.amazon.awssdk.services.dynamodb.model.PutItemRequest) ExportedProcessInstance(io.automatiko.engine.api.workflow.ExportedProcessInstance) ProcessInstanceDuplicatedException(io.automatiko.engine.api.workflow.ProcessInstanceDuplicatedException) ProcessInstanceReadMode(io.automatiko.engine.api.workflow.ProcessInstanceReadMode) AttributeValue(software.amazon.awssdk.services.dynamodb.model.AttributeValue) Optional(java.util.Optional) DeleteItemRequest(software.amazon.awssdk.services.dynamodb.model.DeleteItemRequest) MutableProcessInstances(io.automatiko.engine.api.workflow.MutableProcessInstances) DescribeTableResponse(software.amazon.awssdk.services.dynamodb.model.DescribeTableResponse) AbstractProcessInstance(io.automatiko.engine.workflow.AbstractProcessInstance) GetItemRequest(software.amazon.awssdk.services.dynamodb.model.GetItemRequest) UpdateItemRequest(software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AttributeAction(software.amazon.awssdk.services.dynamodb.model.AttributeAction) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) ScanRequest(software.amazon.awssdk.services.dynamodb.model.ScanRequest) Process(io.automatiko.engine.api.workflow.Process) Logger(org.slf4j.Logger) AttributeDefinition(software.amazon.awssdk.services.dynamodb.model.AttributeDefinition) DynamoDbWaiter(software.amazon.awssdk.services.dynamodb.waiters.DynamoDbWaiter) MUTABLE(io.automatiko.engine.api.workflow.ProcessInstanceReadMode.MUTABLE) DynamoDbException(software.amazon.awssdk.services.dynamodb.model.DynamoDbException) KeySchemaElement(software.amazon.awssdk.services.dynamodb.model.KeySchemaElement) ProcessInstanceMarshaller(io.automatiko.engine.workflow.marshalling.ProcessInstanceMarshaller) CreateTableResponse(software.amazon.awssdk.services.dynamodb.model.CreateTableResponse) DescribeTableRequest(software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest) ScanRequest(software.amazon.awssdk.services.dynamodb.model.ScanRequest) AttributeValue(software.amazon.awssdk.services.dynamodb.model.AttributeValue) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Example 3 with AccessDeniedException

use of io.automatiko.engine.api.auth.AccessDeniedException in project automatiko-engine by automatiko-io.

the class CassandraProcessInstances method values.

@Override
public Collection values(ProcessInstanceReadMode mode, int status, int page, int size) {
    LOGGER.debug("values() called");
    Select select = selectFrom(config.keyspace().orElse("automatiko"), tableName).column(CONTENT_FIELD).column(VERSION_FIELD).whereColumn(STATUS_FIELD).isEqualTo(literal(status));
    ResultSet rs = cqlSession.execute(select.build());
    return rs.all().stream().map(item -> {
        try {
            byte[] content = ByteUtils.getArray(item.getByteBuffer(CONTENT_FIELD));
            return mode == MUTABLE ? marshaller.unmarshallProcessInstance(codec.decode(content), process, item.getLong(VERSION_FIELD)) : marshaller.unmarshallReadOnlyProcessInstance(codec.decode(content), process);
        } catch (AccessDeniedException e) {
            return null;
        }
    }).filter(pi -> pi != null).skip(calculatePage(page, size)).limit(size).collect(Collectors.toList());
}
Also used : QueryBuilder.insertInto(com.datastax.oss.driver.api.querybuilder.QueryBuilder.insertInto) QueryBuilder(com.datastax.oss.driver.api.querybuilder.QueryBuilder) ConflictingVersionException(io.automatiko.engine.api.workflow.ConflictingVersionException) LoggerFactory(org.slf4j.LoggerFactory) Insert(com.datastax.oss.driver.api.querybuilder.insert.Insert) CreateKeyspace(com.datastax.oss.driver.api.querybuilder.schema.CreateKeyspace) Delete(com.datastax.oss.driver.api.querybuilder.delete.Delete) SimpleStatement(com.datastax.oss.driver.api.core.cql.SimpleStatement) ByteBuffer(java.nio.ByteBuffer) CreateTable(com.datastax.oss.driver.api.querybuilder.schema.CreateTable) JacksonObjectMarshallingStrategy(io.automatiko.engine.addons.persistence.common.JacksonObjectMarshallingStrategy) Map(java.util.Map) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) ConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel) Select(com.datastax.oss.driver.api.querybuilder.select.Select) Model(io.automatiko.engine.api.Model) ByteUtils(com.datastax.oss.driver.api.core.data.ByteUtils) QueryBuilder.bindMarker(com.datastax.oss.driver.api.querybuilder.QueryBuilder.bindMarker) Collection(java.util.Collection) QueryExecutionException(com.datastax.oss.driver.api.core.servererrors.QueryExecutionException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) StoredDataCodec(io.automatiko.engine.api.workflow.encrypt.StoredDataCodec) Set(java.util.Set) QueryBuilder.selectFrom(com.datastax.oss.driver.api.querybuilder.QueryBuilder.selectFrom) ProcessInstance(io.automatiko.engine.api.workflow.ProcessInstance) Collectors(java.util.stream.Collectors) SchemaBuilder(com.datastax.oss.driver.api.querybuilder.SchemaBuilder) List(java.util.List) DataTypes(com.datastax.oss.driver.api.core.type.DataTypes) Stream(java.util.stream.Stream) QueryBuilder.literal(com.datastax.oss.driver.api.querybuilder.QueryBuilder.literal) ExportedProcessInstance(io.automatiko.engine.api.workflow.ExportedProcessInstance) ProcessInstanceDuplicatedException(io.automatiko.engine.api.workflow.ProcessInstanceDuplicatedException) ProcessInstanceReadMode(io.automatiko.engine.api.workflow.ProcessInstanceReadMode) Optional(java.util.Optional) CassandraPersistenceConfig(io.automatiko.engine.api.config.CassandraPersistenceConfig) QueryBuilder.deleteFrom(com.datastax.oss.driver.api.querybuilder.QueryBuilder.deleteFrom) CreateIndex(com.datastax.oss.driver.api.querybuilder.schema.CreateIndex) MutableProcessInstances(io.automatiko.engine.api.workflow.MutableProcessInstances) AbstractProcessInstance(io.automatiko.engine.workflow.AbstractProcessInstance) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) CqlSession(com.datastax.oss.driver.api.core.CqlSession) Process(io.automatiko.engine.api.workflow.Process) Row(com.datastax.oss.driver.api.core.cql.Row) LinkedHashSet(java.util.LinkedHashSet) Logger(org.slf4j.Logger) ResultSet(com.datastax.oss.driver.api.core.cql.ResultSet) MUTABLE(io.automatiko.engine.api.workflow.ProcessInstanceReadMode.MUTABLE) ProcessInstanceMarshaller(io.automatiko.engine.workflow.marshalling.ProcessInstanceMarshaller) SchemaBuilder.createKeyspace(com.datastax.oss.driver.api.querybuilder.SchemaBuilder.createKeyspace) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) Select(com.datastax.oss.driver.api.querybuilder.select.Select) ResultSet(com.datastax.oss.driver.api.core.cql.ResultSet)

Example 4 with AccessDeniedException

use of io.automatiko.engine.api.auth.AccessDeniedException in project automatiko-engine by automatiko-io.

the class DynamoDBProcessInstances method findByIdOrTag.

@Override
public Collection findByIdOrTag(ProcessInstanceReadMode mode, int status, String... values) {
    LOGGER.debug("findByIdOrTag() called for values {}", values);
    Map<String, AttributeValue> attrValues = new HashMap<String, AttributeValue>();
    int counter = 0;
    StringBuilder condition = new StringBuilder();
    attrValues.put(":status", AttributeValue.builder().n(String.valueOf(status)).build());
    condition.append(STATUS_FIELD + "= :status AND ");
    for (String value : values) {
        attrValues.put(":value" + counter, AttributeValue.builder().s(value).build());
        condition.append("contains(" + TAGS_FIELD + ", :value" + counter + ") OR ");
        counter++;
    }
    condition.delete(condition.length() - 4, condition.length());
    ScanRequest query = ScanRequest.builder().tableName(tableName).filterExpression(condition.toString()).expressionAttributeValues(attrValues).build();
    return dynamodb.scan(query).items().stream().map(item -> {
        try {
            byte[] content = item.get(CONTENT_FIELD).b().asByteArray();
            return mode == MUTABLE ? marshaller.unmarshallProcessInstance(codec.decode(content), process, Long.parseLong(item.get(VERSION_FIELD).n())) : marshaller.unmarshallReadOnlyProcessInstance(codec.decode(content), process);
        } catch (AccessDeniedException e) {
            return null;
        }
    }).filter(pi -> pi != null).collect(Collectors.toList());
}
Also used : ConflictingVersionException(io.automatiko.engine.api.workflow.ConflictingVersionException) LoggerFactory(org.slf4j.LoggerFactory) DynamoDBPersistenceConfig(io.automatiko.engine.api.config.DynamoDBPersistenceConfig) SdkBytes(software.amazon.awssdk.core.SdkBytes) JacksonObjectMarshallingStrategy(io.automatiko.engine.addons.persistence.common.JacksonObjectMarshallingStrategy) Map(java.util.Map) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) Select(software.amazon.awssdk.services.dynamodb.model.Select) WaiterResponse(software.amazon.awssdk.core.waiters.WaiterResponse) ConditionalCheckFailedException(software.amazon.awssdk.services.dynamodb.model.ConditionalCheckFailedException) ScalarAttributeType(software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType) ResourceInUseException(software.amazon.awssdk.services.dynamodb.model.ResourceInUseException) DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) Model(io.automatiko.engine.api.Model) AttributeValueUpdate(software.amazon.awssdk.services.dynamodb.model.AttributeValueUpdate) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) StoredDataCodec(io.automatiko.engine.api.workflow.encrypt.StoredDataCodec) KeyType(software.amazon.awssdk.services.dynamodb.model.KeyType) ProcessInstance(io.automatiko.engine.api.workflow.ProcessInstance) Collectors(java.util.stream.Collectors) PutItemRequest(software.amazon.awssdk.services.dynamodb.model.PutItemRequest) ExportedProcessInstance(io.automatiko.engine.api.workflow.ExportedProcessInstance) ProcessInstanceDuplicatedException(io.automatiko.engine.api.workflow.ProcessInstanceDuplicatedException) ProcessInstanceReadMode(io.automatiko.engine.api.workflow.ProcessInstanceReadMode) AttributeValue(software.amazon.awssdk.services.dynamodb.model.AttributeValue) Optional(java.util.Optional) DeleteItemRequest(software.amazon.awssdk.services.dynamodb.model.DeleteItemRequest) MutableProcessInstances(io.automatiko.engine.api.workflow.MutableProcessInstances) DescribeTableResponse(software.amazon.awssdk.services.dynamodb.model.DescribeTableResponse) AbstractProcessInstance(io.automatiko.engine.workflow.AbstractProcessInstance) GetItemRequest(software.amazon.awssdk.services.dynamodb.model.GetItemRequest) UpdateItemRequest(software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AttributeAction(software.amazon.awssdk.services.dynamodb.model.AttributeAction) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) ScanRequest(software.amazon.awssdk.services.dynamodb.model.ScanRequest) Process(io.automatiko.engine.api.workflow.Process) Logger(org.slf4j.Logger) AttributeDefinition(software.amazon.awssdk.services.dynamodb.model.AttributeDefinition) DynamoDbWaiter(software.amazon.awssdk.services.dynamodb.waiters.DynamoDbWaiter) MUTABLE(io.automatiko.engine.api.workflow.ProcessInstanceReadMode.MUTABLE) DynamoDbException(software.amazon.awssdk.services.dynamodb.model.DynamoDbException) KeySchemaElement(software.amazon.awssdk.services.dynamodb.model.KeySchemaElement) ProcessInstanceMarshaller(io.automatiko.engine.workflow.marshalling.ProcessInstanceMarshaller) CreateTableResponse(software.amazon.awssdk.services.dynamodb.model.CreateTableResponse) DescribeTableRequest(software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest) ScanRequest(software.amazon.awssdk.services.dynamodb.model.ScanRequest) AttributeValue(software.amazon.awssdk.services.dynamodb.model.AttributeValue) AccessDeniedException(io.automatiko.engine.api.auth.AccessDeniedException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Aggregations

JacksonObjectMarshallingStrategy (io.automatiko.engine.addons.persistence.common.JacksonObjectMarshallingStrategy)4 Model (io.automatiko.engine.api.Model)4 AccessDeniedException (io.automatiko.engine.api.auth.AccessDeniedException)4 ConflictingVersionException (io.automatiko.engine.api.workflow.ConflictingVersionException)4 ExportedProcessInstance (io.automatiko.engine.api.workflow.ExportedProcessInstance)4 MutableProcessInstances (io.automatiko.engine.api.workflow.MutableProcessInstances)4 Process (io.automatiko.engine.api.workflow.Process)4 ProcessInstance (io.automatiko.engine.api.workflow.ProcessInstance)4 ProcessInstanceDuplicatedException (io.automatiko.engine.api.workflow.ProcessInstanceDuplicatedException)4 ProcessInstanceReadMode (io.automatiko.engine.api.workflow.ProcessInstanceReadMode)4 MUTABLE (io.automatiko.engine.api.workflow.ProcessInstanceReadMode.MUTABLE)4 StoredDataCodec (io.automatiko.engine.api.workflow.encrypt.StoredDataCodec)4 AbstractProcessInstance (io.automatiko.engine.workflow.AbstractProcessInstance)4 ProcessInstanceMarshaller (io.automatiko.engine.workflow.marshalling.ProcessInstanceMarshaller)4 ArrayList (java.util.ArrayList)4 Collection (java.util.Collection)4 Map (java.util.Map)3 Optional (java.util.Optional)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 Collectors (java.util.stream.Collectors)3