Re: PrimaryKey generation takes a lot of time

2014-05-07 Thread Tobias Janz
Hi all,

First i've tryed to set the size of primaryKeys fetched per statement in
_FrontBasePlugin to 500. I've gained abound 5%.
Next i've tryed to use ERXJDBCAdopter with batchsize 1000, but got no
benefit. Then I tryed connectionpooling, but ended with a lot of
exceptions, because the initialisation of Connections got broken. I
switched to ObjectStoreCoordinator and the performance got worse.

Multithreading did also slow down the application (With 2 Threads i got a
better performance by about 3-5%, but with more threads the performance
slows down by 5% with 10 Threads and 15% with 20 Threads).

My solution:
1. Return the hole multithreading, ObjectStoreCoordinator.
2. Configure Testinstance on Productionsystem only to import the data.
Database near Applikation got me to speed up. the 5 hours import is done in
5min.

Its not the best for me, but with the latency and slow connection issues
it's the best i can get.

Thanks for all your hints.

regards
Tobias


2014-05-06 10:40 GMT+02:00 Patrick Middleton patr...@onestep.co.uk:

 We encountered this recently against MySQL 5.6.12.
 (Not using Project Wonder)
 The default primary key generation was invoking a stored procedure once
 per row.  Once per second, some sort of garbage collection would occur
 inside the RDBMS and the stored procedure would take about 0.2s to complete
 instead of about 0.005s.

 The fix is to create and cache all your new primary keys at once in
 advance using something like
 er.extensions.jdbc.ERXJDBCAdaptor.Channel.primaryKeysForNewRowsWithEntity(int
 cnt, com.webobjects.eoaccess.EOEntity entity)

 then use something like
 databaseContextNewPrimaryKey(EODatabaseContext dbCtxt, Object object,
 EOEntity entity)
 http://wocommunity.org/documents/javadoc/WebObjects/
 5.4.2/com/webobjects/eoaccess/EODatabaseContext.Delegate.
 html?is-external=true

 to fetch a candidate new key from your cache rather than make a database
 round-trip to make one.


 On 6 May 2014, at 08:20, Tobias Janz wrote:

  I forgott to replay to the list.

 the database is close to the server. I did not find the way to copy the
 Database from Mac OS Frontbase to CentOS Frontbase or the other way. I
 tryed to recover me lokal Database with a Backup created with
 CentOS-Frontbase, but it fails.

 So I think the best way for me will be the WRITE ALL export.

 I will take a look at this.

 Thanks

 Tobias


 2014-05-06 7:58 GMT+02:00 Chuck Hill ch...@global-village.net:
  Hi Tobias,

 I missed the Frontbase in the cloud on centOS” before.  Is the app
 server not “close” to the database server?  With latency like this, you are
 going to face production issues, too.  That would be my first concern.

 Some ideas to consider:
 Import it locally, do a  WRITE ALL export and import on the server
 Change to the binary UUID primary keys that are generated in the
 application
 ERXLongPrimaryKeyFactory
 Chuck


 On 2014-05-05, 10:28 PM, Tobias Janz wrote:

 Hi Chuck,

 thanks for your advice, but this approch i have allready tryed. I create
 a new editing context for each 100. Also i've tryed multiple threads with
 relevant success.

 When i do the import on my lokal database its much much faster. I think
 it's because of the latency. Is there a way to savely create primary key
 with multiple DB-connections in multiple Threads? And how do i get multiple
 database connections?

 regards Tobias


 2014-05-06 1:32 GMT+02:00 Chuck Hill ch...@global-village.net:
 Are you creating the objects and saving them all at once?  If so, that is
 your problem.  Save them in batches of 500 or 1000 and it will go much
 quicker.  You might want to try making a new editing context for each batch.


 Chuck


 On 2014-05-05, 4:29 PM, Tobias Janz wrote:

 Hi all,

 i need to import a csv-file with about 58.000 Lines und 60 Columns. I
 have 8 Entitys where the values will be stored. The conversion of a line to
 entitys takes almost no time. But the full prozess, from conversion until
 saveChanges is done, takes several hours (5-6h). After profiling it points
 me to the generating of primary keys. This part uses half of the time.

 I need to do the import several times.
 Do you see a way to improve the speed?
 I'm using WebObject 5.4.3 (with Wonder). My Development is on Mac.
 Database is a Frontbase in the cloud on centOS.

 Thanks for any advice.

 Tobias


  ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-
 dev/patrick%40onestep.co.uk

 This email sent to patr...@onestep.co.uk



 This email, including any attachments, is confidential and intended solely
 for the person or organisation to whom it is addressed. If you are not the
 intended recipient you must not disseminate, distribute or copy any partof
 this email nor take any action in reliance on it.

 If you have received 

