case "eq": default: attributeCond.setType(AttributeCond.Type.IEQ); break; attributeCond.setType(AttributeCond.Type.IEQ); break; attributeCond.setType(AttributeCond.Type.ILIKE); attributeCond.setExpression(attributeCond.getExpression() + "%"); break; attributeCond.setType(AttributeCond.Type.ILIKE); attributeCond.setExpression("%" + attributeCond.getExpression() + "%"); break; attributeCond.setType(AttributeCond.Type.ILIKE); attributeCond.setExpression("%" + attributeCond.getExpression()); break; attributeCond.setType(AttributeCond.Type.GT); break; attributeCond.setType(AttributeCond.Type.GE); break; attributeCond.setType(AttributeCond.Type.LT); break;
@Override public SearchCond visitATTR_PR(final SCIMFilterParser.ATTR_PRContext ctx) { AttributeCond cond = createAttributeCond(ctx.ATTRNAME().getText()); cond.setType(AttributeCond.Type.ISNOTNULL); return SearchCond.getLeafCond(cond); }
private <E extends Enum<?>> SearchCond complex( final String operator, final String left, final String right, final List<SCIMComplexConf<E>> items) { if (left.endsWith(".type")) { Optional<SCIMComplexConf<E>> item = items.stream(). filter(object -> object.getType().name().equals(StringUtils.strip(right, "\""))).findFirst(); if (item.isPresent()) { AttributeCond attributeCond = new AttributeCond(); attributeCond.setSchema(item.get().getValue()); attributeCond.setType(AttributeCond.Type.ISNOTNULL); return SearchCond.getLeafCond(attributeCond); } } else if (!conf.getUserConf().getEmails().isEmpty() && (MULTIVALUE.contains(left) || left.endsWith(".value"))) { List<SearchCond> orConds = new ArrayList<>(); items.forEach(item -> { AttributeCond cond = new AttributeCond(); cond.setSchema(item.getValue()); cond.setExpression(StringUtils.strip(right, "\"")); orConds.add(setOperator(cond, operator)); }); if (!orConds.isEmpty()) { return SearchCond.getOrCond(orConds); } } return null; }
private SearchCond addresses( final String operator, final String left, final String right, final List<SCIMUserAddressConf> items) { if (left.endsWith(".type") && "eq".equals(operator)) { Optional<SCIMUserAddressConf> item = items.stream(). filter(object -> object.getType().name().equals(StringUtils.strip(right, "\""))).findFirst(); if (item.isPresent()) { AttributeCond attributeCond = new AttributeCond(); attributeCond.setSchema(item.get().getFormatted()); attributeCond.setType(AttributeCond.Type.ISNOTNULL); return SearchCond.getLeafCond(attributeCond); } } else if (!conf.getUserConf().getEmails().isEmpty() && (MULTIVALUE.contains(left) || left.endsWith(".value"))) { List<SearchCond> orConds = new ArrayList<>(); items.forEach(item -> { AttributeCond cond = new AttributeCond(); cond.setSchema(item.getFormatted()); cond.setExpression(StringUtils.strip(right, "\"")); orConds.add(setOperator(cond, operator)); }); if (!orConds.isEmpty()) { return SearchCond.getOrCond(orConds); } } return null; }
: new AttributeCond(); cond.setSchema(schema); cond.setType(type); cond.setExpression(expression);
if (!specialAttrName.isPresent()) { if (specialAttrValue.isPresent() && specialAttrValue.get() == SpecialAttr.NULL) { attributeCond.setType(AttributeCond.Type.ISNULL); attributeCond.setExpression(null); } else if (value.indexOf('%') == -1) { attributeCond.setType(sc.getConditionType() == ConditionType.CUSTOM ? AttributeCond.Type.IEQ : AttributeCond.Type.EQ); } else { attributeCond.setType(sc.getConditionType() == ConditionType.CUSTOM ? AttributeCond.Type.ILIKE : AttributeCond.Type.LIKE); leaf.getAttributeCond().setType(AttributeCond.Type.ISNOTNULL); } else if (leaf.getAnyCond() != null && leaf.getAnyCond().getType() == AttributeCond.Type.ISNULL) { attributeCond.setType(AttributeCond.Type.GE); leaf = SearchCond.getLeafCond(attributeCond); break; attributeCond.setType(AttributeCond.Type.GT); leaf = SearchCond.getLeafCond(attributeCond); break; attributeCond.setType(AttributeCond.Type.LE); leaf = SearchCond.getLeafCond(attributeCond); break;
@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; }