Activiti: Rest Api paging - java

I have 500 process instances in activiti. I am retrieving them by using REST Api pagination
/runtime/tasks?processDefinitionId=test:1:1212&includeProcessVariables=true&start=0&size=10
It works until start=125&size=10. However I use high value for start=105&size=10, return nothing. I remove includeProcessVariables=true from query param, pagination works again.
This question is also asked in alfresco community, no answers reply.

Related

Spring Pagination ?size really affects request time

I have got a simple CRUD application - get some entities, convert it to DTO and send via REST controller.
I want to search by the field, that is not unique, but really rarely recurring. So when I send POST with 'field':'123' - my app return only 2 records.
The question is why when I send ?sort=someFiled%2Cdesc&size=10000&page=0the request take a really long time (~900ms), but when I send it with size=10, the request duration is ~150ms? When the result is only 2 fields, I thought that the request should take the same time for many sizes.
Tested on my remote machine, because locally the time was to short to compare it.
Is this a spring problem?

Extending JBoss Data Virt ws translator to handle paginated source

What is a good way to extend org.teiid.translator.ws to read a complete set of records by iterating over all pages returned by a paginated webservice?
Since the pagination of results is not part of any REST API standard (unlike OData), you would have to extend the current translator and provide that custom behaviour to scroll through the pagination. Unlike JDBC kind of resultset scrolling, you would need to devise a way to execute the URL with your offsets each time the Teiid engine asks for next batch of results. If you want an example take look at OData translator for similar flow.

Play Framework 2 paginating data from a web service

There have been several Play Framework pagination questions but all have been using JPA or ebean. I need to paginate data I am getting returned from a web service. Is there a way to do this with the Play Pagination Module or am I stuck with jQuery? I am also new to play and Java coming from asp.net MVC. The web service is returning a List of whatever model I am querying.
You should not paginate results from web service in the Play's controller as it would be not optimal, consider 3 scenarios (in that order)
Let's say that you want to display 10 items at once, but your generator returns 100.000 for sample query (which means 10.000 of pages)
Pagination should be done by data generator (web service in this case), so you should sent a query containg data: what are you looking for, how big page you want to get and which page you need ie: ?q=pagination&size=10&page=123. This will respond with List of 10 items on page 123. If you have possibility to change the web service to add pagination it's best choice.
If web service doesn't offer pagination get all results at once and use jQuery to paginate it. So if you'll get set of 100.000 items put all of them to the client and make sure that every page change won't cause querying the web service. Poor option, but still better than next one.
You can iterate returned results to split it easily to the pages, count total amount, etc, etc. If you'll use controller for paginating it, at every page change it will be fetching 100.000 items and then splitting to display just 10 of them. Drama :)
So if you can't use first option and don't want to use jQuery make some caching of the results on your server (ie, by storing results in the database as a separate rows) - in such case you will be able to use Ebean for local searching and paging.

Salesforce REST API Query More than 2000

I'm trying to execute a SOQL query using salesforce REST API which will return 2,749 results. However it seems there is a limit of 2,000 results that can be returned for a given request.
Is there a way to query the remaining 749 results without using the OFFSET keyword? (it's not currently supported in my production environment).
I looked into this and found a queryMore function but I can't find a way to call it through the REST API.
part of the result is a nextRecordsUrl property which when you do a GET on it, will return you the next chunk of the results. See the section on query in the rest api docs.

Is it possible to query for all users posts created by your Facebook application?

We are wanting to create a Facebook application that people can add to their page, and then when they post content from it on their wall, we want to have the ability for our application to periodically query for posts created by use of this application to pull and display back on our website. I've perused the documentation and don't see a way, so figured I'd ask incase I'm just missing it.
Thank you,
JT
Here is some thoughts that maybe will steer you in the right direction (I haven't tried this myself).
You can get wall posts by running FQL on stream table. Getting all wall posts by user id (source_id) seems straight forward, but getting all wall posts made from an app might require some extra work. Doc says:
If you want to return all the posts from a user's stream that were published through your application, make sure you include the app_id in your query.
Not sure if query will work if you do a search directly by app_id field as it is not indexed (but worth trying). If not, then looks like you need to do a search by filter_key. Now docs don't really explain what exactly that field means (surprise), but on their stream.get page from Old REST API it says:
You can determine the filters using stream.getFilters or querying the stream_filter FQL table. Filters can be user-defined, Facebook-defined (like News Feed/nf or networks), or for applications (app_<APPLICATION ID>).
Looks like app_<APPLICATION ID> filter is what we need for filter_key field (if that still works). If not then play with stream_filter table and see what kind of filters it contains and if there any sort of app filter available. I suspect your FQL might look something like:
SELECT message FROM stream WHERE filter_key = "application" AND app_id = 123456789

Categories

Resources