Xpage multiple partial Update at the same time - xpages

I have a sever side javascript from where I am calling Java Class to write the content to the file by reading a view entries.
I can show the loader in xpage front end that there is something happing behind. Now the java class iterates through the view entries, I wish to print the current status by showing the number of entries done in Java class, like 100 of 3000 entries are done and the done entry counts need to be updated dynamically in xpage frontend. To achieve this, I tried:
From the java class I save the counts of processed entries to a document in the database in the field entryCounter in the while loop and so on, then trying to access the same document field inside the xpage view, but here the count updates after completing the previous script call which is of Java Class Call, after the java class completes and the last server side script call ends the count gets updated, which is of no use, I want to show the real time counts while java class is processing the entries in the front ent to the user, because the server side event takes at least 5 min to complete the event process.
In between, server side event the other server side event don't gets fired to partial update the count component which I am trying get from the document saved by java class.
Is there any other way to dynamically update the count of processed view in java class?
In short I am trying dynamically update the count which is update in document from Java Class, but it is not getting updated if already a server side call is going, one that call completed the value for last count updates to the computed field.

IMHO you'd better use a different approach: a background agent, and some document known to both the agent and your XPage that contains the counter. A process that takes more than a few seconds should not be run in the foreground. Is that a feasible solution?

Related

JHipster ComboBox lazyloading

I'm starter to use JHipster. One of my entity A has more than 3000 data. So I used infinite-scroll as pagination. But as relation to another Entry B, it will be generated as a comboBox in the dialog. I got only 20 data in the comboBox. There is no infinit-scroll or search and loading to get more data.
Can someone give any advice to fix the problem?
The infinite scroll uses pages (which is mapped to pageablea in spring). Thus, your service call that fetches the data for the box only fetches the first page. And the default page size is 20. So, you need to increase the page size to get more results.
You can either overwrite the "size" variable or the global constant called "itemsPerPage" which is located in pagination.constants.js
Am I right that it is a one-to-many relationshiop and you want to choose one of 3000 possible A for an entity B?
If so, you don't want to load all 3000 possible As into the dropdown. Therefore, I would replace the dropdown with another input, e.g. the typeahead from angular-ui (https://angular-ui.github.io/bootstrap/#/typeahead), so you can fetch a filtered subset of your entities.
Another way, I also used before, would be a list with a pagination for A that opens in a modal and returns the selected entity that could be passed to b.
Or, if you really want to fetch all: I would add a new endpoint without the pageable, add a new method to the angular-resource-service and call this instead of the paged version.

is plugin execution synchronized for delete message over multiple records?

I am new to Dynamics CRM and I could not find any information so far that would apply to my scenario.
We have a Program entity that can have/reference multiple program dates entities, and each program date can have/reference multiple event entities.
We have a view displaying all events associated with the program, and on the program form we want to display in a text the total number of events. From the view user can select multiple events then click delete button. This is a button that comes with CRM, not a custom one.
If I create a plugin for Delete message on event entity and want to query both program and Program date filed that keeps the total number of events then subtract one I am not sure these plugins will execute in sequence or concurrently thus having a race condition.
Now using javascript I also do not know if it is possible to read entity records PK and hook up into the pop up Confirm Deletion dialog box and execute after that a web service call
Any ideas?
Thanks
Dan
The deletes will process synchronously for the current user, but there is nothing that is preventing another user from performing deletes on Events that are also associated to the Program.
One option that you could look at is creating a flag on the Program and Program Date entities called "Events Deleted". Then create another plugin on the read that checks to see if it's "Events Deleted" flag has been flipped, and if so, recalculates the value, updates it and clears it's flag so it doesn't get calculated again.

Do lots of fields cause a partial refresh to be slow?

I have a lot of fields on a form. Not exactly sure how many but it has to be close to 100, if not over.
I have a change event of one field doing a partial refresh of a computed field with the following formula.
return document1.getItemValueString("txtCustomScore");
txtCustomScore is the field that has the event.
It takes 3-4 seconds to update this field. Are all of those other field somehow affecting how long it takes to refresh this field? It is taking 3-4 seconds.
I even tried getValue instead of getItemValueString. As suggested in this thread:
Setting a document field with replaceItemValue from a rich text control?
But it still takes 3-4 seconds to update the computed field.
Is there anyway to fix this other than eliminating fields from the form?
Yes it does. Even for a partial refresh all component values get evaluated and the server side result tree is built. As Tommy suggested, partial execution mode might be your answer
I strongly encourage you to watch the XPages Masterclass Video Series 1 (See: http://tonymcguckin.wordpress.com/2013/04/22/xpages-masterclass-series-1/).
From this you will then be able to introspect the XPages Request Processing Lifecycle phases and Profile your application. This will uncover the exact reasons behind the processing cost.

Unobvious model change

In a angularjs/express/postgres app, i want to load big list of json object from the db to the client.
Each json object is it's self pretty big. Each on is stored in a separate row.
So i want to display each json object as soon as they are read from db.
I've found the EventSource api, to progressivly send the json object from server to client.
Which works fine.
Then i want to display them on my view as soon as possible.
Working with event source include working with event listeners.
As explain here https://groups.google.com/forum/?fromgroups=#!topic/angular/xMkm81VkR9w
the angular won't notice the change of the model since the scope modification occurs outside the angular world, inside a event listener.
There is a way to trigger to dirty cheking by calling $scope.$apply().
But since my list as more than 200 element, this error is triggered:
Error: 10 $digest() iterations reached. Aborting!
So i'm wondering if there is another way to trigger the dirty checking ? Maybe another way to approch my issue.
EDIT:
The title was changed after reflection on the real problem
In fact the issue come from the partial, where i add filter expression in a ng-show directive
My bad

Core Data Multiple FetchedResultsController/Views: How do you update all manually?

I have two instances of the same ViewController class accessed in different tab items. Both use the same entity, but with a different predicate. One displays all the items, while the other displays a subset based on its predicate.
The problem occurs when I delete an object from the "All" list. It updates immediately, but when I switch over to the other tab, the object is still there, even after going back and forth in the views. Only after a period of time, around 5 to 10 seconds, does the deletion get reflected in the other view.
The ViewController class use a FetchedResultsController.
Any ideas what the cause is and how to get the results to immediate appear?
Just put a reloadData into viewWillAppear. You can also catch this when the tab bar's selected index changes.
Apparently, there is no solution. There is no way to update UIManagedDocument manually.
This guy came to the same conclusion:
Core Data managed object does not see related objects until restart Simulator
So the solution is to use the default master-detail template and to stop using UIManagedDocument. Wish there was some documentation on this, would have saved me a day of my life.

Resources