AjaxGrid single row select

2014-05-07 Thread Dipl.-Ing. Jens Lünstedt
Hello,
for my AjaxGrid I have two questions. (I'm not very familiar with JavaScript)
How to define a single row selection? (At the moment I can select and deselect 
multiple rows).
How can I react on the selection and deselection event in my Java Class? The 
setSelectedObjects method is not called.

I can't find a description / example in the web.

Thanks
Jens


signature.asc
Description: Message signed with OpenPGP using GPGMail
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

AjaxGrid single row select UPDATE

2014-05-07 Thread Dipl . -Ing . Jens Lünstedt
Hello,
for my AjaxGrid I have two questions. (I'm not very familiar with JavaScript)
How to define a single row selection? (At the moment I can select and deselect 
multiple rows).
How can I react on the selection and deselection event in my Java Class? The 
setSelectedObjects method is not called.

I can't find a description / example in the web.

Thanks
Jens

UPDATE: I found a solution in checking the change of selectedObjects in public 
WODisplayGroup displayGroup()
I don't know if that is a good solution but it works.


signature.asc
Description: Message signed with OpenPGP using GPGMail
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: ERXKeyFilter.setAnonymousUpdateEnabled(Z)V on remote server

2014-05-07 Thread Fred Opims
Hi !
I succeed to run some request on the application deployed on the server.
That means that the server can received ERRest request.

But for request involving  ERXKeyFilter, i have the same error message:

The request i’m sending is like this one:
http://somesite.ca/cgi-bin/WebObjects/SomeServer.woa/ra/highlight.json
POST
{
title: “TEST_3,
kind: 1,
length: 18s,
path: “some_url.m4v,
thumbnailPath: “some.png,
detail: “SOME DETAIL
  }




*Here is the response*:

er.extensions.eof.ERXKeyFilter.setAnonymousUpdateEnabled(Z)V.

 ERROR er.rest.routes.ERXRouteController - Request failed:
/cgi-bin/WebObjects/SomeServer.woa/1/ra/highlight.json NoSuchMethodError:
er.extensions.eof.ERXKeyFilter.setAnonymousUpdateEnabled(Z)V at
abc.app.rest.controllers.HighlightController.filter(HighlightController.java:68)
at
abc.app.rest.controllers.HighlightController.createAction(HighlightController.java:52)
... skipped 4 stack elements at
er.rest.routes.ERXRouteController.performActionNamed(ERXRouteController.java:1372)
at
er.rest.routes.ERXRouteController.performActionNamed(ERXRouteController.java:1238)
... skipped 8 stack elements


Any ideas?

Thank you


On Tue, May 6, 2014 at 10:18 AM, Fred Opims ropims...@gmail.com wrote:

 ERRest.jar is on JavaMonitor.woa, wotaskd.woa and the  App.

 Here is the content of the Frameworks directory from the App

 ERExtensions.framework
 ERJars.framework
 ERPrototypes.framework
 ERRest.framework
 H2PlugIn.framework
 JavaEOAccess.framework
 JavaEOControl.framework
 JavaFoundation.framework
 JavaJDBCAdaptor.framework
 JavaWebObjects.framework
 JavaWOExtensions.framework
 JavaXML.framework
 PostgresqlPlugIn.framework
 WOOgnl.framework


 I used Ant to make my build and i followed this link to install Wonder on
 the server.
 http://wiki.wocommunity.org/display/documentation/Deploying+on+Linux

 Thank you


 On Tue, May 6, 2014 at 9:57 AM, Pascal Robert prob...@macti.ca wrote:

 Do you have the ERRest.jar file elsewhere on the server? You can use the
 « find » command to find if it's the case (find / -name 'ERRest.jar' -ls)

 And are you building Wonder or did you download the frameworks from
 somewhere?

 - Mail original -
 De: Fred Opims ropims...@gmail.com
 À: Pascal Robert prob...@macti.ca
 Cc: WebObjects Development Webobjects-dev@lists.apple.com
 Envoyé: Mardi 6 Mai 2014 09:54:18
 Objet: Re: ERXKeyFilter.setAnonymousUpdateEnabled(Z)V on remote server

 Hi Pascal!

 I confirm that the ERRest framework is in the Application's Frameworks
 directory,

 Here is the content of Contents/Unix:

 # JVM == java
 # JVMOptions ==
 # JDB == jdb
 # JDBOptions ==
 # ApplicationClass == bsc.app.Application

 APPROOT/Resources/Java/
 APPROOT/Resources/Java/bscserver.jar

 APPROOT/Frameworks/ERJars.framework/Resources/Java/ERJars.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/ERFoundation.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/ERWebObjects.jar

 APPROOT/Frameworks/ERJars.framework/Resources/Java/commons-lang-2.5-sources.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/commons-lang-2.5.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/erxservletadaptor.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/icu4j-3_8_1.jar

 APPROOT/Frameworks/ERJars.framework/Resources/Java/joda-time-1.6.2-sources.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/joda-time-1.6.2.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/junit-4.8.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/log4j-1.2.16.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/ognl-2.6.7.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/slf4j-api-1.5.0.jar
 APPROOT/Frameworks/ERJars.framework/Resources/Java/slf4j-log4j12-1.5.0.jar
 APPROOT/Frameworks/ERPrototypes.framework/Resources/Java/ERPrototypes.jar

 APPROOT/Frameworks/JavaWOExtensions.framework/Resources/Java/JavaWOExtensions.jar
 APPROOT/Frameworks/WOOgnl.framework/Resources/Java/WOOgnl.jar
 APPROOT/Frameworks/WOOgnl.framework/Resources/Java/WOOgnl53.jar
 APPROOT/Frameworks/WOOgnl.framework/Resources/Java/WOOgnl54.jar
 APPROOT/Frameworks/ERRest.framework/Resources/Java/ERRest.jar

 APPROOT/Frameworks/ERRest.framework/Resources/Java/commons-beanutils-1.7.0.jar

 APPROOT/Frameworks/ERRest.framework/Resources/Java/commons-collections-3.2.1.jar
 APPROOT/Frameworks/ERRest.framework/Resources/Java/commons-lang-2.4.jar

 APPROOT/Frameworks/ERRest.framework/Resources/Java/commons-logging-1.1.1.jar
 APPROOT/Frameworks/ERRest.framework/Resources/Java/ezmorph-1.0.6.jar
 APPROOT/Frameworks/ERRest.framework/Resources/Java/json-lib-2.3-jdk15.jar
 APPROOT/Frameworks/H2PlugIn.framework/Resources/Java/H2PlugIn.jar
 APPROOT/Frameworks/H2PlugIn.framework/Resources/Java/h2-1.3.151.jar
 APPROOT/Frameworks/ERExtensions.framework/Resources/Java/ERExtensions.jar

 APPROOT/Frameworks/PostgresqlPlugIn.framework/Resources/Java/PostgresqlPlugIn.jar
 APPROOT/Frameworks/JavaEOAccess.framework/Resources/Java/javaeoaccess.jar

Re: AjaxGrid single row select UPDATE

2014-05-07 Thread Chuck Hill
Hi Jens,

On 2014-05-07, 1:59 AM, Dipl.-Ing. Jens Lünstedt wrote:

Hello,
for my AjaxGrid I have two questions. (I'm not very familiar with JavaScript)
How to define a single row selection? (At the moment I can select and deselect 
multiple rows).

You mean that you want to prevent the user from selecting more than one row?  
It does not support that.  You probably could in JavaScript, but this is 
probably the wrong UI for what you are doing.


How can I react on the selection and deselection event in my Java Class? The 
setSelectedObjects method is not called.

You can’t directly, AjaxGrid does that.

I think what you want is to have a link or button in each row that does 
something when activated.  Otherwise you are trying to bend AjaxGrid to do 
something it was not intended for.  Neither you nor your users are likely to be 
happy.

First you need a grid configuration like this:

 *{

 *title =  quot;Actionsquot;;

 *keyPath = quot;quot;;   // Missing or 
empty keypath results in the current object itself being passed to component

 *component = quot;EmployeeActionsquot;;  // Name of 
WOComponent to be displayed in this column.  Gets passed two bindings: value 
(Object),

 *  // and grid 
(AjaxGrid) so that any other needed data can be accessed

 *cssClass = quot;alignCenterquot;;

 *}

Then in the component some simple HTML like:

span style=float:middleWEBOBJECT NAME=Remove//span

Then use a regular link or an Ajax one, depending on what you want to happen:

Remove: WOHyperlink {

action = remove;

string = Remove;

}

And implement the action method to do what you want.


Chuck




I can't find a description / example in the web.

Thanks
Jens

UPDATE: I found a solution in checking the change of selectedObjects in public 
WODisplayGroup displayGroup()
I don't know if that is a good solution but it works.
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: AjaxGrid single row select UPDATE

2014-05-07 Thread Timothy Worman
Jens:

I’ve implement a SingleSelectionAjaxGrid that extends AjaxGrid. Actually, it’s 
twice removed. :-) Anyway, I don’t think there’s any major changes in the 
parent class. There’s a class variable for selectedObject and the following 
override below ’toggleSelectionOfRow.’ The component has a api binding for 
selectedObject.

/**
* Toggles inclusion of row into selectedObjects() (i.e. selects and
* de-selects it). This component can only have one selected row.
*/
public WOActionResults toggleSelectionOfRow() {
//row was already selected
boolean _rowWasPreviouslySelected = (selectedObjects() != null  
selectedObjects().contains(row())); 
selectedObjects().removeAllObjects();
if (! _rowWasPreviouslySelected) {
setSelectedObject(row());
selectedObjects().addObject(row());
} else {
setSelectedObject(null);
}
return null;
}

Also, in the wod, the tr for the row repetition has been updated as below. This 
allows you to click anywhere in the tr to select.

TableRowAndToggler: AjaxUpdateLink {
action = toggleSelectionOfRow;
updateContainerID = configurationData.updateContainerID; // VALID
id = toggleRowSelectionID;
elementName = tr;
class = rowClass;
style = rowStyle;
}

Hopefully, this helps you out.

Tim
UCLA GSEIS


On May 7, 2014, at 9:15 AM, Chuck Hill ch...@global-village.net wrote:

 Hi Jens,
 
 On 2014-05-07, 1:59 AM, Dipl.-Ing. Jens Lünstedt wrote:
 
 Hello,
 for my AjaxGrid I have two questions. (I'm not very familiar with JavaScript)
 How to define a single row selection? (At the moment I can select and 
 deselect multiple rows).
 
 You mean that you want to prevent the user from selecting more than one row?  
 It does not support that.  You probably could in JavaScript, but this is 
 probably the wrong UI for what you are doing.
 
 
 How can I react on the selection and deselection event in my Java Class? The 
 setSelectedObjects method is not called.
 
 You can’t directly, AjaxGrid does that.  
 
 I think what you want is to have a link or button in each row that does 
 something when activated.  Otherwise you are trying to bend AjaxGrid to do 
 something it was not intended for.  Neither you nor your users are likely to 
 be happy.
 
 First you need a grid configuration like this:
  *{
  *title =  quot;Actionsquot;;
  *keyPath = quot;quot;;   // Missing or 
 empty keypath results in the current object itself being passed to component
  *component = quot;EmployeeActionsquot;;  // Name of 
 WOComponent to be displayed in this column.  Gets passed two bindings: value 
 (Object), 
  *  // and grid 
 (AjaxGrid) so that any other needed data can be accessed
  *cssClass = quot;alignCenterquot;;
  *}
 
 Then in the component some simple HTML like:
 span style=float:middleWEBOBJECT NAME=Remove//span
 
 Then use a regular link or an Ajax one, depending on what you want to happen:
 Remove: WOHyperlink {
 action = remove;
 string = Remove;
 }
 
 And implement the action method to do what you want.
 
 
 Chuck
 
 
 
 
 I can't find a description / example in the web.
 
 Thanks
 Jens
 
 UPDATE: I found a solution in checking the change of selectedObjects in 
 public WODisplayGroup displayGroup()
 I don't know if that is a good solution but it works.
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/lists%40thetimmy.com
 
 This email sent to li...@thetimmy.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

ERPDFGeneration problem

2014-05-07 Thread Timothy Worman
All:

I have a problem that recently popped up with PDF generation. I have a custom 
component that utilizes the simple FlyingSaucerImpl in ERPDFGeneration. My 
component was failing with:

[org.xml.sax.SAXParseException] The markup in the document preceding the root 
element must be well-formed.

So, I simplified things and basically made a test component content sth like 
SimplePDFGeneration1 from the ERPDFExamples. Same issue - SAXParseException. I 
overrode appendToResponse to generate some diagnostics on the content I’m 
trying pdf-ify (is that allowed?). Below is what it sayeth. So, what the heck 
is in line 0, column 2 in the document?

May 07 19:20:21 eTimesheet[5] WARN  NSLog  - 
'edu.ucla.gseis.employee.components.TimesheetCalendarPDFComponent' caused a 
SAXParseException
Message: 'The markup in the document preceding the root element must be 
well-formed.'
Line   : 0
Column : 2
--- content begin ---
1 !DOCTYPE html
2 html  _componentName = 
edu.ucla.gseis.employee.components.TimesheetCalendarPDFComponent lang = en
3   head
4 meta charset = utf-8 /
5 titleERPDFGeneration Examples/title
6 
7 link rel=stylesheet type=text/css 
href=/cgi-bin/WebObjects/eTimesheet.woa/_wr_/wodata=/Users/worman/Source/etswo/eTimesheet/WebServerResources/print.css
 media=print/
8 
9   /head
10   body
11  
12   /body
13 /html
--- content end —

Tim
UCLA GSEIS


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Wonder build issue?

2014-05-07 Thread Timothy Worman
All:

After running this:

ant clean frameworks; sudo ant frameworks.install

I get the following errors:

BUILD FAILED
/Users/worman/Source/wonder/build.xml:18: The following error occurred while 
executing this line:
/Users/worman/Source/wonder/Build/build/build.xml:1509: The following error 
occurred while executing this line:
/Users/worman/Source/wonder/Build/build/build.xml:1500: The following error 
occurred while executing this line:
/Users/worman/Source/wonder/Build/build/build.xml:58: The following error 
occurred while executing this line:
/Users/worman/Source/wonder/Build/build/generic.xml:526: 
/var/root/Roots/ERJars.framework does not exist.

It appears `ant clean frameworks` is successful - build to ~/Roots looks 
normal. It seems to be failing because it is looking in the root user’s home 
for ERJars.framework. This looks good:

global.framework.build:
[mkdir] Created dir: /Users/worman/Roots/ERJars.framework

global.dummy:
[woframework] Installing ERJars in /Users/worman/Roots
  [jar] Building jar: /Users/worman/Roots/ERJars-6.0.jar

global.dummy:
 [echo] -
 [echo] ERJars.framework done
 [echo] -

Possibly the `sudo  ` is causing something to interpret ‘home' as root’s 
home instead of the my home? This has never happened before and I’d love to 
know if I’ve suffered a self-inflicted wound. Otherwise, I’d love to fix this 
up - or know what the fix-up is!

If I do `sudo ls ~` my user home is returned, not /var/root so I’m pretty sure 
it isn’t an issue with my environment.

Tim ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: ERPDFGeneration problem

2014-05-07 Thread Matt Ness
Hi Tim,

Perhaps you need to specify a DTD?

http://www.w3.org/QA/Tips/Doctype
http://www.w3.org/QA/2002/04/valid-dtd-list.html


Regards,

Matt
--
http://logicsquad.net



On 08/05/2014, at 12:33 PM, Timothy Worman li...@thetimmy.com wrote:

 All:
 
 I have a problem that recently popped up with PDF generation. I have a custom 
 component that utilizes the simple FlyingSaucerImpl in ERPDFGeneration. My 
 component was failing with:
 
 [org.xml.sax.SAXParseException] The markup in the document preceding the 
 root element must be well-formed.
 
 So, I simplified things and basically made a test component content sth like 
 SimplePDFGeneration1 from the ERPDFExamples. Same issue - SAXParseException. 
 I overrode appendToResponse to generate some diagnostics on the content I’m 
 trying pdf-ify (is that allowed?). Below is what it sayeth. So, what the heck 
 is in line 0, column 2 in the document?
 
 May 07 19:20:21 eTimesheet[5] WARN  NSLog  - 
 'edu.ucla.gseis.employee.components.TimesheetCalendarPDFComponent' caused a 
 SAXParseException
 Message: 'The markup in the document preceding the root element must be 
 well-formed.'
 Line   : 0
 Column : 2
 --- content begin ---
 1 !DOCTYPE html
 2 html  _componentName = 
 edu.ucla.gseis.employee.components.TimesheetCalendarPDFComponent lang = 
 en
 3   head
 4 meta charset = utf-8 /
 5 titleERPDFGeneration Examples/title
 6 
 7 link rel=stylesheet type=text/css 
 href=/cgi-bin/WebObjects/eTimesheet.woa/_wr_/wodata=/Users/worman/Source/etswo/eTimesheet/WebServerResources/print.css
  media=print/
 8 
 9   /head
 10   body
 11
 12   /body
 13 /html
 --- content end —
 
 Tim
 UCLA GSEIS
 
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/matt%40logicsquad.net
 
 This email sent to m...@logicsquad.net

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

permanentGlobalID not permanent

2014-05-07 Thread Jean-François Veillette
PrimaryKey obtained by permanentGlobalID() are not saved as the primaryKey on 
saveChanges().

I'm setting a global id as a reference for « soft relationship » (since it 
point to undefined object) instead of a « hard relationship » (usual when we 
store the pk).

The problem is that I get 2 primary key (yes 2 sequences number out of the 
database):
- the first come from the call to permanentGlobalID(), wich return 7985.
- the next come from the save of the object itself, it ask again for a sequence.
Result: the first reference is actually not pointing to the saved object!


Here is the code for the setter:

public void setReference(final ERXGenericRecord ref) {
EOKeyGlobalID pgid = ref.permanentGlobalID();
setReferenceGlobalID(ERXKeyGlobalID.globalIDForGID(pgid));
// added log to debug ...
final EOGlobalID gid = editingContext().globalIDForObject(ref);
log.debug(GlobalID:  + gid + permanent:  + pgid);
}

give: 
GlobalID: EOTemporaryGlobalID: 0 0 127 0 0 1 0 0 -5 -116 1 0 0 0 1 69 -39 18 
-94 -76 -125 18 82 -3permanent: _EOIntegralKeyGlobalID[AGA_Participant 
(java.lang.Integer)7985]

It's a wonder project, all EOs (ultimately) inherit from ERXGenericRecord.
I'm using ERXEC default factory to get editingContext.

From the documentation it says it is supposed to work, so I guess I have 
something misconfigured.

But from debuging the code it doesn't look at all like it's supossed to work!
When deep inside the saveChanges(),  it simply call toBeSavedEO.__globalID() 
which still return the temporaryGlobalID instead of the permanent one.
To illustrate here is a patch that make it work:
$ git diff Sources/
diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java 
b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java
index fde6607..99fe0c0 100644
--- a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java
+++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java
@@ -931,6 +931,12 @@ public class ERXEC extends EOEditingContext {
   public EOGlobalID globalIDForObject(EOEnterpriseObject 
eoenterpriseobject) {
   boolean wasAutoLocked = autoLock(globalIDForObject);
   try {
+   if (eoenterpriseobject instanceof ERXGenericRecord) {
+   ERXGenericRecord ereo = 
(ERXGenericRecord)eoenterpriseobject;
+   if (ereo._permanentGlobalID != null) {
+   return ereo._permanentGlobalID;
+   }
+   }
   return super.globalIDForObject(eoenterpriseobject);
   }
   finally {
diff --git 
a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXGenericRecord.java 
b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXGenericRecord.java
index 8c11ada..da21610 100644
--- 
a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXGenericRecord.java
+++ 
b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXGenericRecord.java
@@ -904,8 +904,8 @@ public class ERXGenericRecord extends EOGenericRecord 
implements ERXGuardedObjec
   }
   return freshObject;
   }
-   
-   private EOKeyGlobalID _permanentGlobalID;
+
+   EOKeyGlobalID _permanentGlobalID;

   /**
* This method allows you to compute what the permanent EOGlobalID will 
be




What am I missing??? (presuming it's a configuration issue and not a bug)

Thanks,

--
jfv

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: AjaxGrid single row select UPDATE

2014-05-07 Thread Dipl.-Ing. Jens Lünstedt
Hi Tim and Chuck,
thanks for your mails. I use Timothy solution. It is much better than mine.

Jens


Am 08.05.2014 um 04:13 schrieb Timothy Worman li...@thetimmy.com:

 Jens:
 
 I’ve implement a SingleSelectionAjaxGrid that extends AjaxGrid. Actually, 
 it’s twice removed. :-) Anyway, I don’t think there’s any major changes in 
 the parent class. There’s a class variable for selectedObject and the 
 following override below ’toggleSelectionOfRow.’ The component has a api 
 binding for selectedObject.
 
 /**
 * Toggles inclusion of row into selectedObjects() (i.e. selects and
 * de-selects it). This component can only have one selected row.
 */
 public WOActionResults toggleSelectionOfRow() {
   //row was already selected
   boolean _rowWasPreviouslySelected = (selectedObjects() != null  
 selectedObjects().contains(row())); 
   selectedObjects().removeAllObjects();
   if (! _rowWasPreviouslySelected) {
   setSelectedObject(row());
   selectedObjects().addObject(row());
   } else {
   setSelectedObject(null);
   }
   return null;
 }
 
 Also, in the wod, the tr for the row repetition has been updated as below. 
 This allows you to click anywhere in the tr to select.
 
 TableRowAndToggler: AjaxUpdateLink {
   action = toggleSelectionOfRow;
   updateContainerID = configurationData.updateContainerID; // VALID
   id = toggleRowSelectionID;
   elementName = tr;
   class = rowClass;
   style = rowStyle;
 }
 
 Hopefully, this helps you out.
 
 Tim
 UCLA GSEIS
 
 
 On May 7, 2014, at 9:15 AM, Chuck Hill ch...@global-village.net wrote:
 
 Hi Jens,
 
 On 2014-05-07, 1:59 AM, Dipl.-Ing. Jens Lünstedt wrote:
 
 Hello,
 for my AjaxGrid I have two questions. (I'm not very familiar with JavaScript)
 How to define a single row selection? (At the moment I can select and 
 deselect multiple rows).
 
 You mean that you want to prevent the user from selecting more than one row? 
  It does not support that.  You probably could in JavaScript, but this is 
 probably the wrong UI for what you are doing.
 
 
 How can I react on the selection and deselection event in my Java Class? The 
 setSelectedObjects method is not called.
 
 You can’t directly, AjaxGrid does that.  
 
 I think what you want is to have a link or button in each row that does 
 something when activated.  Otherwise you are trying to bend AjaxGrid to do 
 something it was not intended for.  Neither you nor your users are likely to 
 be happy.
 
 First you need a grid configuration like this:
  *{
  *title =  quot;Actionsquot;;
  *keyPath = quot;quot;;   // Missing 
 or empty keypath results in the current object itself being passed to 
 component
  *component = quot;EmployeeActionsquot;;  // Name of 
 WOComponent to be displayed in this column.  Gets passed two bindings: value 
 (Object), 
  *  // and grid 
 (AjaxGrid) so that any other needed data can be accessed
  *cssClass = quot;alignCenterquot;;
  *}
 
 Then in the component some simple HTML like:
 span style=float:middleWEBOBJECT NAME=Remove//span
 
 Then use a regular link or an Ajax one, depending on what you want to happen:
 Remove: WOHyperlink {
 action = remove;
 string = Remove;
 }
 
 And implement the action method to do what you want.
 
 
 Chuck
 
 
 
 
 I can't find a description / example in the web.
 
 Thanks
 Jens
 
 UPDATE: I found a solution in checking the change of selectedObjects in 
 public WODisplayGroup displayGroup()
 I don't know if that is a good solution but it works.
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/lists%40thetimmy.com
 
 This email sent to li...@thetimmy.com
 



signature.asc
Description: Message signed with OpenPGP using GPGMail
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com