From d4a044b2f29154fba776d386d55187c519e0ddfc Mon Sep 17 00:00:00 2001 From: Piotr Zarzycki Date: Sun, 29 Oct 2023 11:15:47 +0100 Subject: [PATCH] Revert "Initial Database interface agent for #40" This reverts commit 1dab7aa00f04833c1dd65ca19785df4e6ca10baa. --- .../DatabaseRead.properties | 41 -------- .../CustomBookmarkAgents/DatabaseRead.java | 94 ------------------- 2 files changed, 135 deletions(-) delete mode 100644 Super.Human.Portal_Agents/agentProperties/agentbuild/CustomBookmarkScripts/DatabaseRead.properties delete mode 100644 Super.Human.Portal_Agents/src/main/java/CustomBookmarkAgents/DatabaseRead.java diff --git a/Super.Human.Portal_Agents/agentProperties/agentbuild/CustomBookmarkScripts/DatabaseRead.properties b/Super.Human.Portal_Agents/agentProperties/agentbuild/CustomBookmarkScripts/DatabaseRead.properties deleted file mode 100644 index b72b2f0..0000000 --- a/Super.Human.Portal_Agents/agentProperties/agentbuild/CustomBookmarkScripts/DatabaseRead.properties +++ /dev/null @@ -1,41 +0,0 @@ -# target location overwritten by properties in build.gradle -$$nsfServer= -$$nsfFile= - -## Primary Configuration -# The name of the agent. An alias can be specifed with: FullName|alias -agent_name=DatabaseRead -# The main class that should be run for this agent. This must include the package. The maximum length is 65 characters - additional characters will be cut off. -javaproject_class=CustomBookmarkAgents/DatabaseRead.class -# The JAR to use for this agent. All agents will use the combined JAR -$$jarSourceFile=./build/libs/Super.Human.Portal_Agents.jar -# Comma-separated list of Script Libraries required for this agent -$$scriptLibrary=Moonshine-Domino-CRUD - -## Additional options -# Whether the agent should run as the web users with permissions. true or false -agent_runaswebuser=false -# If true, enables you to access the agent without having to wait for it to complete. If you set this attribute to true and the agent references any front-end classes, a run-time error is generated -agent_clientbackgroundthread=false -# If true, permits remote debugging of the LotusScript in an agent script and permits you to monitor the execution of agents written in Java -agent_allowremotedebugging=false -# If true, highlights the text in the retrieved documents that matches the search query. Default is false. -agent_storehighlights=false -# The access level the agent needs: (restricted | unrestricted | fulladminunrestricted) -agent_restrictions=restricted -# Space separated list of hide restrictions. Allowed Values: (web | notes | v3) -agent_hide=v3 notes -# Do not change -agent_publicaccess=false -# The method to use for triggering the agent. Options: (actionsmenu | agentlist | beforenewmail | afternewmail | docupdate | docpaste | scheduled | serverstart ) -trigger_type=actionsmenu -# The runtime behavior of the agent: (modified | unreadinview | allinview | selected | runonce | all) -documentset_type=runonce -# Name of a built-in event or a user-defined LotusScript function. -code_event=action -# Do not change -javaproject_codepath=. -# true or false. Determines whether this agent is compiled with debugging information. True is recommended to see line numbers in stack traces -javaproject_compiledebug=true -# Do not change this -javaproject_imported=true diff --git a/Super.Human.Portal_Agents/src/main/java/CustomBookmarkAgents/DatabaseRead.java b/Super.Human.Portal_Agents/src/main/java/CustomBookmarkAgents/DatabaseRead.java deleted file mode 100644 index 69b420f..0000000 --- a/Super.Human.Portal_Agents/src/main/java/CustomBookmarkAgents/DatabaseRead.java +++ /dev/null @@ -1,94 +0,0 @@ -package CustomBookmarkAgents; - -import java.util.Random; - -import org.json.JSONArray; -import org.json.JSONObject; - -import com.moonshine.domino.crud.CRUDAgentBase; -import com.moonshine.domino.security.AllowAllSecurity; -import com.moonshine.domino.security.SecurityInterface; -import com.moonshine.domino.util.DominoUtils; - -import lotus.domino.Database; -import lotus.domino.DbDirectory; -import lotus.domino.NotesException; - -/** - * Return a list of the databases on the server - */ -public class DatabaseRead extends CRUDAgentBase -{ - - @Override - protected void runAction() { - DbDirectory directory = null; - JSONArray json = null; - try { - directory = session.getDbDirectory(""); - json = new JSONArray(); - - Database curDatabase = directory.getFirstDatabase(DbDirectory.TEMPLATE_CANDIDATE); // include templates for now - while (null != curDatabase) { - String identifier = "UNKNOWN"; - try { - identifier = curDatabase.getFilePath(); - json.put(getDatabaseJSON(curDatabase)); - } - catch (Exception ex) { - getLog().err("Could not process database '" + identifier + "': ", ex); - } - finally { - Database prevDatabase = curDatabase; - curDatabase = directory.getNextDatabase(); - DominoUtils.recycle(session, prevDatabase); - } - } - } - catch (NotesException ex) { - getLog().err("Error when reading database directory: ", ex); - } - finally { - DominoUtils.recycle(session, directory); - jsonRoot.put("databases", json); - } - } - - protected JSONObject getDatabaseJSON(Database db) throws NotesException, Exception { - JSONObject json = new JSONObject(); - - // this JSON is intended to be compatible with the database link logic - json.put("name", db.getTitle()); - json.put("type", "database"); - json.put("server", db.getServer()); - json.put("database", db.getFilePath()); - json.put("view", ""); // no specific view by default - - // TODO: generate the access URLs based on LinkProcessor logic - json.put("url", "TODO"); - json.put("nomadURL", "TODO"); - - // additional values - // Replica is not needed for initial logic, but it may be useful later - json.put("replicaID", db.getReplicaID()); - - // properties to track existing values: - // TODO: compute these instead of using placeholders - json.put("hasBookmarks", false); // new Random().nextBoolean()); - json.put("bookmarkCount", 0); - json.put("bookmarks", new JSONArray()); - - return json; - } - - @Override - protected SecurityInterface createSecurityInterface() { - return new AllowAllSecurity(session); - } - - @Override - protected boolean useJSON() { - // only support JSON for now - return true; - } -} \ No newline at end of file