Package com.mysema.query.jpa

Examples of com.mysema.query.jpa.JPASubQuery.list()


        if (includeGroups) {
            JPASubQuery groupSubQuery = subQuery().from(group).where(group.organization.id.eq(orgId));
            JPASubQuery groupUserDomainsSubQuery = subQuery().from(userDomain).where(userDomain.domain.in(groupSubQuery.list(group)));

            expressions.add(userDomain.in(groupUserDomainsSubQuery.list(userDomain)));
        }

        JPASubQuery userIdSubQuery = subQuery().from(userDomain).where(BooleanExpression.anyOf(expressions.toArray(new BooleanExpression[expressions.size()]))).groupBy(userDomain.user.id);
        ListSubQuery<Long> userIds = userIdSubQuery.list(userDomain.user.id);
View Full Code Here


            expressions.add(userDomain.in(groupUserDomainsSubQuery.list(userDomain)));
        }

        JPASubQuery userIdSubQuery = subQuery().from(userDomain).where(BooleanExpression.anyOf(expressions.toArray(new BooleanExpression[expressions.size()]))).groupBy(userDomain.user.id);
        ListSubQuery<Long> userIds = userIdSubQuery.list(userDomain.user.id);

        return cacheableQuery().from(user)
                .where(user.id.in(userIds))
                .distinct().count();
    }
View Full Code Here

                ));

        // Main Query - All Groups which the user is a direct admin (ROLE_GROUP_ADMIN) or through organizations which the user is an admin (ROLE_ORG_ADMIN)
        JPAQuery mainQuery = cacheableQuery().from(group)
                .where((group.in(
                        adminOrganizationGroups.list(group))
                        .or(group.in(groupAdminDomains.list(domain.as(group.getClass()))))).and(getActiveOrganizationBooleanExpression(group.organization, user))
                );

        return mainQuery.distinct().list(group);
    }
View Full Code Here

        JPASubQuery userGroups = getAllGroupsForUser(user);

        // Main query - All Groups which the user is a direct member (ROLE_GROUP_ADMIN or ROLE_GROUP_USER) or through organizations which the user is an admin (ROLE_ORG_ADMIN)
        JPAQuery mainQuery = cacheableQuery().from(group)
                .where(group.in(
                        userGroups.list(group)));

        return mainQuery.distinct().list(group);
    }

    @Override
View Full Code Here

        JPASubQuery userGroups = getAllGroupsForUser(user);

        // Main query - All Groups which the user is a direct member (ROLE_GROUP_ADMIN or ROLE_GROUP_USER) or through organizations which the user is an admin (ROLE_ORG_ADMIN)
        JPAQuery mainQuery = query().from(group)
                .join(group.organization, organization)
                .where(group.in(userGroups.list(group))
                        .and(getActiveOrganizationBooleanExpression(organization, user)));

        return mainQuery.distinct().list(group);
    }
}
View Full Code Here

                        .join(group.organization, organization)
                        .where(organization.in(getExplicitOrganizationsForUser(user).list(organization))).list(applicationVersion)));

        return cacheableQuery().from(applicationVersion)
                .where(applicationVersion.application.id.eq(applicationId) /* ApplicationVersion belongs to specified Application */
                        .and(applicationVersion.application.in(availableApplicationsForUser.list(application))) /* ApplicationVersion belongs to an application which the user has access */
                        .and(getApplicationVersionAppStateExpression(downloadableAppStates.toArray(new AppState[downloadableAppStates.size()]))) /* ApplicationVersion is in a downloadable AppState */
                        .and(applicationVersionOwnedGroup /* ApplicationVersion belongs to a group which a users has access */
                                .or(applicationVersionGuestGroup) /* ApplicationVersion is shared to a Guest Group which a user belongs */
                                .or(applicationVersionOrgPublish)
                        )
View Full Code Here

    public List<Category> getAllForUser(User user, ApplicationType deviceType) {

        JPASubQuery applicationsForUser = getApplicationsForUser(user, ApplicationType.getAllForUserDeviceType(deviceType).toArray(new ApplicationType[]{}));

        return cacheableQuery().from(category)
                .where(category.in(applicationsForUser.list(application.category)))
                .distinct().list(category);
    }
}
View Full Code Here

                .where(invitation.domain.id.in(
                        subQuery().from(group)
                                .where(group.organization.id.eq(organizationId))
                                .list(group.id)
                ).or(invitation.domain.id.eq(organizationId)));
        ListSubQuery<Invitation> invitationEmails = invitationIdSubQuery.list(invitation);

        return query().from(invitation).where(invitation.in(invitationEmails)).count();
    }

    @Override
View Full Code Here

        if (includeGroups) {
            // SubQuery to get all groups for an Organization
            JPASubQuery groupsForOrganization = subQuery().from(group).where(group.organization.id.eq(organizationId));

            // Boolean expression for groups
            domainExpressions.add(invitation.domain.id.in(groupsForOrganization.list(group.id)));
        }

        ListSubQuery<String> emailListSubQuery = subQuery().from(invitation)
                .where(invitation.email.in(emails)
                        .and(BooleanExpression.anyOf(domainExpressions.toArray(new BooleanExpression[domainExpressions.size()])))
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.