当前位置: 首页>>代码示例>>Java>>正文


Java BooleanBuilder类代码示例

本文整理汇总了Java中com.querydsl.core.BooleanBuilder的典型用法代码示例。如果您正苦于以下问题:Java BooleanBuilder类的具体用法?Java BooleanBuilder怎么用?Java BooleanBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BooleanBuilder类属于com.querydsl.core包,在下文中一共展示了BooleanBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: events

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
@GetMapping("events")
HttpEntity<Resources<?>> events(PagedResourcesAssembler<AbstractEvent<?>> assembler,
		@SortDefault("publicationDate") Pageable pageable,
		@RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime since,
		@RequestParam(required = false) String type) {

	QAbstractEvent $ = QAbstractEvent.abstractEvent;

	BooleanBuilder builder = new BooleanBuilder();

	// Apply date
	Optional.ofNullable(since).ifPresent(it -> builder.and($.publicationDate.after(it)));

	// Apply type
	Optional.ofNullable(type) //
			.flatMap(events::findEventTypeByName) //
			.ifPresent(it -> builder.and($.instanceOf(it)));

	Page<AbstractEvent<?>> result = events.findAll(builder, pageable);

	PagedResources<Resource<AbstractEvent<?>>> resource = assembler.toResource(result, event -> toResource(event));
	resource
			.add(links.linkTo(methodOn(EventController.class).events(assembler, pageable, since, type)).withRel("events"));

	return ResponseEntity.ok(resource);
}
 
开发者ID:olivergierke,项目名称:sos,代码行数:27,代码来源:EventController.java

