Update: Workaround
I got a feature request for my XPages API Inspector. When running the inspector on an XPage in the Notes Client:
Exception:ECL Permission Denied (java.lang.RuntimePermission accessDeclaredMembers)
I think it has something to do with accessing declared members of a class. Have any of you encountered this, and if so, is there a way to work around it in code, or is this something that you have to do on the client/server?
9 comments:
I'm no XPages expert, but have you checked the XPages Wiki? They mention a lot about permissions and Java:
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPages_in_the_Notes_Client-Security
Thanks for the link. It looks like it might be out of my hands, and in the hand of the user/developer.
It's probably the security manager kicking in...
This looks like a good place to ask...
Using the inspector, I discovered that I can access all data sources on the current page using...
getView().getData()
This returns an ArrayList containing the data sources.
This works fine in my sandbox, but when I try to use it in a different database, it always returns an empty list.
Any idea why it behaves differently in one db than another?
Are you using the last/same version in the sandbox/the other applications?
It works fine for me on multiple apps (running in Firefox).
After more digging, I've found the problem (but not the solution). It does not have anything to do with which database the page resides in. I am using a layoutContent in an xPage, and my data sources are defined in a custom control that is embedded as a facet in the layoutContent.
Since getView always returns the first view in the page, I can only access the data sources that are defined directly in the main xPage. I've been trying to walk the children of the root view to determine if I can enumerate all views and data sources regardless of where they are defined, but it's been going slow.
I've looked at UIViewRootEx2.getChildren(), UIViewRootEx2.getFacets(), and several other methods but they don't seem to lead anywhere. Do you know of a way to enumerate all views on the page? I think that's all I need to get going.
If you add an id to the custom control/the data source belongs to the custom control, you should be able to do something like this:
getComponent( 'idOfCustomControl' ).getData()
Wonderful! Works like a charm. I had actually gotten as far as the UIIncludeComposite objects, but had not tried calling getData on them yet. I should be able to create a generic getDataSourceByName method now.
Thanks again!!
No problem :)
Post a Comment