• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Expressions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: moderatedGroups

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private SQLQuery<Long> moderatedGroups(final Collection<Long> includedGameSpeciesIds, final int huntingYear) {
    final SQBasicClubHuntingSummary bchs = new SQBasicClubHuntingSummary("bchs");
    final SQHarvestPermitSpeciesAmount hpsa = new SQHarvestPermitSpeciesAmount("hpsa");
    final SQOrganisation group = new SQOrganisation("group");

    return SQLExpressions
            .select(group.organisationId)
            .from(bchs)
            .join(hpsa).on(hpsa.harvestPermitSpeciesAmountId.eq(bchs.speciesAmountId))
            .join(group).on(
                    group.parentOrganisationId.eq(bchs.clubId),
                    group.organisationType.eq(Expressions.asString(OrganisationType.CLUBGROUP.name())),
                    group.gameSpeciesId.eq(hpsa.gameSpeciesId),
                    group.harvestPermitId.eq(hpsa.harvestPermitId))
            .where(hpsa.gameSpeciesId.in(includedGameSpeciesIds),
                    bchs.moderatorOverride.isTrue(),
                    bchs.huntingFinished.isTrue(),
                    sqlDateInsideHuntingYear(bchs.huntingEndDate, huntingYear),
                    group.huntingYear.eq(huntingYear));
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:21,代码来源:AdminMooselikeHuntingMetricsService.java


示例2: isClubNameDuplicate

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
@Transactional(readOnly = true)
public boolean isClubNameDuplicate(Long clubId, String name) {
    final SQOrganisation club = SQOrganisation.organisation;

    final StringTemplate candidate = replaceAll(name.toLowerCase(), "\\W", "");
    final StringTemplate nameFi = replaceAll(club.nameFinnish.lower(), "\\W", "");
    final StringTemplate nameSv = replaceAll(club.nameSwedish.lower(), "\\W", "");
    final Boolean b = createNativeQuery()
            .select(Expressions.constant(true))
            .from(club)
            .where(club.organisationType.eq(OrganisationType.CLUB.name()),
                    clubId != null ? club.organisationId.ne(clubId) : null,
                    candidate.eq(nameFi).or(candidate.eq(nameSv)))
            .fetchOne();
    return Boolean.TRUE.equals(b);
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:17,代码来源:HuntingClubNameValidationFeature.java


示例3: getPermitIdToMooseHarvestReportExistsMapping

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private Map<Long, Boolean> getPermitIdToMooseHarvestReportExistsMapping(final List<HarvestPermit> permits,
                                                                        final int speciesCode,
                                                                        final int huntingYear) {
    final QHarvestPermitSpeciesAmount speciesAmount = QHarvestPermitSpeciesAmount.harvestPermitSpeciesAmount;
    final QMooseHarvestReport report = QMooseHarvestReport.mooseHarvestReport;
    final QGameSpecies species = QGameSpecies.gameSpecies;

    final JPQLQuery<Object> mooseHarvestReportQuery = jpqlQueryFactory.select(Expressions.nullExpression())
            .from(report)
            .where(report.speciesAmount.eq(speciesAmount));

    final Expression<Boolean> mooseHarvestReportExists = new CaseBuilder()
            .when(mooseHarvestReportQuery.exists()).then(Expressions.constant(true))
            .otherwise(Expressions.constant(false));

    return jpqlQueryFactory.select(speciesAmount.harvestPermit.id, mooseHarvestReportExists)
            .from(speciesAmount)
            .join(speciesAmount.gameSpecies, species)
            .where(speciesAmount.harvestPermit.in(permits),
                    species.officialCode.eq(speciesCode),
                    speciesAmount.validOnHuntingYear(huntingYear))
            .transform(groupBy(speciesAmount.harvestPermit.id).as(mooseHarvestReportExists));
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:24,代码来源:MoosePermitStatisticsService.java


示例4: synchronizeDateSequenceIfNecessary

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private Object synchronizeDateSequenceIfNecessary(final Connection connection,
    final Configuration configuration) {

  QDateSequence qDateSequence = QDateSequence.dateSequence;
  long dateSequenceCount = new SQLQuery<>(connection, configuration)
      .select(Expressions.ONE.count()).from(qDateSequence).fetchOne();

  if (dateSequenceCount == 0) {
    QDateRange qDateRange = QDateRange.dateRange;
    long dateRangeCount = new SQLQuery<>(connection, configuration)
        .select(Expressions.ONE.count()).from(qDateRange).fetchOne();
    if (dateRangeCount != 0) {
      fillDateSequenceFromDateRanges(connection, configuration, dateRangeCount);
    }
  }
  return null;
}
 
开发者ID:everit-org,项目名称:jira-hr-admin,代码行数:18,代码来源:JiraHRAdminPluginActivator.java


示例5: expectedWorkAmount

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
/**
 * Getting the expected work amount for a date period. The calculation for each day in the range
 * is done in the following order:
 * <ol>
 * <li>if there is an exact work day specified for a specific date, that is used. Otherwise</li>
 * <li>if there is a replacement day of a public holiday and there is a weekday specified for the
 * replaced holiday, that is used. Otherwise</li>
 * <li>If there is a non holiday weekday, that is used. Otherwise</li>
 * <li>zero is used.</li>
 * </ol>
 *
 * @param userId
 *          The id of the user who should have done the work.
 * @param startDate
 *          The date when we start calculating the work that should be done from.
 * @param endDateExcluded
 *          The date until we calculate the work that should be done (excluded).
 * @return The amount of work that should be done by the specified user in the specific time
 *         period.
 */
public static SQLQuery<Long> expectedWorkAmount(final Expression<Long> userId,
    final Expression<Date> startDate, final Expression<Date> endDateExcluded) {

  QDateSequence qDates = new QDateSequence("exp_work_dates");
  QDateRange qDateRange = new QDateRange("exp_work_date_range");
  QUserWorkScheme qUserWorkScheme = new QUserWorkScheme("exp_work_user_work_scheme");

  SQLQuery<Long> query = new SQLQuery<>();
  query.select(
      new Coalesce<Long>(Long.class,
          exactWorkSubSelect(qUserWorkScheme.workSchemeId, qDates.date),
          replacementWeekdaySubSelect(qUserWorkScheme.workSchemeId, userId, qDates.date),
          nonHolidayWeekdaySubSelect(qUserWorkScheme.workSchemeId, userId, qDates.date),
          Expressions.ZERO)
              .asNumber().sum());
  query
      .from(qDates)
      .innerJoin(qDateRange)
      .on(qDateRange.startDate.loe(qDates.date).and(qDateRange.endDateExcluded.gt(qDates.date)))
      .innerJoin(qUserWorkScheme).on(qUserWorkScheme.dateRangeId.eq(qDateRange.dateRangeId))
      .where(qDates.date.goe(startDate).and(qDates.date.lt(endDateExcluded))
          .and(qUserWorkScheme.userId.eq(userId)));

  return query;
}
 
开发者ID:everit-org,项目名称:jira-hr-admin,代码行数:46,代码来源:QueryUtil.java


示例6: buildOrderPropertyPathFrom

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
/**
 * Creates an {@link Expression} for the given {@link Order} property.
 *
 * @param order must not be {@literal null}.
 * @param builder must not be {@literal null}.
 * @return
 */
private static Expression<?> buildOrderPropertyPathFrom(Order order, PathBuilder<?> builder) {

	Assert.notNull(order, "Order must not be null!");
	Assert.notNull(builder, "Builder must not be null!");

	PropertyPath path = PropertyPath.from(order.getProperty(), builder.getType());
	Expression<?> sortPropertyExpression = builder;

	while (path != null) {

		if (!path.hasNext() && order.isIgnoreCase()) {
			// if order is ignore-case we have to treat the last path segment as a String.
			sortPropertyExpression = Expressions.stringPath((Path<?>) sortPropertyExpression, path.getSegment()).lower();
		} else {
			sortPropertyExpression = Expressions.path(path.getType(), (Path<?>) sortPropertyExpression, path.getSegment());
		}

		path = path.next();
	}

	return sortPropertyExpression;
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:30,代码来源:KeyValueQuerydslUtils.java


示例7: visit

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
@Override
public Expression<?> visit(Time node) {
    de.fraunhofer.iosb.ilt.sta.query.expression.Expression param = node.getParameters().get(0);
    Expression<?> input = param.accept(this);
    DateTimeExpression inExp = getSingleOfType(DateTimeExpression.class, input);
    if (inExp instanceof ConstantDateTimeExpression) {
        ConstantDateTimeExpression constant = (ConstantDateTimeExpression) inExp;
        if (!constant.isUtc()) {
            throw new IllegalArgumentException("Constants passed to the time() function have to be in UTC.");
        }
    }
    TimeTemplate<java.sql.Time> time = Expressions.timeTemplate(java.sql.Time.class, "pg_catalog.time({0})", inExp);
    return time;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:15,代码来源:PgExpressionHandler.java


示例8: subi

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
@Override
public TimeExpression subi(Expression<?> other) {
    if (other instanceof DateTimeExpression) {
        // We calculate with the start time and return a duration.
        DateTimeExpression dtStart = PgExpressionHandler.checkType(DateTimeExpression.class, start, false);
        String template = "({0}::timestamp - {1}::timestamp)";
        return new ConstantDurationExpression(Expressions.stringTemplate(template, other, dtStart));
    }
    throw new UnsupportedOperationException("Can not subtract TimeInterval from anything.");
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:11,代码来源:TimeIntervalExpression.java


示例9: sub

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
@Override
public TimeExpression sub(Expression<?> other) {
    if (other instanceof DateTimeExpression) {
        // We calculate with the start time and return a duration.
        DateTimeExpression dtStart = PgExpressionHandler.checkType(DateTimeExpression.class, start, false);
        String template = "({0}::timestamp - {1}::timestamp)";
        return new ConstantDurationExpression(Expressions.stringTemplate(template, dtStart, other));
    }
    return simpleOp("-", other);
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:11,代码来源:TimeIntervalExpression.java


示例10: simpleOp

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private TimeIntervalExpression simpleOp(String op, Expression<?> other) {
    if (other instanceof ConstantDurationExpression) {
        ConstantDurationExpression cd = (ConstantDurationExpression) other;
        DateTimeExpression dtEnd = PgExpressionHandler.checkType(DateTimeExpression.class, end, false);
        DateTimeExpression dtStart = PgExpressionHandler.checkType(DateTimeExpression.class, start, false);
        String template = "({0}::timestamp " + op + " {1}::interval)";
        DateTimeTemplate<Timestamp> newStart = Expressions.dateTimeTemplate(Timestamp.class, template, dtStart, cd.duration);
        DateTimeTemplate<Timestamp> newEnd = Expressions.dateTimeTemplate(Timestamp.class, template, dtEnd, cd.duration);
        return new TimeIntervalExpression(newStart, newEnd);
    }
    throw new UnsupportedOperationException("Can not add TimeInterval and " + other.getClass().getName());
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:13,代码来源:TimeIntervalExpression.java


示例11: createTypePredicate

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
/**
 * Find the common type that should be used to compare the given two
 * expressions.
 *
 * @param other The type of the other that we should enforce on the json
 * type.
 * @return the extra predicate to enforce the type with.
 */
private Predicate createTypePredicate(CompareType other) {
    switch (other) {
        case NUMBER:
            return Expressions.stringTemplate("jsonb_typeof({0})", jsonExpression).eq("number");
        case BOOLEAN:
            return Expressions.stringTemplate("jsonb_typeof({0})", jsonExpression).eq("boolean");
        default:
            return null;
    }
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:19,代码来源:JsonExpressionFactory.java


示例12: build

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
public Expression<?> build() {
    StringBuilder templateCore = new StringBuilder();
    boolean firstDone = false;
    for (String key : path) {
        if (firstDone) {
            templateCore.append(",");
        } else {
            firstDone = true;
        }
        templateCore.append(key);
    }
    String templateCoreString = templateCore.toString();
    String templateJsonb = "{0}::jsonb#>'{ " + templateCoreString + " }'";
    String templateString = "{0}::jsonb#>>'{ " + templateCoreString + " }'";
    String templateNumber = "safe_cast_to_numeric({0}::jsonb#>'{ " + templateCoreString + " }')";
    String templateBoolean = "safe_cast_to_boolean({0}::jsonb#>'{ " + templateCoreString + " }')";

    Map<String, Expression<?>> expressions = new HashMap<>();
    Map<String, Expression<?>> expressionsForOrder = new HashMap<>();
    StringTemplate stringTemplate = Expressions.stringTemplate(templateString, jsonField);
    // TODO: Review if this should change to the jsonb field.
    expressionsForOrder.put("s", stringTemplate);
    expressions.put(KEY_STRING, stringTemplate);
    expressions.put(KEY_NUMBER, Expressions.numberTemplate(Double.class, templateNumber, jsonField));
    expressions.put(KEY_BOOLEAN, Expressions.booleanTemplate(templateBoolean, jsonField));
    ComparableTemplate<String> jsonExpression = Expressions.comparableTemplate(String.class, templateJsonb, jsonField);
    expressions.put(KEY_JSONB, jsonExpression);

    ListExpression listExpression = new ListExpressionJson(expressions, expressionsForOrder, jsonExpression);

    return listExpression;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:33,代码来源:JsonExpressionFactory.java


示例13: simpleOpBool

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private BooleanExpression simpleOpBool(String op, Expression<?> other) {
    if (other instanceof ConstantDurationExpression) {
        ConstantDurationExpression cd = (ConstantDurationExpression) other;
        String template = "({0}::interval " + op + " {1}::interval)";
        return Expressions.booleanTemplate(template, this.duration, cd.duration);
    }
    throw new UnsupportedOperationException("Can not compare between Duration and " + other.getClass().getName());
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:9,代码来源:ConstantDurationExpression.java


示例14: nonHolidayWeekdaySubSelect

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private static Expression<Long> nonHolidayWeekdaySubSelect(final NumberPath<Long> workSchemeId,
    final Expression<Long> userId, final DatePath<Date> date) {

  QWeekdayWork qWeekdayWork = new QWeekdayWork("exp_work_nh_wdw");

  SQLQuery<Long> query = new SQLQuery<>();
  query.select(qWeekdayWork.duration.sum()).from(qWeekdayWork)
      .where(qWeekdayWork.workSchemeId.eq(workSchemeId)
          .and(date.dayOfWeek()
              .eq(Expressions.path(Integer.class, qWeekdayWork.weekday.getMetadata())))
          .and(noHolidayExistsSubSelect(userId, date)));
  return query;
}
 
开发者ID:everit-org,项目名称:jira-hr-admin,代码行数:14,代码来源:QueryUtil.java


示例15: weekdaySumForReplacementDay

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private static Expression<Long> weekdaySumForReplacementDay(final NumberPath<Long> workSchemeId,
    final NumberExpression<Integer> dayOfWeek) {
  QWeekdayWork qWeekdayWork = new QWeekdayWork("exp_work_repl_wdw");
  SQLQuery<Long> query = new SQLQuery<>();
  query.select(qWeekdayWork.duration.sum())
      .from(qWeekdayWork)
      .where(qWeekdayWork.workSchemeId.eq(workSchemeId)
          .and(
              Expressions.path(Integer.class, qWeekdayWork.weekday.getMetadata()).eq(dayOfWeek)));
  return query;
}
 
开发者ID:everit-org,项目名称:jira-hr-admin,代码行数:12,代码来源:QueryUtil.java


示例16: appendOrder

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private void appendOrder() {
    if (quickFilter.getSortProperty() != null) {
        Order order = quickFilter.isAscending() ? Order.ASC : Order.DESC;
        query.orderBy(new OrderSpecifier<>(order, Expressions.stringPath(quickFilter.getSortProperty())));
    } else if (!Boolean.TRUE.equals(ctx.getCount())) {
        if (quickFilter.isRascunho()) {
            query.orderBy(new OrderSpecifier<>(Order.ASC, Expressions.stringPath("creationDate")));
        } else {
            query.orderBy(new OrderSpecifier<>(Order.ASC, Expressions.stringPath("processBeginDate")));
        }
    }
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:13,代码来源:RequirementSearchQueryFactory.java


示例17: createFilterParam

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private QuerydslFilterParam createFilterParam(Class<? extends Comparable> numberClass, String... pathSelectors) {
    QuerydslFilterParam querydslFilterParam = new QuerydslFilterParam();
    Map<String, Path> mapping = Maps.newHashMap();
    for (String pathSelector : pathSelectors)
        mapping.put(pathSelector, Expressions.dateTimePath(numberClass, pathSelector));
    querydslFilterParam.setMapping(mapping);
    return querydslFilterParam;

}
 
开发者ID:vineey,项目名称:archelix-rsql,代码行数:10,代码来源:QuerydslFilterBuilder_DateTimePath_Test.java


示例18: createFilterParam

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private QuerydslFilterParam createFilterParam(Class<? extends Comparable> numberClass, String... pathSelectors) {
    QuerydslFilterParam querydslFilterParam = new QuerydslFilterParam();
    Map<String, Path> mapping = Maps.newHashMap();
    for (String pathSelector : pathSelectors)
        mapping.put(pathSelector, Expressions.timePath(numberClass, pathSelector));
    querydslFilterParam.setMapping(mapping);
    return querydslFilterParam;

}
 
开发者ID:vineey,项目名称:archelix-rsql,代码行数:10,代码来源:QuerydslFilterBuilder_TimePath_Test.java


示例19: createFilterParam

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private QuerydslFilterParam createFilterParam(String... pathSelectors) {
    QuerydslFilterParam querydslFilterParam = new QuerydslFilterParam();
    HashMap<String, Path> mapping = Maps.newHashMap();
    for (String pathSelector : pathSelectors)
        mapping.put(pathSelector, Expressions.enumPath(Status.class, pathSelector));
    querydslFilterParam.setMapping(mapping);
    return querydslFilterParam;
}
 
开发者ID:vineey,项目名称:archelix-rsql,代码行数:9,代码来源:QuerydslFilterBuilder_EnumPath_Test.java


示例20: createFilterParam

import com.querydsl.core.types.dsl.Expressions; //导入依赖的package包/类
private QuerydslFilterParam createFilterParam(String... pathSelectors) {
    QuerydslFilterParam querydslFilterParam = new QuerydslFilterParam();
    HashMap<String, Path> mapping = Maps.newHashMap();
    for (String pathSelector : pathSelectors)
        mapping.put(pathSelector, Expressions.stringPath(pathSelector));
    querydslFilterParam.setMapping(mapping);
    return querydslFilterParam;
}
 
开发者ID:vineey,项目名称:archelix-rsql,代码行数:9,代码来源:QuerydslFilterBuilder_StringPath_Test.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IPackageStatsObserver类代码示例发布时间:2022-05-21
下一篇:
Java PathIsNotEmptyDirectoryException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap