private void deleteMinusOneUserLocaleProperty(List<Long> ids, DbConnection dbConnection) { QOSPropertyEntry propertyEntry = QOSPropertyEntry.O_S_PROPERTY_ENTRY; QOSPropertyString propertyString = QOSPropertyString.O_S_PROPERTY_STRING; dbConnection.delete(propertyString).where(propertyString.id.in(ids)).execute(); dbConnection.delete(propertyEntry).where(propertyEntry.id.in(ids)).execute(); }
@Override public Set<Worklog> getWorklogsForIds(final Set<Long> worklogIds, final int maxResults) { return dbConnectionManager.executeQuery(dbConnection -> dbConnection.newSqlQuery() .from(WORKLOG) .leftJoin(QProjectRole.PROJECT_ROLE) .on(QProjectRole.PROJECT_ROLE.id.eq(WORKLOG.rolelevel)) .where(WORKLOG.id.in(worklogIds)) .limit(maxResults) .list(WORKLOG_ALIASED_PROJECT_ROLE_TUPLE) ).stream() .map(queryDSLWorklogFactory::createWorklogWithAliasedIdColumn) .collect(Collectors.toSet()); }
/** * Build a predicate that will only include users if this directory is their canonical directory. * i.e. ignore users that are shadowed by a higher priority directory. * * This method can return null if a predicate is not necessary. QueryDSL will gracefully ignore the null predicate. * * @param u the user table * @return the predicate, or null if there are no higher priority directories. */ @Nullable private BooleanExpression userIsNotShadowedPredicate(final QUser u) { BooleanExpression userIsNotShadowedPredicate = null; if (!higherPriorityDirectoryIds.isEmpty()) { QUser u2 = new QUser("u2"); userIsNotShadowedPredicate = new SQLSubQuery() .from(u2) .where(u2.lowerUserName.eq(u.lowerUserName) .and(u2.directoryId.in(higherPriorityDirectoryIds))) .notExists(); } return userIsNotShadowedPredicate; } }
@Test public void Any_In11() { List<Integer> ids = Lists.newArrayList(); for (Cat cat : savedCats) ids.add(cat.getId()); assertFalse(query().from(cat).where(cat.kittens.any().id.in(ids)).list(cat).isEmpty()); }
@Test public void In() { JPQLSerializer serializer = new JPQLSerializer(HQLTemplates.DEFAULT); serializer.handle(new NumberPath<Integer>(Integer.class, "id").in(Arrays.asList(1, 2))); assertEquals("id in (?1)", serializer.toString()); }
permission.authorizedResourceId.in(authorizationScopeLongArray);
@Test public void Case3() { assertEquals(ImmutableList.of(4, 4, 4, 4, 4, 4), query().from(cat).list(Expressions.cases() .when(cat.toes.in(2, 3)).then(cat.id.multiply(cat.toes)) .otherwise(4))); }
@Test public void In4() { //$.parameterRelease.id.eq(releaseId).and($.parameterGroups.any().id.in(filter.getGroups())); query().from(cat).where(cat.id.eq(1), cat.kittens.any().id.in(1,2,3)).list(cat); }
@Test public void In() { assertEquals(3l, query().from(cat).where(cat.name.in("Bob123", "Ruth123", "Felix123")).count()); query().from(cat).where(cat.id.in(Arrays.asList(1,2,3))).count(); query().from(cat).where(cat.name.in(Arrays.asList("A","B","C"))).count(); }
@Test public void In2() { query().from(cat).where(cat.id.in(1,2,3)).count(); query().from(cat).where(cat.name.in("A","B","C")).count(); }