protected Pair<PlainSchema, PlainAttrValue> check(final AttributeCond cond, final AnyTypeKind kind) { AnyUtils anyUtils = anyUtilsFactory.getInstance(kind); PlainSchema schema = schemaDAO.find(cond.getSchema()); if (schema == null) { LOG.warn("Ignoring invalid schema '{}'", cond.getSchema()); throw new IllegalArgumentException(); } PlainAttrValue attrValue = schema.isUniqueConstraint() ? anyUtils.newPlainAttrUniqueValue() : anyUtils.newPlainAttrValue(); try { if (cond.getType() != AttributeCond.Type.LIKE && cond.getType() != AttributeCond.Type.ILIKE && cond.getType() != AttributeCond.Type.ISNULL && cond.getType() != AttributeCond.Type.ISNOTNULL) { ((JPAPlainSchema) schema).validator().validate(cond.getExpression(), attrValue); } } catch (ValidationException e) { LOG.error("Could not validate expression '" + cond.getExpression() + "'", e); throw new IllegalArgumentException(); } return Pair.of(schema, attrValue); }
switch (cond.getType()) { case ISNOTNULL: query.append(checked.getLeft().isUniqueConstraint()
@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; }
&& leaf.getAttributeCond().getType() == AttributeCond.Type.ISNULL) { && (leaf.getAttributeCond().getType() == AttributeCond.Type.ISNULL || leaf.getAttributeCond().getType() == AttributeCond.Type.ISNOTNULL) && leaf.getAttributeCond().getExpression() == null) { tokenCond.setType(leaf.getAttributeCond().getType()); tokenCond.setExpression(null); leaf = SearchCond.getLeafCond(tokenCond);