• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EO refresh question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EO refresh question


  • Subject: Re: EO refresh question
  • From: Pascal Robert <email@hidden>
  • Date: Wed, 14 Sep 2011 14:19:35 -0400

Using a real timestamp + ERXEOControlUtilities.refreshObject = happy man.

> For reference, see this method too:
>
> er.extensions.eof.ERXEOControlUtilities.refreshObject(EOEnterpriseObject)
>
>
> On Sep 14, 2011, at 10:51 AM, Pascal Robert wrote:
>
>> I have a question about EO refresh. I have a component where I show the list of running and completed jobs (reports) and since some jobs might be running, I want to use AjaxPing to refresh the page every 5 seconds so that users don't have to click on a link or button to refresh the page.
>>
>> The list is built with:
>>
>>   public NSArray<ReportTask> reportsForCurrentUser() {
>>     return ReportTask.fetchReportTasks(editingContext(), ReportTask.USER.eq(((Session)session()).user()), ReportTask.START_TIME.descs());
>>   }
>>
>> The editing context have a 1 second timestamp:
>>
>>   protected EOEditingContext editingContext() {
>>     if (_editingContext == null) {
>>       _editingContext = ERXEC.newEditingContext();
>>       _editingContext.setFetchTimestamp(1000);
>>     }
>>     return _editingContext;
>>   }
>>
>> And I have a method, countOfRunningJobs, that fetch the list of currently running or pending jobs. I use that method to return the number of running jobs and use it as the "cacheKey" binding for AjaxPing.
>>
>>   public int countOfRunningJobs() {
>>     EOQualifier qualifier = ReportTask.USER.eq(((Session)session()).user()).and(ReportTask.STATUS.notIn(new NSArray<ReportTaskStatus>(new ReportTaskStatus[] { ReportTaskStatus.COMPLETED, ReportTaskStatus.STOPPED } )));
>>     NSArray<ReportTask> runningTasks = ReportTask.fetchReportTasks(editingContext(), qualifier, null);
>>     for (ReportTask task: runningTasks) {
>>       editingContext().refreshObject(task);
>>       NSLog.out.appendln(task.status());
>>     }
>>     return ReportTask.fetchReportTasks(editingContext(), qualifier, null).count();
>>   }
>>
>> That logic is ok, if I print the integer in the component, the value is ok (eg, if I have a running job, count is 1, when the job is completed, count is 0). But the "task" EO is NOT updated after the refresh, even if in the database, the status was changed to "COMPLETED", the NSLog call returns "RUNNING". I do see a SELECT being done to fetch the task details, so it look it's EOF who doesn't want to refresh the object, even if the timestamp is low.
>>
>> What I'm doing wrong?
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >EO refresh question (From: Pascal Robert <email@hidden>)
 >Re: EO refresh question (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: EO refresh question
  • Next by Date: JasperReports and Cross-platform Fonts
  • Previous by thread: Re: EO refresh question
  • Next by thread: Deploy as a servlet
  • Index(es):
    • Date
    • Thread