{"id":1420,"date":"2014-03-14T12:39:59","date_gmt":"2014-03-14T10:39:59","guid":{"rendered":"http:\/\/hasselba.ch\/blog\/?p=1420"},"modified":"2014-03-14T12:40:48","modified_gmt":"2014-03-14T10:40:48","slug":"quick-n-dirty-use-isdoceditable-in-an-old-school-java-agent","status":"publish","type":"post","link":"https:\/\/hasselba.ch\/blog\/?p=1420","title":{"rendered":"Quick-n-Dirty: Use &#8222;isDocEditable&#8220; in an old school Java Agent"},"content":{"rendered":"<p>If you want to check if a document is editable, you can do this in an old school Java agent with the NAPI function <em>isDocEditable<\/em> provided by the <em>XSPNative<\/em> class.<\/p>\n<p>First you have to add the <a title=\"Quick-n-Dirty: How to use the NAPI in a Java Agent\" href=\"https:\/\/hasselba.ch\/blog\/?p=1345\">required JARs to your agent<\/a>. Then, you have to call <em>XSPNative.isDocEditable<\/em> with the document you want to test:<\/p>\n<pre><code>import lotus.domino.AgentBase;\r\nimport lotus.domino.Database;\r\nimport lotus.domino.Document;\r\nimport lotus.domino.Session;\r\n\r\nimport com.ibm.domino.napi.c.xsp.XSPNative;\r\n\r\npublic class JavaAgent extends AgentBase {\r\n\r\n\u00a0\u00a0\u00a0 public void NotesMain() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 try {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Session session = getSession();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Database db = session.getCurrentDatabase();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Document doc = db.getAllDocuments().getFirstDocument();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.println( \"Is Editable: \" + XSPNative.isDocEditable( doc ) );\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 } catch(Exception e) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 e.printStackTrace();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 }\r\n}<\/code><\/pre>\n<p>P.S.\u00a0Keep in mind that this article has been posted in the \u201cQuick-n-<strong>Dirty<\/strong>\u201d category.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to check if a document is editable, you can do this in an old school Java agent with the NAPI function isDocEditable provided by the XSPNative class. First you have to add the required JARs to your &hellip; <a href=\"https:\/\/hasselba.ch\/blog\/?p=1420\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,89],"tags":[33,47,79,7,31],"class_list":["post-1420","post","type-post","status-publish","format-standard","hentry","category-agenten","category-java","tag-8-5-3","tag-9-0","tag-agenten","tag-domino","tag-java"],"_links":{"self":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1420"}],"version-history":[{"count":5,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1420\/revisions"}],"predecessor-version":[{"id":1425,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1420\/revisions\/1425"}],"wp:attachment":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}