/** * Create the intersection of this and the union of the given args * {@code (this && (arg1 || arg2 ... || argN))} * * @param args * @return */ public BooleanBuilder andAnyOf(Predicate... args) { if (args.length > 0) { and(ExpressionUtils.anyOf(args)); } return this; }
/** * Get an intersection of this and the union of the given predicates * * @param predicates * @return */ public BooleanExpression andAnyOf(Predicate... predicates) { return and(ExpressionUtils.anyOf(predicates)); }
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); ArrayList<Identifiable> objects = new ArrayList<Identifiable>(); XDSDocumentEntry doc = getDocumentEntry(); if (doc != null) { List<Association> assocs = new JPAQuery(getSession().getEntityManager()) .from(QAssociation.association) .where(ExpressionUtils.anyOf(QAssociation.association.targetObject.eq(doc), QAssociation.association.sourceObject.eq(doc)), QAssociation.association.sourceObject.instanceOf(XDSDocumentEntry.class), QAssociation.association.targetObject.instanceOf(XDSDocumentEntry.class), QAssociation.association.assocType.id.in(getQueryParam(XDSConstants.QRY_ASSOCIATION_TYPES).getMultiValues(0))) .list(QAssociation.association); log.info("#### Found Associations:"+assocs); if (assocs.size() > 0) { objects.add(doc); Identifiable obj; for (Association assoc : assocs) { obj = assoc.getSourceObject().equals(doc) ? assoc.getTargetObject() : assoc.getSourceObject(); if (!objects.contains(obj)) { objects.add(obj); } } objects.addAll(assocs); } } rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, isLeafClass())); return rsp; }