@Override public int executeCode(Session arg0, Database arg1) { try { setCurrentTaskStatus("Task started"); setTaskCompletion(0); System.out.println(arg0.getCommonUserName()); System.out.println(arg0.getEffectiveUserName()); System.out.println(arg1.getFilePath()); setCurrentTaskStatus("Task finished"); setTaskCompletion(100); } catch (Exception e) { e.printStackTrace(); } return 0; }
/** * This will display an error page to the user. The error page must be in a view in the current * Database with the name matching the value of EXCEPTION_VIEW. The key of the document in the * view is the same as the class of the exception that is calling this method. * * @param - contextDoc Document , the context document. */ public void showExceptionWebPage(Document contextDoc) { try { Database db = contextDoc.getParentDatabase(); View view = db.getView(EXCEPTION_VIEW); if (view != null) { Document errorPage = view.getDocumentByKey(EXCEPTION_KEY); if (errorPage != null) { contextDoc.replaceItemValue( "$$Return", "[/" + db.getFilePath() + "/" + EXCEPTION_VIEW + "/" + EXCEPTION_KEY + "?OpenDocument]"); } } } catch ( NotesException e) {; /// Do nothing if the database doesn't have an exception page for this exception } }
/* * Reload the application configuration by reading the settings document */ public void reload() { Database dbCurrent = null; View vwAllByType = null; Document docSettings = null; try { Session sessionAsSigner = Utils.getCurrentSessionAsSigner(); dbCurrent = sessionAsSigner.getCurrentDatabase(); vwAllByType = dbCurrent.getView("vwAllByType"); docSettings = vwAllByType.getDocumentByKey("fSettings", true); if (docSettings == null) { System.out.println("could not read settings document"); } else { String dataVersion = docSettings.getItemValueString("dataVersion"); if (!dataVersion.equals(DATA_VERSION)) { convert(dataVersion, DATA_VERSION, dbCurrent, vwAllByType, docSettings); } serverName = dbCurrent.getServer(); continuityDbPath = dbCurrent.getFilePath(); continuityDbUrl = "/" + continuityDbPath.replace("\\", "/"); settingsUnid = docSettings.getUniversalID(); organisationName = docSettings.getItemValueString("organisationName"); organisationId = docSettings.getItemValueString("organisationId"); directoryDbPath = docSettings.getItemValueString("directoryDbPath"); unpluggedDbPath = docSettings.getItemValueString("unpluggedDbPath"); callTreeType = docSettings.getItemValueString("callTreeType"); if (callTreeType.length() == 0) { callTreeType = CALLTREE_TYPE_ROLE; // default: role based } senderEmail = docSettings.getItemValueString("senderEmail"); senderName = docSettings.getItemValueString("senderName"); // defaults if (senderEmail.length() == 0) { senderEmail = "*****@*****.**"; } if (senderName.length() == 0) { senderName = "Continuity"; } // labels String riskNaming = docSettings.getItemValueString("riskNaming"); String incidentNaming = docSettings.getItemValueString("incidentNaming"); if (riskNaming.equals("activities")) { labels.put("assets", "Activities"); labels.put("asset", "Activity"); } else if (riskNaming.equals("sites")) { labels.put("assets", "Sites"); labels.put("asset", "Site"); } else if (riskNaming.equals("locations")) { labels.put("assets", "Locations"); labels.put("asset", "Location"); } else { labels.put("assets", "Assets"); labels.put("asset", "Asset"); } if (incidentNaming.equals("crises")) { labels.put("incidents", "Crises"); labels.put("incident", "Crisis"); } else if (incidentNaming.equals("emergencies")) { labels.put("incidents", "Emergencies"); labels.put("incident", "Emergency"); } else { labels.put("incidents", "Incidents"); labels.put("incident", "Incident"); } labels.put("miniConfigGuide", getMiniConfigGuide()); labels.put("contactsImportGuide", getContactsImportGuide()); } } catch (Exception e) { e.printStackTrace(); } finally { Utils.recycle(docSettings, vwAllByType, dbCurrent); } }