protected Triple<PlainSchema, PlainAttrValue, AnyCond> check(final AnyCond cond, final AnyTypeKind kind) { AnyCond computed = new AnyCond(cond.getType()); computed.setSchema(cond.getSchema()); computed.setExpression(cond.getExpression()); Field anyField = anyUtils.getField(computed.getSchema()); if (anyField == null) { LOG.warn("Ignoring invalid field '{}'", computed.getSchema()); throw new IllegalArgumentException(); if ("key".equals(computed.getSchema())) { computed.setSchema("id"); if (ArrayUtils.contains(RELATIONSHIP_FIELDS, computed.getSchema())) { computed.setSchema(computed.getSchema() + "_id"); schema.setType(AttrSchemaType.String); if (computed.getType() != AttributeCond.Type.LIKE && computed.getType() != AttributeCond.Type.ILIKE && computed.getType() != AttributeCond.Type.ISNULL && computed.getType() != AttributeCond.Type.ISNOTNULL) { ((JPAPlainSchema) schema).validator().validate(computed.getExpression(), attrValue); } catch (ValidationException e) { LOG.error("Could not validate expression '" + computed.getExpression() + "'", e); throw new IllegalArgumentException();
@Override public <T extends Any<?>> boolean matches(final T any, final SearchCond cond) { AnyCond keycond = new AnyCond(AttributeCond.Type.EQ); keycond.setSchema("key"); keycond.setExpression(any.getKey()); return !search(SearchCond.getAndCond(SearchCond.getLeafCond(keycond), cond), any.getType().getKind()).isEmpty(); } }
&& leaf.getAnyCond().getType() == AttributeCond.Type.ISNULL) { leaf.getAnyCond().setType(AttributeCond.Type.ISNOTNULL); } else { leaf = SearchCond.getNotLeafCond(leaf); && leaf.getAttributeCond().getExpression() == null) { AnyCond tokenCond = new AnyCond(); tokenCond.setSchema(leaf.getAttributeCond().getSchema()); tokenCond.setType(leaf.getAttributeCond().getType()); tokenCond.setExpression(null); leaf = SearchCond.getLeafCond(tokenCond);
private AttributeCond createAttributeCond(final String schema) { AttributeCond attributeCond = SearchableFields.contains(schema) ? new AnyCond() : new AttributeCond(); attributeCond.setSchema(schema); return attributeCond; }
@Override public SearchCond visitNOT_EXPR(final SCIMFilterParser.NOT_EXPRContext ctx) { SearchCond cond = visit(ctx.expression()); if (cond.getAttributeCond() != null) { if (cond.getAttributeCond().getType() == AttributeCond.Type.ISNULL) { cond.getAttributeCond().setType(AttributeCond.Type.ISNOTNULL); } else if (cond.getAttributeCond().getType() == AttributeCond.Type.ISNOTNULL) { cond.getAttributeCond().setType(AttributeCond.Type.ISNULL); } } else if (cond.getAnyCond() != null) { if (cond.getAnyCond().getType() == AnyCond.Type.ISNULL) { cond.getAnyCond().setType(AnyCond.Type.ISNOTNULL); } else if (cond.getAnyCond().getType() == AnyCond.Type.ISNOTNULL) { cond.getAnyCond().setType(AnyCond.Type.ISNULL); } } else { cond = SearchCond.getNotLeafCond(cond); } return cond; }
AnyCond termCond = new AnyCond(AttributeCond.Type.ILIKE); termCond.setSchema("name"); : (term.startsWith("*") && term.endsWith("*") ? term : "%" + term + "%"); termCond.setExpression(termSearchableValue);
? new AnyCond() : new AttributeCond(); cond.setSchema(schema);
AnyCond cond = new AnyCond(AttributeCond.Type.IEQ); cond.setSchema("username"); cond.setExpression(connObjectKey); result.addAll(searchDAO.search(SearchCond.getLeafCond(cond), AnyTypeKind.USER). stream().map(Entity::getKey).collect(Collectors.toList())); AnyCond cond = new AnyCond(AttributeCond.Type.IEQ); cond.setSchema("name"); cond.setExpression(connObjectKey); result.addAll(searchDAO.search(SearchCond.getLeafCond(cond), AnyTypeKind.GROUP). stream().map(Entity::getKey).collect(Collectors.toList())); AnyCond cond = new AnyCond(AttributeCond.Type.IEQ); cond.setSchema("name"); cond.setExpression(connObjectKey); result.addAll(searchDAO.search(SearchCond.getLeafCond(cond), AnyTypeKind.ANY_OBJECT). stream().map(Entity::getKey).collect(Collectors.toList()));
attributeCond = new AnyCond(); attributeCond.setSchema("username"); } else if (resource == Resource.Group && schemaEquals(Resource.Group, "displayName", schema)) { attributeCond = new AnyCond(); attributeCond.setSchema("name"); } else if (schemaEquals(null, "meta.created", schema)) { attributeCond = new AnyCond(); attributeCond.setSchema("creationDate"); } else if (schemaEquals(null, "meta.lastModified", schema)) { attributeCond = new AnyCond(); attributeCond.setSchema("lastChangeDate");