• 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 18:34:03 -0400


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.



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;
}




I know this last part above its completely wrong, because is the one giving me trouble.

and the turns which are displayed are like this :

<webobject name = "Condition">

<wo:WOForm name = "turnsForm" id = "turnsForm" action = "$registerTurns">

<div id = "mainContentTunrs">
<wo:AjaxUpdateContainer id = "turnsSummary">

<span> <wo:WOString value = "Turns for the selected Day:"/> </ span>
<br />
<br />
<webobject name = "SelectCheck">
<webobject name = "Start" /> TO <webobject name = "End" />
</webobject>
<wo:AjaxHighlight id = "turnsSummary" value = "turnsSummary" effect="Effect.BlindDown" scaleMode = "contents" duration = "1.0" />
</wo:AjaxUpdateContainer>
<br />

</div>

<div class = "niftyAppt" style = "float:right"> <span onClick="submitTurns();" onMouseOver="cursor_pointer();" onMouseOut="cursor_default();">
Submit
</span>
</div>
</wo:WOForm>
</webobject>


SelectCheck : WOCheckboxMatrix {

  list = turns;
  item = turno;
  selections = selectedItems;

}

Im just selecting the turns and then  submitting.

I hope with this you can help me out.... its even funny the error, like "hey you idi....t you cross the boudaries!!!! "" hehehe


Gus


On Oct 14, 2008, at 5:10 PM, Clark Mueller wrote:

Gus,

Sorry, I think I skimmed over your original e-mail a bit quickly. Can you provide a more complete code listing?

Clark

On Oct 14, 2008, at 2:34 PM, WebObjects wrote:


On Oct 14, 2008, at 4:13 PM, Clark Mueller wrote:

You need to get a local copy of the object in the editing context where you are trying to make the relationship. Have a look at EOUtilities.localInstanceOfObject(ec, object).

So even if I sent the EO from one component to another I should get a local copy of it?
I have
EOEditingContext editingContext = ERXEC.newEditingContext();


I checked the EOUtilities.localInstanceOfObject(editingContext, emp);
I used also the ERXUtilities.localInstanceOfObject(editingContext, emp);
and then tried again
emp.addObjectsToBothSidesOfRelationshipWithKey(selectedItems(), Employee.TURNS_KEY);
and still Im getting the same error, what Im doing wrong?



Gus




Clark

On Oct 14, 2008, at 2:09 PM, WebObjects wrote:

Hello, Im trying to use this method :

addObjectsToBothSidesOfRelationshipWithKey(NSArray obj1, String arg1)

or something like that.

What I have is my Employee and the turns that tis particular Employee selected. I dunno if I should use the method above or the other one with the same name, but with other arguments, (EORleationShipManipulation eo, String arg1).
Anyway, I tried both but I get this error
Error:
java.lang.RuntimeException: You crossed editing context boundaries attempting to set the 'turns' relationship of (in EC er.extensions.eof.ERXEC@15e6f8) to (in EC er.extensions.eof.ERXEC@905335).
Reason:
You crossed editing context boundaries attempting to set the 'turns' relationship of <controlHorarios.app.eo.Employee pk:"1"> (in EC er.extensions.eof.ERXEC@15e6f8) to <controlHorarios.app.eo.Turn pk:"1"> (in EC er.extensions.eof.ERXEC@905335).


I guess Im trying to add to emp the turns which are in different EC, no? what can I do?

The emp I fetch it using a custom EC ERXC.newEditingContext, and this emp, I sent it to the other component where I can select the desired turns. (if this info helps)

regards
Gus

_______________________________________________
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

;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
  • Follow-Ups:
    • Re: You crossed editing context boundaries...
      • From: WebObjects <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>)

  • 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