Search This Blog

Thursday, March 24, 2016

How to get a list of components for not open Xpage ?

Hi guys.

Need a clue from people smarter than me :-)

The task is simple.
I am working on configurable fields validation functionality.
I want to provide application administrator with Web GUI where he/she can:

  1. choose database
  2. choose Xpage from selected database
  3. choose field from selected Xpage ( <-- Here is a problem )
  4. define validation rules for selected field
It can look like this, for example:


Surfing on Internet I found solutions how to
  • get a list of Xpages in database. The idea is the same as for other Notes design elements, through NotesNoteCollection. See this link for example.
  • get a list of components from currently open XPage. The idea is to go through component tree from parent view to the bottom through all children. See this link for example.
However in my case I need to get a components list for not open Xpage, so I don't have everything needed for using example above.

I was thinking about exporting Xpage to dxl, then decoding its content from Base64 but though I could see more or less normal Xpage source I am not sure if it's worth to deal with. See some screen shots

dxl of Xpage



Then I used this online tool for decoding from Base64 and received this that looks good and probably it can give me what I need but I am not sure if I want to dive into this...



Of course I could introduce additional thing where I could describe meta data for all my Xpages (in JSON or in XML format) and fetch components list from there but I don't want to do any additional manual work, I don't want to remember that each time when I create new Xpage or add a new control on existing Xpage I have to update something else to keep solution in consistence. I could accept if meta data was generated automatically but I really want to avoid additional manual work. 

So my question to you is - do you have any good or even insane idea how can I get a list of component for not open XPage without doing additional manual work? 



2 comments:

  1. My first try would be to go to the generated java class for the respective XPage and to find out if I can use reflection to get hold of defined components through there.

    ReplyDelete