/** * Constructor. * * It defaults the {@link #sortCriteria} to order by the {@link KapuaEntity#getCreatedOn()} {@link SortOrder#ASCENDING}. * * @since 1.0.0 */ public AbstractKapuaQuery() { setSortCriteria(new FieldSortCriteria(KapuaEntityAttributes.CREATED_ON, SortOrder.ASCENDING)); }
/** * Constructor */ private DeviceQueryImpl() { super(); setSortCriteria(new FieldSortCriteria(DeviceAttributes.CLIENT_ID, SortOrder.ASCENDING)); }
new AndPredicateImpl( new AttributePredicateImpl<>(CertificateAttributes.USAGE_NAME, "JWT"), new AttributePredicateImpl<>(CertificateAttributes.STATUS, CertificateStatus.VALID) certificateQuery.setSortCriteria(new FieldSortCriteria(CertificateAttributes.CREATED_BY, FieldSortCriteria.SortOrder.DESCENDING)); certificateQuery.setIncludeInherited(true); certificateQuery.setLimit(1);
if (kapuaQuery.getScopeId() != null) { AttributePredicateImpl<KapuaId> scopeId = new AttributePredicateImpl<>(KapuaEntityAttributes.SCOPE_ID, kapuaQuery.getScopeId()); AndPredicateImpl scopedAndPredicate = new AndPredicateImpl(); scopedAndPredicate.and(scopeId); scopedAndPredicate.and(kapuaQuery.getPredicate()); FieldSortCriteria sortCriteria = (FieldSortCriteria) kapuaQuery.getSortCriteria(); if (SortOrder.ASCENDING.equals(sortCriteria.getSortOrder())) { order = cb.asc(extractAttribute(entityRoot, sortCriteria.getAttributeName())); } else { order = cb.desc(extractAttribute(entityRoot, sortCriteria.getAttributeName()));
@When("^I search for events from device \"(.+)\" in account \"(.+)\"$") public void searchForEventsFromDeviceWithClientID(String clientId, String account) throws KapuaException { DeviceEventQuery tmpQuery; Device tmpDev; DeviceEventListResult tmpList; Account tmpAcc; tmpAcc = KapuaLocator.getInstance().getService(AccountService.class).findByName(account); Assert.assertNotNull(tmpAcc); Assert.assertNotNull(tmpAcc.getId()); tmpDev = deviceRegistryService.findByClientId(tmpAcc.getId(), clientId); Assert.assertNotNull(tmpDev); Assert.assertNotNull(tmpDev.getId()); tmpQuery = new DeviceEventQueryImpl(tmpAcc.getId()); tmpQuery.setPredicate(AttributePredicateImpl.attributeIsEqualTo("deviceId", tmpDev.getId())); tmpQuery.setSortCriteria(new FieldSortCriteria("receivedOn", FieldSortCriteria.SortOrder.ASCENDING)); tmpList = deviceEventsService.query(tmpQuery); Assert.assertNotNull(tmpList); stepData.put("DeviceEventList", tmpList); }
new AndPredicateImpl( new AttributePredicateImpl<>(CertificateAttributes.USAGE_NAME, "JWT"), new AttributePredicateImpl<>(CertificateAttributes.STATUS, CertificateStatus.VALID) certificateQuery.setSortCriteria(new FieldSortCriteria(CertificateAttributes.CREATED_BY, FieldSortCriteria.SortOrder.DESCENDING)); certificateQuery.setIncludeInherited(true); certificateQuery.setLimit(1);
if (kapuaQuery.getScopeId() != null) { AttributePredicateImpl<KapuaId> scopeId = new AttributePredicateImpl<>(KapuaEntityAttributes.SCOPE_ID, kapuaQuery.getScopeId()); AndPredicateImpl scopedAndPredicate = new AndPredicateImpl(); scopedAndPredicate.and(scopeId); scopedAndPredicate.and(kapuaQuery.getPredicate()); FieldSortCriteria sortCriteria = (FieldSortCriteria) kapuaQuery.getSortCriteria(); if (SortOrder.ASCENDING.equals(sortCriteria.getSortOrder())) { order = cb.asc(extractAttribute(entityRoot, sortCriteria.getAttributeName())); } else { order = cb.desc(extractAttribute(entityRoot, sortCriteria.getAttributeName()));
/** * Constructor. * * It defaults the {@link #sortCriteria} to order by the {@link KapuaEntity#getCreatedOn()} {@link SortOrder#ASCENDING}. * * @since 1.0.0 */ public AbstractKapuaQuery() { setSortCriteria(new FieldSortCriteria(KapuaEntityAttributes.CREATED_ON, SortOrder.ASCENDING)); }
/** * Constructor */ private DeviceEventQueryImpl() { super(); setSortCriteria(new FieldSortCriteria(DeviceEventAttributes.RECEIVED_ON, SortOrder.DESCENDING)); }
new AndPredicateImpl( new AttributePredicateImpl<>(JobStepAttributes.JOB_ID, jobStepCreator.getJobId()), new AttributePredicateImpl<>(JobStepAttributes.NAME, jobStepCreator.getName()) query.setPredicate(new AttributePredicateImpl<>(JobStepAttributes.JOB_ID, jobStepCreator.getJobId())); query.setSortCriteria(new FieldSortCriteria(JobStepAttributes.STEP_INDEX, FieldSortCriteria.SortOrder.DESCENDING)); query.setLimit(1); } else { query.setPredicate( new AndPredicateImpl( new AttributePredicateImpl<>(JobStepAttributes.JOB_ID, jobStepCreator.getJobId()), new AttributePredicateImpl<>(JobStepAttributes.STEP_INDEX, jobStepCreator.getStepIndex())
new AndPredicateImpl( new AttributePredicateImpl<>(JobStepAttributes.JOB_ID, jobStepCreator.getJobId()), new AttributePredicateImpl<>(JobStepAttributes.NAME, jobStepCreator.getName()) query.setPredicate(new AttributePredicateImpl<>(JobStepAttributes.JOB_ID, jobStepCreator.getJobId())); query.setSortCriteria(new FieldSortCriteria(JobStepAttributes.STEP_INDEX, FieldSortCriteria.SortOrder.DESCENDING)); query.setLimit(1); } else { query.setPredicate( new AndPredicateImpl( new AttributePredicateImpl<>(JobStepAttributes.JOB_ID, jobStepCreator.getJobId()), new AttributePredicateImpl<>(JobStepAttributes.STEP_INDEX, jobStepCreator.getStepIndex())