Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.util.Vector;
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
Log log = null;
Document parametersDocument = null;
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Agent currentAgent = agentContext.getCurrentAgent();
Database currentDatabase = agentContext.getCurrentDatabase();
log = session.createLog(currentAgent.getName());
log.openAgentLog();
log.openFileLog("C:\\PWDSync\\Agentlog.txt");
String parametersDocumentId = currentAgent.getParameterDocID();
parametersDocument = currentDatabase.getDocumentByID(parametersDocumentId);
Vector serverVector = parametersDocument.getItemValue("server");
String server = null;
if (serverVector != null && serverVector.size() > 0) {
server = (String) serverVector.get(0);
}
Vector usernameVector = parametersDocument.getItemValue("username");
String username = null;
if (usernameVector != null && usernameVector.size() > 0) {
username = (String) usernameVector.get(0);
}
Vector passwordVector = parametersDocument.getItemValue("password");
String password = null;
if (passwordVector != null && passwordVector.size() > 0) {
password = (String) passwordVector.get(0);
}
log.logAction("Reseting password ...");
log.logAction("Server: " +server +" User:" +username);
session.resetUserPassword(server, username, password);
parametersDocument.replaceItemValue("result", "true");
parametersDocument.save(true, true);
log.logAction("Return value: true");
// Remove the document
parametersDocument.remove(true);
log.logAction("Removed User ID Vault change document from '"+server +"'");
} catch (NotesException e) {
try {
log.logError(e.id, e.text);
parametersDocument.replaceItemValue("result", "false");
parametersDocument.save(true, true);
} catch (NotesException e1) {
e1.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.