Examples: IsProtectReaders property (Form - Java)

This agent toggles protection for $Readers in the form specified as the agent comment.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Agent agent = agentContext.getCurrentAgent();
      Database db = agentContext.getCurrentDatabase();
      Form form = db.getForm(agent.getComment());
      if (form.isProtectReaders()) {
        form.setProtectReaders(false);
        System.out.println
        ("Protect readers cleared for " + form.getName()); }
      else {
        form.setProtectReaders(true);
        System.out.println
        ("Protect readers set for " + form.getName()); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}