This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Nov 28, 2011, 4:36 PM
6 Posts

create author and reader fields

  • Category: Server Side JavaScript
  • Platform: Not Applicable
  • Release: 8.5.3
  • Role: Developer
  • Tags: Control Document Access
  • Replies: 2
Hello everyone,
 
I want to control document access in a database which uses XPages. For that reason I need to create reader and authors fields.
 
I thought the trick is to access the Item and setReaders or setAuthors. But I can't get an Item of an NotesXspDocument or com.ibm.xsp.model.wrapped.DominoDocument because the only way to create a new item is replaceItemValue which is a void. So I get the wrapped Document and work with lotus.domino.Document. There I get an Item with replaceItemValue and can set it to Readers or Authors. In different szenarios this works fine.
But now I want to set items in the beforePageLoad event. If I set this items with lotus.domino.Document nothing happens. It seems like the changes in the lotus.domino.Document are not reflected to the NotesXspDocment. But there is no refresh function ;). If I set items with the NotesXspDocument everything is fine.
 
This example simply does nothing. The value is not saved:
<xp:this.beforePageLoad><![CDATA[#{javascript:
try {   
var itm:NotesItem = currentDocument.getDocument(true).replaceItemValue("itwuwfProcessAuthors",null)
itm.setValueString("CN=Stephan Schramm/O=ITworks/C=DE")
itm.setSummary(true)
itm.setReaders(true)

} catch(e) {
    printMsg(e.toString() + "\n" + @ReplaceSubstring(e.getStackTrace().toString(),",","\n"))
}
}]]></xp:this.beforePageLoad>
 
 
This example works. But I can't set the type to Authors or Readers:
<xp:this.beforePageLoad><![CDATA[#{javascript:
try {   
    currentDocument.replaceItemValue("itwuwfProcessAuthors","CN=Stephan Schramm/O=ITworks/C=DE")
} catch(e) {
    printMsg(e.toString() + "\n" + @ReplaceSubstring(e.getStackTrace().toString(),",","\n"))
}
}]]></xp:this.beforePageLoad>
 
Another trick is to simply save the document. Then the changes are reflected. But the user could still decide not to save and that would really create a lot of gabage and deletion stubs.
Thanks for any ideas on this topic.
Nov 28, 2011, 6:37 PM
170 Posts
Re: create author and reader fields
 Why not setting The fields before saving instead?
 
/Fredrik 
Nov 29, 2011, 1:29 PM
6 Posts
Re: create author and reader fields
I want to use this functionality in a lot of java classes.For example I have some classes which control a workflow and the function updateProcessInformation should not have the limitiation not to work in every event. At the moment it works with the com.ibm.xsp.model.domino.wrapped.DominoDocument object for everything else.
 
There are a lot of workarounds. For example to simply computeWithForm with the reader and author fields on it. But this means I need a form and so on and so on.
 
I want to programm as dynamicly as possible and have no restrictions. And I hate workarounds ,)
 
But I will cope
 
Kind regards
Stephan

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal