|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
一个java的更新login password(HTTPPassword)的程序函数,用户和口令认证在外部完成,这里只有note数据库更新部分,供参考。
重点:1。admin权限者方可更新。2。需要暗号化
另外有为难处:
用的版本notes5,Unix,Websphere5
EmbedObject不能用(Unix),如何向Document添加文件附件?
[code]
package jp.go.mlit.thr.tdms.web.addfunc;
import lotus.domino.*;
import java.util.Vector;
/**
* Notes HTTPPassword Update Class。<br>
* @version 1.0
*/
public class AddDBNotes
{
/**
*
* <p>
*/
public AddDBNotes() {
}
/**
* Notes HTTPPassword Update
* <p>
* @param loginUserID Admin ID
* @param loginPassword Admin password
* @param notesKey notes key (user id)
* @param newPAssword password (new user password)
* @return none
*/
public static void setNotesInfo(String loginUserID, String loginPassword, String notesKey, String newPAssword) throws Exception {
Session notes_ss = null;
Database notes_db = null;
View notes_view = null;
Document notes_doc = null;
try {
String note_frmpwd = null;
String sNotesHost = null;
String sNotesDB = null;
String sViewName =null;
String sNotesFrm = null;
String sNewPassword = null;
// usually be set to .property
sNotesHost = "ws821099.ktr.mlit.go.jp";
sNotesDB = "names.nsf";
sViewName = "People";
note_frmpwd = "HTTPPassword";
sNewPassword = newPAssword;
// connect to Noteshost to get a Session object
notes_ss = NotesFactory.createSession(sNotesHost, loginUserID, loginPassword);
// NotesDB
notes_db = notes_ss.getDatabase("", sNotesDB);
// NotesView
notes_view = notes_db.getView(sViewName);
// NotesDocument
notes_doc = notes_view.getDocumentByKey(notesKey);
// @Password
Vector vPwds = notes_ss.evaluate("@Password(" + '"' + sNewPassword + '"' + ")");
String sPPwd = vPwds.firstElement().toString();
// Update
notes_doc.replaceItemValue(note_frmpwd, sPPwd);
// Save
notes_doc.save(true);
} catch (Exception e) {
e.printStackTrace();
throw new Exception(e.getMessage());
} finally {
// notes_doc clear
try {
if(notes_doc != null) {
notes_doc.recycle();
}
} catch(Exception e) {}
notes_doc = null;
// notes_view clear
try {
if(notes_view != null) {
notes_view.recycle();
}
} catch(Exception e) {}
notes_view = null;
// NotesDB clear
try {
if(notes_db != null) {
notes_db.recycle();
}
} catch(Exception e) {}
notes_db = null;
// NotesSession clear
try {
if(notes_ss != null) {
notes_ss.recycle();
}
} catch(Exception e) {}
notes_ss = null;
}
}
}
|
|