示例2: buildMapQuery

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
private Predicate buildMapQuery(MapQuery query, MapPath<String, Object, SimplePath<Object>> properties) {

        if (query.isEmpty()) {
            return null;
        }

        BooleanBuilder predicate = new BooleanBuilder();

        if (query.getContainsKey() != null) {
            predicate.and(properties.containsKey(query.getContainsKey()));
        }

        if (query.getContainsValue() != null) {
            predicate.and(properties.containsValue(query.getContainsValue()));
        }

        if (!query.getHas().isEmpty()) {
            for (Iterator<String> iterator = query.getHas().keySet().iterator(); iterator.hasNext();) {
                String key = iterator.next();
                predicate.and(properties.contains(key, query.getHas().get(key)));
            }
        }

        return predicate;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:26,代码来源:TreeQueryBuilder.java

示例3: buildTextQuery

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
private Predicate buildTextQuery(TextQuery txt, StringPath txtfield) {

        if (txt.isEmpty()) {
            return null;
        }

        BooleanBuilder predicate = new BooleanBuilder();

        if (txt.getContains() != null) {
            predicate.and(txtfield.contains(txt.getContains()));
        }

        if (txt.getStartWith() != null) {
            predicate.and(txtfield.startsWith(txt.getStartWith()));
        }

        if (txt.getEndWith() != null) {
            predicate.and(txtfield.endsWith(txt.getEndWith()));
        }

        if (txt.getEquals() != null) {
            predicate.and(txtfield.endsWith(txt.getEquals()));
        }

        return predicate;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:27,代码来源:DataQueryBuilder.java

示例4: buildAppUserListQuery

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
private Predicate buildAppUserListQuery(StringListQuery query, ListPath<AppUser, QAppUser> list) {

        if (query.isEmpty()) {
            return null;
        }

        BooleanBuilder predicate = new BooleanBuilder();

        if (query.getIn() != null) {
            predicate.and(list.any().id.in(query.getIn()));
        }

        return predicate;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:15,代码来源:AppQueryBuilder.java

示例5: getDevices

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
@ApiOperation(value = "Return the user devices", notes = "", response = Device.class, nickname = "getDevices")
@PreAuthorize("@raptorSecurity.list(principal, 'device')")

public ResponseEntity<?> getDevices(
        @AuthenticationPrincipal User currentUser,
        Pageable pageable
) {

    String userId = currentUser.getId();
    if (currentUser.isAdmin()) {
        userId = null;
    }

    QDevice device = new QDevice("device");
    BooleanBuilder predicate = new BooleanBuilder();

    if (userId != null) {
        predicate.and(device.userId.eq(userId));
    }
    
    Page<Device> result = deviceService.search(predicate, pageable);
    
    return ResponseEntity.ok(result);
}
 
开发者ID:raptorbox,项目名称:raptor,代码行数:26,代码来源:InventoryController.java

示例6: findAvailableAllocationEntities

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
@Override
public List<AllocationEntity> findAvailableAllocationEntities(LocalDate dateFrom, LocalDate dateTo) {
	QAllocationEntity allocationEntity = QAllocationEntity.allocationEntity;
	QAccomodation accomodation = QAccomodation.accomodation;
	JPAQueryFactory queryFactory = new JPAQueryFactory(entityManager);
	BooleanBuilder builder = new BooleanBuilder(), doesPeriodsOverlap = new BooleanBuilder();

	doesPeriodsOverlap.and(accomodation.dateFrom.after(dateTo).not())
			.and(accomodation.dateTo.before(dateFrom).not());

	builder.and(allocationEntity.availability.isTrue());
	builder.and(JPAExpressions.selectFrom(accomodation)
			.where(accomodation.in(allocationEntity.accomodations), doesPeriodsOverlap).notExists());

	return queryFactory
			.selectFrom(allocationEntity)
			.where(builder)
			.fetch();
}
 
开发者ID:marcin-pwr,项目名称:hotel,代码行数:20,代码来源:AllocationEntityRepositoryImpl.java

示例7: getNumberOfFreePlaces

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
@Override
public Integer getNumberOfFreePlaces() {
	QAllocationEntity allocationEntity = QAllocationEntity.allocationEntity;
	QAccomodation accomodation = QAccomodation.accomodation;
	JPAQueryFactory queryFactory = new JPAQueryFactory(entityManager);
	BooleanBuilder builder = new BooleanBuilder(),
			isAccomodationInCurrentDate = new BooleanBuilder();
	LocalDate currentDate = new LocalDate();
	
	isAccomodationInCurrentDate.and(accomodation.dateFrom.after(currentDate).not())
	.and(accomodation.dateTo.before(currentDate).not());
	
	builder.and(allocationEntity.availability.isTrue());
	builder.and(JPAExpressions.selectFrom(accomodation)
			.where(accomodation.in(allocationEntity.accomodations), isAccomodationInCurrentDate).notExists());
	
	return queryFactory
			.from(allocationEntity)
			.select(allocationEntity.capacity.sum())
			.where(builder)
			.fetchOne();
}
 
开发者ID:marcin-pwr,项目名称:hotel,代码行数:23,代码来源:AllocationEntityRepositoryImpl.java

示例8: extend

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
@Override
public void extend(@Nonnull RequirementSearchContext context) {
    QVariableInstanceEntity variableEntity = new QVariableInstanceEntity(variableName);
    RequirementSearchQuery query = context.getQuery();
    RequirementSearchAliases $ = context.getAliases();

    createSelect(variableEntity, context);

    query.leftJoin($.flowInstance.variables, variableEntity).on(variableEntity.name.eq(variableName));

    QuickFilter quickFilter = context.getQuickFilter();
    if (context.getQuickFilter().hasFilter()) {
        BooleanBuilder filterBooleanBuilder = new BooleanBuilder();
        for (FilterToken token : quickFilter.listFilterTokens()) {
            BooleanBuilder tokenBooleanBuilder = new BooleanBuilder();
            for (String filter : token.getAllPossibleMatches()) {
                tokenBooleanBuilder.or(toChar(variableEntity).likeIgnoreCase(filter));
            }
            filterBooleanBuilder.and(tokenBooleanBuilder);
        }
        query.getQuickFilterWhereClause().or(filterBooleanBuilder);
    }
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:24,代码来源:FlowVariableRequirementSearchExtender.java

示例9: findFormAttachmentByCodRequirement

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
public List<FormAttachmentEntity> findFormAttachmentByCodRequirement(Long codRequirement) {
    QRequirementEntity requirement = new QRequirementEntity("requirementEntity");
    QFormRequirementEntity formRequirement = new QFormRequirementEntity("formRequirementEntity");
    QFormEntity form = new QFormEntity("formEntity");
    QDraftEntity currentDraft = new QDraftEntity("draftEntity");
    QFormEntity draftForm = new QFormEntity("draftFormEntity");
    QFormVersionEntity formVersion = new QFormVersionEntity("formVersionEntity");
    QFormAttachmentEntity formAttachment = new QFormAttachmentEntity("formAttachmentEntity");

    return new HibernateQueryFactory(getSession())
            .selectDistinct(formAttachment)
            .from(requirement)
            .innerJoin(requirement.formRequirementEntities, formRequirement)
            .leftJoin(formRequirement.form, form)
            .leftJoin(formRequirement.currentDraftEntity, currentDraft)
            .leftJoin(currentDraft.form, draftForm)
            .from(formVersion)
            .from(formAttachment)
            .where(new BooleanBuilder()
                    .and(formVersion.formEntity.cod.eq(form.cod)
                            .or(formVersion.formEntity.cod.eq(draftForm.cod)))
                    .and(formAttachment.formVersionEntity.cod.eq(formVersion.cod))
                    .and(requirement.cod.eq(codRequirement)))
            .fetch();
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:26,代码来源:RequirementDAO.java

示例10: applyGlobalSearch

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
/**
 * Adds a global contains text filter on the provided attributes.
 * WARNING: this creates a very inefficient query. If you have many entity
 * instances to query, use instead an indexed text search solution for better
 * performance.
 * @param text the text to look for
 * @param query
 * @param globalSearchAttributes the list of attributes to perform the
 *        filter on
 * @return the updated query
 */
protected JPQLQuery<T> applyGlobalSearch(String text, JPQLQuery<T> query,
    Path<?>... globalSearchAttributes) {
  if (text != null && !StringUtils.isEmpty(text) && globalSearchAttributes.length > 0) {
    BooleanBuilder searchCondition = new BooleanBuilder();
    for (int i = 0; i < globalSearchAttributes.length; i++) {
      Path<?> path = globalSearchAttributes[i];
      if (path instanceof StringPath) {
        StringPath stringPath = (StringPath) path;
        searchCondition.or(stringPath.containsIgnoreCase(text));
      } else if (path instanceof NumberExpression) {
        searchCondition.or(((NumberExpression<?>) path).like("%".concat(text).concat("%")));
      }
    }
    return query.where(searchCondition);
  }
  return query;
}
 
开发者ID:DISID,项目名称:springlets,代码行数:29,代码来源:QueryDslRepositorySupportExt.java

示例11: read

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public ExtDirectStoreResult<User> read(ExtDirectStoreReadRequest request) {

	JPQLQuery<User> query = this.jpaQueryFactory.selectFrom(QUser.user);
	if (!request.getFilters().isEmpty()) {
		StringFilter filter = (StringFilter) request.getFilters().iterator().next();

		BooleanBuilder bb = new BooleanBuilder();
		bb.or(QUser.user.loginName.containsIgnoreCase(filter.getValue()));
		bb.or(QUser.user.lastName.containsIgnoreCase(filter.getValue()));
		bb.or(QUser.user.firstName.containsIgnoreCase(filter.getValue()));
		bb.or(QUser.user.email.containsIgnoreCase(filter.getValue()));

		query.where(bb);
	}
	query.where(QUser.user.deleted.isFalse());

	QuerydslUtil.addPagingAndSorting(query, request, User.class, QUser.user);
	QueryResults<User> searchResult = query.fetchResults();

	return new ExtDirectStoreResult<>(searchResult.getTotal(),
			searchResult.getResults());
}
 
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:25,代码来源:UserService.java

示例12: listByClub

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
@Transactional(readOnly = true)
public List<HarvestPermitAreaDTO> listByClub(final long clubId, final Integer huntingYear) {
    final HuntingClub huntingClub = requireClubWithReadPermission(clubId);

    final BooleanBuilder builder = new BooleanBuilder(QHarvestPermitArea.harvestPermitArea.club.eq(huntingClub));

    if (huntingYear != null) {
        builder.and(QHarvestPermitArea.harvestPermitArea.huntingYear.eq(huntingYear));
    }

    return harvestPermitAreaDTOTransformer.transform(harvestPermitAreaRepository.findAllAsList(builder.getValue()));
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:13,代码来源:HarvestPermitAreaFeature.java

示例13: buildTextQuery

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
private Predicate buildTextQuery(TextQuery txt, StringPath txtfield) {

        if (txt.isEmpty()) {
            return null;
        }

        BooleanBuilder predicate = new BooleanBuilder();

        if (txt.getContains() != null) {
            predicate.and(txtfield.contains(txt.getContains()));
        }

        if (txt.getStartWith() != null) {
            predicate.and(txtfield.startsWith(txt.getStartWith()));
        }

        if (txt.getEndWith() != null) {
            predicate.and(txtfield.endsWith(txt.getEndWith()));
        }

        if (txt.getEquals() != null) {
            predicate.and(txtfield.endsWith(txt.getEquals()));
        }

        if (!txt.getIn().isEmpty()) {
            predicate.and(txtfield.in(txt.getIn()));
        }

        return predicate;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:31,代码来源:TreeQueryBuilder.java

示例14: getPredicate

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
public Predicate getPredicate() {

        QApp app = new QApp("app");

        BooleanBuilder predicate = new BooleanBuilder();

        if (query.getUserId() != null) {
            predicate.and(app.userId.eq(query.getUserId()));
        }

        // id
        Predicate pid = buildTextQuery(query.id, app.id);
        if (pid != null) {
            predicate.and(pid);
        }

        // name
        Predicate pname = buildTextQuery(query.name, app.name);
        if (pname != null) {
            predicate.and(pname);
        }

        // description
        Predicate pdesc = buildTextQuery(query.description, app.description);
        if (pdesc != null) {
            predicate.and(pdesc);
        }

        //users (id)
        Predicate users = buildAppUserListQuery(query.users, app.users);
        if (users != null) {
            predicate.and(users);
        }

        return predicate;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:37,代码来源:AppQueryBuilder.java

示例15: buildListQuery

import com.querydsl.core.BooleanBuilder; //导入依赖的package包/类
private Predicate buildListQuery(StringListQuery query, ListPath<String, StringPath> list) {

        if (query.isEmpty()) {
            return null;
        }

        BooleanBuilder predicate = new BooleanBuilder();

        if (query.getIn() != null && query.getIn().isEmpty()) {
            predicate.and(list.any().in(query.getIn()));
        }

        return predicate;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:15,代码来源:AppQueryBuilder.java


注:本文中的com.querydsl.core.BooleanBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。