Reputation: 22320
I have a Lotus Notes application which actually consists of a template with all the required forms, views and agents needed. It also requires some design elements (a custom form and a view for our own type of documents) from this template to be copied over to the mail template, so after the regular refresh all users have it.
The application works like this: the application database (derived from the template I provide) is created on the Domino server. An agent, running in this database, upon http request, creates a "custom" document in user's mail database.
Then, on the client side, the user can use our view to display this document.
Currently, the deployment procedure goes like this:
Now, I want to easy the admin's work, and automate the copying of the custom form and the view, and also the creation of the button to the mail template.
Any idea how I can do this from a NotesScript, JavaScript, Java?
Upvotes: 1
Views: 2319
Reputation: 42940
That sounds doable with DXL, and I think you can use both LotusScript and Java to accomplish it.
Something along the lines of this should do it in Java:
public class RenderDesign extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
DxlImporter myimporter = session.createDxlImporter();
try {
myimporter.setDesignImportOption(myimporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE);
myimporter.importDxl(this.getDxl(), agentContext.getCurrentDatabase());
}
catch (Exception e) {
System.out.println(this.getDxl());
System.out.println(myimporter.getLog());
}
} catch(Exception e) {
e.printStackTrace();
}
}
Then just construct a string with the DXL. Use Tools -> DXL Utilities -> Exporter (or Viewer) to inspect the design element you want to add or edit:
public String getDxl(String agentname, String replicaid) {
return "<?xml version='1.0' encoding='utf-8'?>"+
"<view name='(auto-view)'> "+/* ... */"</view>";
}
Note that the DXL importer is anything but robust and error-tolerant: You can make the Developer client crash on input that is valid XML and conformant with the DTD. For example, trying to set fieldhint=""
on a field. Keep this in mind while developing.
Upvotes: 1
Reputation: 1806
Try looking at these for ideas ---> http://www.openntf.org/projects/pmt.nsf/3f2929edba6ef2808625724c00585215/9fe3084cab2f38ad8625754600078af6!OpenDocument
http://www.benpoole.com/80256B44004A7C14/articles/simpledxl
To avoid some of the DXL known issues you can try to export & import in encoded binary format.
**Update
After looking at your situation a bit more closely, I think the easiest route would be to use template inheritance. So you would copy the elements from your custom template into the Mail template and make sure the elements are setup to inherit from your custom template.
Upvotes: 1