本文整理汇总了Java中lotus.domino.View.recycle方法的典型用法代码示例。如果您正苦于以下问题:Java View.recycle方法的具体用法?Java View.recycle怎么用?Java View.recycle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.View
的用法示例。
在下文中一共展示了View.recycle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserDoc
import lotus.domino.View; //导入方法依赖的package包/类
/**
* Gets the user doc.
*
* @param session the session
* @param create the create
* @return the user doc
* @throws NotesException the notes exception
*/
private Document getUserDoc(Session session, boolean create) throws NotesException{
Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
Document doc = null;
View users = db.getView(Const.VIEW_USERS);
View sessions = db.getView(Const.VIEW_SESSIONS);
doc = users.getDocumentByKey(user.getUserId().trim(),true);
if(doc == null){
doc = sessions.getDocumentByKey(user.getSessionId(),true);
}
//if we get here... create the doc.
if(doc==null && create){
doc = db.createDocument();
}
//cleanup
users.recycle();
sessions.recycle();
return doc;
}
示例2: getAllCustomers
import lotus.domino.View; //导入方法依赖的package包/类
public List<Customer> getAllCustomers(Session sesCurrent) {
List<Customer> lstCustomer = new ArrayList<Customer>();
try {
Database ndbCurrent = sesCurrent.getCurrentDatabase();
View viwCustomer = ndbCurrent.getView("lupCustomersById");
Document docNext = viwCustomer.getFirstDocument();
while (docNext != null) {
Document docProcess = docNext;
docNext = viwCustomer.getNextDocument(docNext);
Customer newCustomer = new Customer();
if (DominoStorageService.getInstance().getObjectWithDocument(newCustomer, docProcess)) {
lstCustomer.add(newCustomer);
}
docProcess.recycle();
}
viwCustomer.recycle();
ndbCurrent.recycle();
} catch (Exception e) {
e.printStackTrace();
}
return lstCustomer;
}
示例3: readDatabaseDocument
import lotus.domino.View; //导入方法依赖的package包/类
public static StatisticEntry readDatabaseDocument(String ProbeID, Session sesServer) {
StatisticEntry se = new StatisticEntry();
se.setKey(ProbeID);
ValueService.getInstance().updateDatabaseEntry(se);
try {
Database database = sesServer.getDatabase(sesServer.getServerName(), se.getSourceDatabase());
View view = database.getView(se.getSourceView());
Document document = view.getDocumentByKey(se.getDocumentSearchKey());
se.setValue(document.getItemValueDouble(se.getCheckValueField()));
se.setItemType(document.getFirstItem(se.getCheckValueField()).getType());
se.setDocumentCreated(document.getCreated());
document.recycle();
view.recycle();
database.recycle();
} catch (NotesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return se;
}
示例4: getAllBugs
import lotus.domino.View; //导入方法依赖的package包/类
public List<Bug> getAllBugs(Session sesCurrent, String statusFilter) {
List<Bug> lstBug = new ArrayList<Bug>();
try {
Database ndbCurrent = sesCurrent.getCurrentDatabase();
View viwBug = ndbCurrent.getView("lupBugsById");
Document docNext = viwBug.getFirstDocument();
while (docNext != null) {
Document docProcess = docNext;
docNext = viwBug.getNextDocument(docNext);
Bug newBug = new Bug();
if (DominoStorageService.getInstance().getObjectWithDocument(newBug, docProcess)) {
if (!newBug.getIsDeleted().equals("true") && (statusFilter == null || statusFilter.equals("") || statusFilter.equals(newBug.getStatus()))) {
lstBug.add(newBug);
}
}
docProcess.recycle();
}
viwBug.recycle();
ndbCurrent.recycle();
} catch (Exception e) {
e.printStackTrace();
}
return lstBug;
}
示例5: getObjectsByForeignIdFrom
import lotus.domino.View; //导入方法依赖的package包/类
/**
* Load all objects by a foreign id form a view from the source database
*
* @param foreignId
* @param viewName
* @param sourceDatabase
* @return
*/
public List<T> getObjectsByForeignIdFrom(String foreignId, String viewName, Database sourceDatabase) {
List<T> ret = new ArrayList<T>();
try {
View view = sourceDatabase.getView(viewName);
view.setAutoUpdate(false);
DocumentCollection documents = view.getAllDocumentsByKey(foreignId, true);
Document docNext = documents.getFirstDocument();
while (docNext != null) {
Document docCurrent = docNext;
docNext = documents.getNextDocument(docNext);
convertDocument2ObjectAndAdd2List(ret, docCurrent);
docCurrent.recycle();
}
view.recycle();
} catch (NullPointerException ex) {
throw ex;
} catch (Exception e) {
LoggerFactory.logError(getClass(), GENERAL_ERROR, e);
throw new XPTRuntimeException(GENERAL_ERROR, e);
}
return ret;
}
示例6: getAllIterations
import lotus.domino.View; //导入方法依赖的package包/类
public List<Iteration> getAllIterations(Session sesCurrent) {
List<Iteration> lstIteration = new ArrayList<Iteration>();
try {
Database ndbCurrent = sesCurrent.getCurrentDatabase();
View viwIteration = ndbCurrent.getView("lupIterationsById");
Document docNext = viwIteration.getFirstDocument();
while (docNext != null) {
Document docProcess = docNext;
docNext = viwIteration.getNextDocument(docNext);
Iteration newIteration = new Iteration();
if (DominoStorageService.getInstance().getObjectWithDocument(
newIteration, docProcess)) {
lstIteration.add(newIteration);
}
docProcess.recycle();
}
viwIteration.recycle();
ndbCurrent.recycle();
} catch (Exception e) {
e.printStackTrace();
}
return lstIteration;
}
示例7: getDocument
import lotus.domino.View; //导入方法依赖的package包/类
private Document getDocument(DominoStore ds, Object obj, Database ndbTarget, boolean createOnFail) throws NotesException {
Document docCurrent = null;
Object objID = getObjectID(ds, obj);
if (objID != null && !"".equals(objID)) {
if (UNID_IDENTIFIER.equals(ds.View())) {
docCurrent = ndbTarget.getDocumentByUNID("" + objID);
} else {
View viwCurrent = ndbTarget.getView(ds.View());
docCurrent = viwCurrent.getDocumentByKey(objID, true);
viwCurrent.recycle();
}
}
if (docCurrent == null && createOnFail) {
docCurrent = ndbTarget.createDocument();
docCurrent.replaceItemValue("Form", ds.Form());
if (UNID_IDENTIFIER.equals(ds.View())) {
setUNID2PK(ds, obj, docCurrent);
}
}
return docCurrent;
}
示例8: getAllFrom
import lotus.domino.View; //导入方法依赖的package包/类
/**
* Loads all objects form a view from the source database
*
* @param viewName
* @param sourceDatabase
* @return
*/
public List<T> getAllFrom(String viewName, Database sourceDatabase) {
List<T> ret = new ArrayList<T>();
try {
View viwDabases = sourceDatabase.getView(viewName);
viwDabases.setAutoUpdate(false);
Document docNext = viwDabases.getFirstDocument();
while (docNext != null) {
Document docCurrent = docNext;
docNext = viwDabases.getNextDocument(docNext);
convertDocument2ObjectAndAdd2List(ret, docCurrent);
docCurrent.recycle();
}
viwDabases.recycle();
} catch (NullPointerException ex) {
throw ex;
} catch (Exception e) {
LoggerFactory.logError(getClass(), GENERAL_ERROR, e);
throw new XPTRuntimeException(GENERAL_ERROR, e);
}
return ret;
}
示例9: getDocument
import lotus.domino.View; //导入方法依赖的package包/类
private Document getDocument(DominoStore ds, Object obj, Database ndbTarget, boolean createOnFail, Object objID) throws NotesException {
Document docCurrent = null;
if (objID != null && !"".equals(objID)) {
if (UNID_IDENTIFIER.equals(ds.View())) {
docCurrent = ndbTarget.getDocumentByUNID("" + objID);
} else {
View viwCurrent = ndbTarget.getView(ds.View());
docCurrent = viwCurrent.getDocumentByKey(objID, true);
viwCurrent.recycle();
}
}
if (docCurrent == null && createOnFail) {
docCurrent = ndbTarget.createDocument();
docCurrent.replaceItemValue("Form", ds.Form());
if (UNID_IDENTIFIER.equals(ds.View())) {
setUNID2PK(ds, obj, docCurrent);
}
}
return docCurrent;
}
示例10: searchInViewFrom
import lotus.domino.View; //导入方法依赖的package包/类
/**
* Search for documents containing the search term in the view of the
* database db, using the fulltext search capability.
*
* @param search
* @param viewName
* @param db
* @return
*/
public List<T> searchInViewFrom(String search, String viewName, Database db) {
List<T> result = new ArrayList<T>();
try {
View view = db.getView(viewName);
int count = view.FTSearch(search);
if (count == 0) {
view.recycle();
return result;
}
result = new ArrayList<T>(count);
Document docNext = view.getFirstDocument();
while (docNext != null) {
Document docProcess = docNext;
docNext = view.getNextDocument(docNext);
convertDocument2ObjectAndAdd2List(result, docProcess);
docProcess.recycle();
}
view.recycle();
} catch (NullPointerException ex) {
throw ex;
} catch (Exception e) {
throw new XPTRuntimeException("Error during search of " + search + " in view " + viewName, e);
}
return result;
}
示例11: recycle
import lotus.domino.View; //导入方法依赖的package包/类
public static void recycle(View view){
try {
if(view==null) return;
view.recycle();
} catch (NotesException e) {
logger.log(Level.SEVERE,null, e);
}
}
示例12: createDiscussionDocuments
import lotus.domino.View; //导入方法依赖的package包/类
void createDiscussionDocuments(Database db) throws NotesException, IOException {
// Construct a list of authors
// As we want the tag cloud to render differences between the authors, we give
// as different weight to each author by adding it a random # of times in the list
// We read the author names from the database
ArrayList<String> users = new ArrayList<String>();
View authorView = db.getView("AllContacts");
authorView.refresh();
try {
int maxAuthors = 15;
int nAuthor = 0;
ViewEntryCollection authorCol = authorView.getAllEntries();
for(ViewEntry e=authorCol.getFirstEntry(); e!=null && nAuthor<maxAuthors; e=authorCol.getNextEntry()) {
Vector<?> values = e.getColumnValues();
String name = (String)values.get(7);
// Add it a random number of times to the list
int n = ((int)(Math.random()*maxAuthors))+1;
for(int jj=0; jj<n; jj++) {
users.add(name);
}
nAuthor++;
}
} finally {
authorView.recycle();
}
if(users.size()==0) {
// Just in case they were not created...
users.add("John Doe");
}
View w = db.getView("AllThreads");
w.getAllEntries().removeAll(true);
createDiscussionDocument(db, null, users, new int[]{0}, disc_rootDocs);
}
示例13: getAllMyObjectsFrom
import lotus.domino.View; //导入方法依赖的package包/类
/**
* Loads all object where my user, group or role occurs in one of the fields
* form the source database
*
* @param viewName
* @param fieldsToCheck
* @param sourceDatabase
* @return
*/
public List<T> getAllMyObjectsFrom(String viewName, List<String> fieldsToCheck, Database sourceDatabase) {
List<T> ret = new ArrayList<T>();
List<String> lstRolesGroups = RoleAndGroupProvider.getInstance().getMyGroupsAndRoles();
try {
View viwDabases = sourceDatabase.getView(viewName);
viwDabases.setAutoUpdate(false);
Document docNext = viwDabases.getFirstDocument();
while (docNext != null) {
Document docCurrent = docNext;
docNext = viwDabases.getNextDocument(docNext);
if (isDocumentOfInterest(docCurrent, lstRolesGroups, fieldsToCheck)) {
convertDocument2ObjectAndAdd2List(ret, docCurrent);
}
docCurrent.recycle();
}
viwDabases.recycle();
} catch (NullPointerException ex) {
throw ex;
} catch (Exception e) {
LoggerFactory.logError(getClass(), GENERAL_ERROR, e);
throw new XPTRuntimeException(GENERAL_ERROR, e);
}
return ret;
}
示例14: run
import lotus.domino.View; //导入方法依赖的package包/类
@Override
public void run() {
try {
Session sess = NotesFactory.createSession();
DbDirectory dir = sess.getDbDirectory("");
Database db = sess.getDatabase("", FAKENAMES_NSF);
if (db != null)
db.remove();
db = dir.createDatabase(FAKENAMES_NSF, true);
View view = db.createView("Names", "SELECT Form = \"DocName\"");
view.createColumn(2, "Title", "Title").recycle();
view.createColumn(3, "Prefix", "NamePrefix").recycle();
view.createColumn(4, "First Name", "FirstName").recycle();
view.createColumn(5, "Last Name", "LastName").recycle();
view.createColumn(6, "Zip Code", "ZipCode").recycle();
view.createColumn(7, "Country", "Country").recycle();
view.createColumn(8, "Address", "Address").recycle();
view.createColumn(9, "Birthday", "Birthday").recycle();
view.createColumn(10, "PhoneNumber", "PhoneNumber").recycle();
view.recycle();
db.recycle();
dir.recycle();
// sess.recycle();
} catch (NotesException e) {
e.printStackTrace();
}
}
示例15: getAllObjectsForFrom
import lotus.domino.View; //导入方法依赖的package包/类
/**
* Loads all object where the user, group or role occurs in one of the
* fields form the source database
*
* @param userName
* @param viewName
* @param fieldsToCheck
* @param sourceDatabase
* @return
*/
public List<T> getAllObjectsForFrom(String userName, String viewName, List<String> fieldsToCheck, Database sourceDatabase) {
List<T> ret = new ArrayList<T>();
List<String> lstRolesGroups = RoleAndGroupProvider.getInstance().getGroupsAndRolesOf(userName, sourceDatabase);
try {
View view = sourceDatabase.getView(viewName);
view.setAutoUpdate(false);
Document docNext = view.getFirstDocument();
while (docNext != null) {
Document docCurrent = docNext;
docNext = view.getNextDocument(docNext);
if (isDocumentOfInterest(docCurrent, lstRolesGroups, fieldsToCheck)) {
convertDocument2ObjectAndAdd2List(ret, docCurrent);
}
docCurrent.recycle();
}
view.recycle();
} catch (NullPointerException ex) {
throw ex;
} catch (Exception e) {
LoggerFactory.logError(getClass(), GENERAL_ERROR, e);
throw new XPTRuntimeException(GENERAL_ERROR, e);
}
return ret;
}