• 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: You crossed editing context boundaries...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: You crossed editing context boundaries...


  • Subject: Re: You crossed editing context boundaries...
  • From: David LeBer <email@hidden>
  • Date: Tue, 14 Oct 2008 19:39:00 -0400


On 14-Oct-08, at 7:10 PM, WebObjects wrote:


On Oct 14, 2008, at 5:34 PM, David LeBer wrote:


On 14-Oct-08, at 6:23 PM, WebObjects wrote:

aha ok.

so this is what Im doing at login component.

public WOComponent loginUser() {
Employee emp = null;
PaguinaUsuario pguNext = null;
try {

EOQualifier qual = Employee.E_MAIL.eq(eMail).and(Employee.PASSWORD.eq(password));
emp = Employee.fetchRequiredEmployee(session().defaultEditingContext(), qual);
pguNext = (PaguinaUsuario) pageWithName(PaguinaUsuario.class.getName());

// this.errorMessage = "Success";

} catch (NoSuchElementException e) {
this.errorMessage ="EMail o Contrase–a Erroneos";

}/*catch (Exception e){
//TODO
System.out.println(emp.nombre()+" y con pass "+emp.password());
}*/

((Session) session()).setNombreUsuario(emp.name());
pguNext.setEmp(emp);
return pguNext;
}


abd this is what Im doing at the "PaguinaUsuario" (UserPage) component.

	public  WOActionResults setCalendar (){
	

AjaxHighlight.highlight("turnsSummary");

String dayOfWeek;
String a[] = dateSelected.split("/");
this.calendar = Calendar.getInstance();
this.calendar.clear();
this .calendar .set (Integer .valueOf(a[0]).intValue(),Integer.valueOf(a[1]).intValue()-1,
Integer.valueOf(a[2]).intValue());
String dayNames[] = new DateFormatSymbols().getWeekdays();
dayOfWeek = dayNames[calendar.get(Calendar.DAY_OF_WEEK)];
// System.out.println("El dia de hoy es un "+dayNames[calendar.get(Calendar.DAY_OF_WEEK)]);

//Im gonna obtain all the turns of the selected day.
EOQualifier qual = WorkDay.DAY_OF_WEEK.eq(dayOfWeek);
NSArray<EOSortOrdering> order = new NSArray(new ERXSortOrdering("id",ERXSortOrdering.CompareAscending));

NSArray<WorkDay> workDays = WorkDay.fetchWorkDaies(myEC, qual, order);

//NSMutableArray<Turn> turns = new NSMutableArray<Turn>();
turns = new NSMutableArray<Turn>();
NSTimestamp ts;//ts for TimeStart
NSTimestamp te; // te for TimeEnd
for (WorkDay actualWorkDay : workDays){
for (Turn actualTurn : actualWorkDay.turns()){
ts = actualTurn.startDateTime();
te = actualTurn.endDateTime();
NSTimestampFormatter formatter = new NSTimestampFormatter(dayOfWeek+" at %H:%M:%S");
//formatter.setDefaultFormatTimeZone(new NSTimeZone().localTimeZone());
String fxST = formatter.format(ts);//fxST for fixedStartTime
String fxET = formatter.format(te);
actualTurn.setFixedStartTime(fxST);
actualTurn.setFixedEndTime(fxET);
turns.add(actualTurn);
System.out.println(actualTurn.getFixedStartTime());
System.out.println(actualTurn.getFixedEndTime());
/*System.out.println(actualTurn.startDateTime() + " " + actualTurn.idealEmployees());
System.out.println(actualTurn.endDateTime());*/
setHasSelectedDay(true);
}
}



return null;
}

So turns live in myEc, not sure where that comes from.

ouch sorry. myEC is a custom ERXEC.newEditingContext which I created in the component constructor.

So, I'm not sure what else is going on in that component, but if its primary roll is to assign Turns to a User, then there is probably little value in throwing an additional EC into the mix.




public WOComponent registerTurns() {
System.out.println("Antes de salvar "+ emp.name());
EOEditingContext editingContext = ERXEC.newEditingContext();

EOUtilities.localInstanceOfObject(editingContext, emp);
emp.addObjectsToBothSidesOfRelationshipWithKey(selectedItems(), Employee.TURNS_KEY);
//editingContext.saveChanges();
return null;
}

Try:

public WOComponent registerTurns() {
System.out.println("Antes de salvar "+ emp.name());
EOUtilities.localInstanceOfObject(myEc, emp);
emp.addObjectsToBothSidesOfRelationshipWithKey(selectedItems(), Employee.TURNS_KEY);
editingContext.saveChanges();
return null;
}

Hrm, copy and pasted too quickly:

public WOComponent registerTurns() {
System.out.println("Antes de salvar "+ emp.name());
EOUtilities.localInstanceOfObject(myEc, emp);
emp.addObjectsToBothSidesOfRelationshipWithKey(selectedItems(), Employee.TURNS_KEY);
emp.editingContext().saveChanges();
return null;
}


<snip>

;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: 	http://codeferous.com
blog: 	http://davidleber.net
profile:	http://www.linkedin.com/in/davidleber
twitter:	http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org




_______________________________________________ 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: 
 >You crossed editing context boundaries... (From: WebObjects <email@hidden>)
 >Re: You crossed editing context boundaries... (From: Clark Mueller <email@hidden>)
 >Re: You crossed editing context boundaries... (From: WebObjects <email@hidden>)
 >Re: You crossed editing context boundaries... (From: Clark Mueller <email@hidden>)
 >Re: You crossed editing context boundaries... (From: WebObjects <email@hidden>)
 >Re: You crossed editing context boundaries... (From: David LeBer <email@hidden>)
 >Re: You crossed editing context boundaries... (From: WebObjects <email@hidden>)

  • Prev by Date: Re: You crossed editing context boundaries...
  • Next by Date: Re: You crossed editing context boundaries...
  • Previous by thread: Re: You crossed editing context boundaries...
  • Next by thread: Re: You crossed editing context boundaries...
  • Index(es):
    • Date
    • Thread