本文整理汇总了Java中com.querydsl.jpa.impl.JPAQueryFactory类的典型用法代码示例。如果您正苦于以下问题:Java JPAQueryFactory类的具体用法?Java JPAQueryFactory怎么用?Java JPAQueryFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JPAQueryFactory类属于com.querydsl.jpa.impl包,在下文中一共展示了JPAQueryFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
when(httpServletRequest.getRemoteAddr()).thenReturn("remote addr");
when(userDetails.getId()).thenReturn("user details id");
when(userDetails.getUsername()).thenReturn("user details id");
errorStore = new ErrorStore();
errorStore.setEntityManager(getEm());
errorStore.setTemplate(elasticsearchTemplate);
errorStore.setQueryFactory(new JPAQueryFactory(getEm()));
errorService = new ErrorService();
errorService.setRequest(httpServletRequest);
errorService.setUser(userDetails);
errorService.setStore(errorStore);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:20,代码来源:ErrorServiceTest.java
示例2: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
store = new AssignedRoleStore();
store.setEntityManager(getEm());
store.setQueryFactory(new JPAQueryFactory(getEm()));
roleStore = new RoleStore();
roleStore.setEntityManager(getEm());
roleStore.setQueryFactory(new JPAQueryFactory(getEm()));
roleStore.setTemplate(template);
objectMapper = new ObjectMapper();
logger = new AuditLogger();
logger.setMapper(objectMapper);
service = new AssignedRoleService();
service.setLogger(logger);
service.setStore(store);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:23,代码来源:AssignedRoleServiceTest.java
示例3: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
MockitoAnnotations.initMocks(this);
internalSigner = new InternalSigner();
EntityManager entityManager = getEm();
FileRefStore store = new FileRefStore();
store.setEntityManager(entityManager);
store.setQueryFactory(new JPAQueryFactory(entityManager));
store.setTemplate(template);
Files.createDirectories(Paths.get("testfiles"));
repository = new FileRepository();
repository.setStore(store);
repository.setBasePath("testfiles");
DSSProvider dssProvider = new DSSProvider();
signer = new PdfSigner();
signer.setRepository(repository);
signer.setpAdESService(dssProvider.pAdESService());
signer.setDigestAlgorithm(DigestAlgorithm.SHA256);
signer.setSuffix("Podepsany");
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:27,代码来源:PdfSignerTest.java
示例4: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
MockitoAnnotations.initMocks(this);
ObjectMapperProducer producer = new ObjectMapperProducer();
ObjectMapper mapper = producer.objectMapper(false, false);
provider.setApplicationContext(context);
provider.setObjectMapper(mapper);
store = new IndexedStoreImpl();
store.setEntityManager(getEm());
store.setQueryFactory(new JPAQueryFactory(getEm()));
store.setTemplate(getTemplate());
when(context.getBean(IndexedStoreImpl.class)).thenReturn(store);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:20,代码来源:IndexedProviderTest.java
示例5: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() throws IOException, TikaException, SAXException {
MockitoAnnotations.initMocks(this);
store = new FileRefStore();
store.setEntityManager(getEm());
store.setQueryFactory(new JPAQueryFactory(getEm()));
store.setTemplate(template);
createDirectories(Paths.get("fileTestFiles"));
TikaProvider tikaProvider = new TikaProvider();
TikaTransformer transformer = new TikaTransformer();
transformer.setTika(tikaProvider.tika());
repository = new FileRepository();
repository.setStore(store);
repository.setBasePath("fileTestFiles");
repository.setTransformer(transformer);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:21,代码来源:FileRepositoryTest.java
示例6: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
store = new FileRefStore();
store.setTemplate(template);
store.setQueryFactory(new JPAQueryFactory(getEm()));
store.setEntityManager(getEm());
createDirectories(Paths.get("fileTestFiles"));
TikaProvider tikaProvider = new TikaProvider();
TikaTransformer transformer = new TikaTransformer();
transformer.setTika(tikaProvider.tika());
repository = new FileRepository();
repository.setStore(store);
repository.setTransformer(transformer);
repository.setBasePath("fileTestFiles");
api = new FileApi();
api.setRepository(repository);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:24,代码来源:FileApiTest.java
示例7: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() throws SQLException {
MockitoAnnotations.initMocks(this);
store = new AssignedRoleStore();
JPAQueryFactory jpaQueryFactory = new JPAQueryFactory(getEm());
store.setQueryFactory(jpaQueryFactory);
store.setEntityManager(getEm());
roleStore = new RoleStore();
roleStore.setEntityManager(getEm());
roleStore.setQueryFactory(new JPAQueryFactory(getEm()));
roleStore.setTemplate(template);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:18,代码来源:AssignedRoleStoreTest.java
示例8: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() {
store = new DatedStoreImpl();
store.setEntityManager(getEm());
store.setQueryFactory(new JPAQueryFactory(getEm()));
storeGeneral = new DatedStoreDomainImpl();
storeGeneral.setEntityManager(getEm());
storeGeneral.setQueryFactory(new JPAQueryFactory(getEm()));
deleted = new DatedTestEntity();
deleted.setDeleted(Instant.now());
entities = asList(new DatedTestEntity(), new DatedTestEntity(), new DatedTestEntity());
entitiesAll = asList(entities, deleted);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:17,代码来源:DatedStoreTest.java
示例9: findAvailableAllocationEntities
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的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
示例10: getNumberOfFreePlaces
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的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
示例11: updateCleaningSchedules
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Scheduled(fixedRate = 86400000)
@Transactional
public void updateCleaningSchedules() {
JPAQueryFactory queryFactory = new JPAQueryFactory(entityManager);
QCleaningSchedule cs = QCleaningSchedule.cleaningSchedule;
QEmployee e = QEmployee.employee;
for (Long id : queryFactory.from(cs).select(cs.id).where(cs.employee.isNull()).fetch()) {
Employee notAssignedCleaner = queryFactory.selectFrom(e).where(e.job.eq(Job.CLEANER).and(e.cleaningSchedules.size().eq(0))).fetchFirst();
if (notAssignedCleaner == null) {
Employee lessOverloadedCleaner = queryFactory.select(cs.employee).from(cs).where(cs.isCompleted.isFalse()).groupBy(cs.employee).orderBy(cs.employee.count().asc()).fetchFirst();
queryFactory.update(cs).where(cs.id.eq(id)).set(cs.employee, lessOverloadedCleaner).execute();
} else {
queryFactory.update(cs).where(cs.id.eq(id)).set(cs.employee, notAssignedCleaner).execute();
}
}
System.out.println("Grafiki sprzątania zostały właśnie zaktualizowane " + dateFormat.format(new Date()));
}
开发者ID:marcin-pwr,项目名称:hotel,代码行数:18,代码来源:SchedulerService.java
示例12: getNotifications
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
public List<NotificationResponse> getNotifications(Integer limit) {
JPAQueryFactory queryFactory = new JPAQueryFactory(entityManager);
QNotification notification = QNotification.notification;
QueryResults<Notification> test = queryFactory.selectFrom(notification)
.where(notification.user.isNull().or(notification.user.eq(userService.getLoggedInUser())))
.orderBy(notification.id.desc()).limit(limit).fetchResults();
List<NotificationResponse> resp = new ArrayList<NotificationResponse>();
for (Notification n : test.getResults()) {
NotificationResponse nr = new NotificationResponse();
nr.setTitle(n.getTitle());
nr.setContent(n.getContent());
nr.setIssued(n.getIssued().toString("y-MM-dd HH:mm"));
nr.setLevel(n.getLevel().name());
resp.add(nr);
}
return resp;
}
开发者ID:marcin-pwr,项目名称:hotel,代码行数:18,代码来源:NotificationService.java
示例13: findVisibleCatalogItems
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
public <T extends CatalogItem> List<T> findVisibleCatalogItems(EntityPath<T> entityPath, List<T> items, String locale) {
QCatalogItem qCatalogItem = new QCatalogItem(entityPath);
Date now = new Date();
List<T> results = new JPAQueryFactory(entityManager)
.selectFrom(entityPath).where(
qCatalogItem.disabled.isFalse(),
qCatalogItem.endDate.after(now).or(qCatalogItem.endDate.isNull()),
qCatalogItem.startDate.before(now).or(qCatalogItem.startDate.isNull()),
qCatalogItem.in(items)
)
.fetch();
results.forEach((catalogItem) -> catalogItem.setLocalizedPresentation(locale));
return results;
}
开发者ID:remibantos,项目名称:jeeshop,代码行数:18,代码来源:CatalogItemFinder.java
示例14: findVisibleDiscounts
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
public List<Discount> findVisibleDiscounts(ApplicableTo applicableTo, String locale) {
Date now = new Date();
List<Discount> results = new JPAQueryFactory(entityManager)
.selectFrom(discount).where(
discount.disabled.isFalse(),
discount.endDate.after(now).or(discount.endDate.isNull()),
discount.startDate.before(now).or(discount.startDate.isNull()),
discount.applicableTo.eq(applicableTo),
discount.voucherCode.isNull()
).fetch();
results.forEach((discount) -> discount.setLocalizedPresentation(locale));
return results;
}
开发者ID:remibantos,项目名称:jeeshop,代码行数:17,代码来源:DiscountFinder.java
示例15: findEligibleOrderDiscounts
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
public List<Discount> findEligibleOrderDiscounts(String locale, Long completedOrderNumbers) {
Date now = new Date();
List<Discount> results = new JPAQueryFactory(entityManager)
.selectFrom(discount).where(
discount.disabled.isFalse(),
discount.endDate.after(now).or(discount.endDate.isNull()),
discount.startDate.before(now).or(discount.startDate.isNull()),
discount.applicableTo.eq(ApplicableTo.ORDER),
discount.triggerRule.ne(Discount.Trigger.ORDER_NUMBER).or(
discount.triggerValue.eq(completedOrderNumbers.doubleValue() + 1)
),
discount.voucherCode.isNull()
)
.fetch();
results.forEach((discount) -> discount.setLocalizedPresentation(locale));
return results;
}
开发者ID:remibantos,项目名称:jeeshop,代码行数:21,代码来源:DiscountFinder.java
示例16: findByUser
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
public List<Order> findByUser(User user, Integer offset, Integer limit, String orderby, Boolean isDesc, OrderStatus status) {
JPAQuery<Order> query = new JPAQueryFactory(entityManager).selectFrom(order)
.where(
order.user.eq(user),
status != null && status.equals(OrderStatus.CREATED) ? null : order.status.ne(OrderStatus.CREATED),
status != null ? order.status.eq(status) : null);
if (offset != null)
query.offset(offset);
if (limit != null)
query.limit(limit);
sortBy(orderby, isDesc, query);
return query.fetch();
}
开发者ID:remibantos,项目名称:jeeshop,代码行数:17,代码来源:OrderFinder.java
示例17: QuerydslQueryBackend
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
public QuerydslQueryBackend(QuerydslQueryImpl<T> queryImpl, Class<T> clazz, MetaDataObject parentMeta,
MetaAttribute parentAttr, boolean addParentSelection) {
this.queryImpl = queryImpl;
JPAQueryFactory queryFactory = queryImpl.getQueryFactory();
if (parentMeta != null) {
parentFrom = QuerydslUtils.getEntityPath(parentMeta.getImplementationClass());
root = QuerydslUtils.getEntityPath(clazz);
Path joinPath = (Path) QuerydslUtils.get(parentFrom, parentAttr.getName());
joinHelper = new JoinRegistry<>(this, queryImpl);
joinHelper.putJoin(new MetaAttributePath(), root);
if (addParentSelection) {
Expression<Object> parentIdExpr = getParentIdExpression(parentMeta, parentAttr);
querydslQuery = queryFactory.select(parentIdExpr, root);
} else {
querydslQuery = queryFactory.select(root);
}
querydslQuery = querydslQuery.from(parentFrom);
if (joinPath instanceof CollectionExpression) {
querydslQuery = querydslQuery.join((CollectionExpression) joinPath, root);
} else {
querydslQuery = querydslQuery.join((EntityPath) joinPath, root);
}
} else {
root = QuerydslUtils.getEntityPath(clazz);
joinHelper = new JoinRegistry<>(this, queryImpl);
joinHelper.putJoin(new MetaAttributePath(), root);
querydslQuery = queryFactory.select(root);
querydslQuery = querydslQuery.from((EntityPath) root);
}
}
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:37,代码来源:QuerydslQueryBackend.java
示例18: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() {
store = new SipProfileStore();
store.setEntityManager(getEm());
store.setQueryFactory(new JPAQueryFactory(getEm()));
generator = new ArclibXmlGenerator();
generator.setStore(store);
generator.setUris("http://www.loc.gov/METS/",
"http://arclib.lib.cas.cz/ARCLIB_XML",
"http://www.loc.gov/premis/v3"
);
generator.setSipProfileSchema(new ClassPathResource(VALIDATION_CHECKS));
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:16,代码来源:ArclibXmlGeneratorTest.java
示例19: setUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
store = new ValidationProfileStore();
store.setEntityManager(getEm());
store.setQueryFactory(new JPAQueryFactory(getEm()));
service = new ValidationService();
service.setValidationProfileStore(store);
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:12,代码来源:ValidationServiceTest.java
示例20: testSetUp
import com.querydsl.jpa.impl.JPAQueryFactory; //导入依赖的package包/类
@Before
public void testSetUp() throws Exception {
super.testSetUp();
MockitoAnnotations.initMocks(this);
store = new MyStore();
store.setEntityManager(getEm());
store.setQueryFactory(new JPAQueryFactory(getEm()));
store.setTemplate(getTemplate());
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:12,代码来源:ExampleTest.java
注:本文中的com.querydsl.jpa.impl.JPAQueryFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论