本文整理汇总了Java中lotus.domino.Document.getItemValueString方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getItemValueString方法的具体用法?Java Document.getItemValueString怎么用?Java Document.getItemValueString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Document
的用法示例。
在下文中一共展示了Document.getItemValueString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadAppstore
import lotus.domino.Document; //导入方法依赖的package包/类
private void loadAppstore() {
Database db=ExtLibUtil.getCurrentDatabase();
View view=null;
Document appstore=null;
try {
view=db.getView("apps");
appstore=view.getDocumentByKey(DEFAULT_ENDPOINT_NAME, true);
if(appstore==null) {
System.out.println("No Application found for "+DEFAULT_ENDPOINT_NAME);
} else {
consumerKey=appstore.getItemValueString("ConsumerKey");
consumerSecret=appstore.getItemValueString("ConsumerSecret");
}
} catch(NotesException ne) {
ne.printStackTrace();
} finally {
DevelopiUtils.recycleObjects(appstore, view);
}
}
示例2: getClusterMates
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Gets the cluster mates.
*
* @param s the s
* @return the cluster mates
* @throws NotesException the notes exception
*/
private List<String> getClusterMates(Session s) throws NotesException{
if(clusterMates.isEmpty()){
synchronized(clusterMates){
if(clusterMates.isEmpty()){
if(!Config.getInstance().isClustered()){
clusterMates.add(ServerInfo.getInstance().getServerName());
return clusterMates;
}
System.out.println("loading clustermates");
/*
* all below should get recycled after session is recycled.
*/
final Database db = s.getDatabase(StringCache.EMPTY, StringCache.NAMES_DOT_NSF);
final View view = db.getView(Const.VIEW_SERVERS);
final Document docServer = view.getDocumentByKey(ServerInfo.getInstance().getServerName(), true);
final String clusterName = docServer.getItemValueString(Const.FIELD_CLUSTERNAME);
final DocumentCollection col = db.getView(Const.VIEW_CLUSTERS).getAllDocumentsByKey(clusterName,true);
Document doc = col.getFirstDocument();
while(doc!=null){
clusterMates.add(doc.getItemValueString(Const.FIELD_SERVERNAME));
doc = col.getNextDocument(doc);
}
}
}
}
return clusterMates;
}
示例3: processDoc
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Process doc.
*
* @param doc the doc
*/
//@Stopwatch(time=50)
protected void processDoc(Document doc){
try{
ServerInfo info = ServerInfo.getInstance();
String to = doc.getItemValueString(Const.FIELD_TO);
IUser user = server.resolveUser(to);
//only process if we're on the correct host, and that the user has an open connection.
if((to.startsWith(StringCache.FORWARD_SLASH)
|| info.isCurrentServer(to)
|| (user!=null && user.isOpen()
&& user.isOnServer()))){
//validate the fields
SocketMessage msg = msgFactory.buildMessage(doc);
//validate the data was bound correctly.
if(msg.isValid()){
boolean b = server.onMessage(to, msg.toJson());
if(b){
doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_SENT);
doc.save();
}
}else{
doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
doc.replaceItemValue(Const.FIELD_ERROR, "Invalid message. Please check field data.");
doc.save();
}
}
}catch(Exception e){
LOG.log(Level.SEVERE,null, e);
}
}
示例4: setClustermateUsersOffline
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Sets the clustermate users offline.
*
* @param db the db
* @param clustermate the clustermate
*/
@Stopwatch
private void setClustermateUsersOffline(Database db, String clustermate) {
try {
View view = db.getView(Const.VIEW_USERS);
view.setAutoUpdate(false);
Document doc = view.getFirstDocument();
Document temp = null;
while(doc!=null){
if(doc.isValid()){
String host = doc.getItemValueString(Const.FIELD_HOST);
//if hosts are the same
if(host!=null && host.equals(clustermate)){
doc.replaceItemValue(Const.FIELD_STATUS, Const.STATUS_OFFLINE);
doc.save();
}
}
temp = view.getNextDocument(doc);
doc.recycle();
doc = temp;
}
view.setAutoUpdate(true);
} catch (NotesException e) {
LOG.log(Level.SEVERE,null,e);
}
}
示例5: run
import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {
if(TaskRunner.getInstance().isClosing()){
return;
}
Session session = this.openSession();
try {
Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
View view = db.getView(Const.VIEW_USERS);
Document doc = view.getFirstDocument();
Document temp = null;
while(doc!=null){
String host = doc.getItemValueString(Const.FIELD_HOST);
if(ServerInfo.getInstance().isCurrentServer(host)){
String currentStatus= doc.getItemValueString(Const.FIELD_STATUS);
//only update if we need to.
if(!this.getStatus().equals(currentStatus)){
doc.replaceItemValue(Const.FIELD_STATUS, this.getStatus());
doc.save();
}
}
temp = view.getNextDocument(doc);
doc.recycle();
doc = temp;
}
} catch (NotesException e) {
LOG.log(Level.SEVERE,null,e);
}finally{
SessionFactory.closeSession(session);
}
}
示例6: initFromDocument
import lotus.domino.Document; //导入方法依赖的package包/类
public static Share initFromDocument( Document doc) {
Share share = new Share();
try {
share.m_ShareName = doc.getItemValueString("ShareName");
share.m_Count = doc.getItemValueInteger("Count");
share.m_PricePerShare = doc.getItemValueInteger("PricePerShare");
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
return share;
}
示例7: getForm
import lotus.domino.Document; //导入方法依赖的package包/类
@Override
public String getForm() throws ServiceException {
String result = "";
if (isDocument()) {
try {
Document document = entry.getDocument();
if (document != null) {
result = document.getItemValueString(ITEM_FORM);
}
} catch (NotesException ex) {
throw new ServiceException(ex,""); // $NON-NLS-1$
}
}
return result;
}
示例8: parseReceivedFromNote
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Given a note received from another user, parse the from display name and internet address.
*
* @param doc
* Email note to parse for sender data
* @return
* @throws NotesException
*/
private List<RecentContact> parseReceivedFromNote(final Document doc) throws NotesException
{
// Currently only getting from address - may get items like others that were on the email
// in the future.
final List<RecentContact> recentContacts = new ArrayList<RecentContact>(1);
final RecentContact sender = new RecentContact();
recentContacts.add(sender);
final Vector dateVec = doc.getItemValue("DeliveredDate"); //$NON-NLS-1$
if (doc.hasItem("INetFrom")) //$NON-NLS-1$
{
sender.InternetAddress = doc.getItemValueString("INetFrom"); //$NON-NLS-1$
if (sender.InternetAddress.contains("<"))
{
processComboInet(sender, sender.InternetAddress);
}
else
{
sender.DisplayName = doc.getItemValueString("From"); //$NON-NLS-1$
sender.DisplayName = sender.DisplayName.replaceAll("CN=|OU=|O=|@.*", ""); //$NON-NLS-1$
}
}
else
{
processComboInet(sender, doc.getItemValueString("From")); //$NON-NLS-1$
}
sender.lastContacted = getDateFromVector(dateVec);
return recentContacts;
}
示例9: setImpl
import lotus.domino.Document; //导入方法依赖的package包/类
protected void setImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
AdministrationProcess adminp = null;
try {
Session session = database.getParent();
// Can't modify the owner's access
String owner = profile.getItemValueString(OWNER_ITEM);
verifyDelegateNotOwner(session, delegate.getName(), owner);
// Can't modify a delegate that's not there
Vector[] vectors = loadVectors(profile);
Name name = session.createName(delegate.getName());
if ( !delegateExists(vectors, name.getCanonical()) ) {
throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NON-NLS-1$
}
// Update the right vector(s)
delegateRemove(vectors, name.getCanonical());
delegateAdd(vectors, name.getCanonical(), delegate.getAccess());
// Send the adminp request
String mailFile = database.getFilePath();
String server = session.getServerName();
adminp = session.createAdministrationProcess(null);
String unid = adminp.delegateMailFile(owner,
vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], vectors[5],
null, mailFile, server);
}
finally {
BackendUtil.safeRecycle(adminp);
}
}
示例10: addImpl
import lotus.domino.Document; //导入方法依赖的package包/类
protected void addImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
AdministrationProcess adminp = null;
try {
Session session = database.getParent();
// Can't add the owner as a delegate
String owner = profile.getItemValueString(OWNER_ITEM);
verifyDelegateNotOwner(session, delegate.getName(), owner);
// Can't add someone that's already there
Vector[] vectors = loadVectors(profile);
Name name = session.createName(delegate.getName());
if ( delegateExists(vectors, name.getCanonical()) ) {
throw new ModelException("A delegate of that name already exists", ModelException.ERR_CONFLICT); // $NON-NLS-1$
}
// Add the delegate to the right vector(s)
delegateAdd(vectors, name.getCanonical(), delegate.getAccess());
// Send the adminp request
String mailFile = database.getFilePath();
String server = session.getServerName();
adminp = session.createAdministrationProcess(null);
String unid = adminp.delegateMailFile(owner,
vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], vectors[5],
null, mailFile, server);
}
finally {
BackendUtil.safeRecycle(adminp);
}
}
示例11: deleteImpl
import lotus.domino.Document; //导入方法依赖的package包/类
protected void deleteImpl(Database database, String name, Document profile) throws ModelException, NotesException {
AdministrationProcess adminp = null;
try {
Session session = database.getParent();
// Can't remove the owner
String owner = profile.getItemValueString(OWNER_ITEM);
verifyDelegateNotOwner(session, name, owner);
// Can't remove a delegate that's not there
Vector[] vectors = loadVectors(profile);
Name no = session.createName(name);
if ( !delegateExists(vectors, no.getCanonical()) ) {
throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NON-NLS-1$
}
// Send the adminp request
Vector removeList = new Vector();
removeList.add(no.getCanonical());
String mailFile = database.getFilePath();
String server = session.getServerName();
adminp = session.createAdministrationProcess(null);
String unid = adminp.delegateMailFile(owner,
null, null, null, null, null, null,
removeList, mailFile, server);
}
finally {
BackendUtil.safeRecycle(adminp);
}
}
示例12: deleteImpl
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Does most of the work of deleting a delegate.
*
* <p>This version edits the ACL directly. A subclass may use adminp
* to delete the delegate.
*
* @param database
* @param name The abbreviated name of the delegate to delete.
* @param owner The canonical name of the mail file owner.
* @throws ModelException
* @throws NotesException
*/
protected void deleteImpl(Database database, String name, Document profile) throws ModelException, NotesException {
ACL acl = null;
try {
if ( !hasManagerAccess(database) ) {
throw new ModelException("Manager access is required to remove a delegate.", ModelException.ERR_NOT_ALLOWED); // $NLX-DelegateProvider.Manageraccessisrequiredtoremovead-1$
}
// Get the ACL
acl = database.getACL();
boolean deleted = false;
ACLEntry entry = acl.getFirstEntry();
// Get the owner of the mailfile
String owner = profile.getItemValueString(OWNER_ITEM);
// Look at each ACL entry
while ( entry != null ) {
Name no = entry.getNameObject();
// If it's a match, delete it
if ( name.equalsIgnoreCase(no.getAbbreviated()) ) {
// But you can't remove the owner's access
if ( owner != null && owner.equalsIgnoreCase(entry.getName()) ) {
throw new ModelException("Cannot remove the owner's access", ModelException.ERR_NOT_ALLOWED); // $NLX-DelegateProvider.Cannotremovetheownersaccess-1$
}
// It's gone
acl.removeACLEntry(name);
acl.save();
deleted = true;
break;
}
entry = acl.getNextEntry();
}
if ( !deleted ) {
throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NLX-DelegateProvider.Delegatenotfound.1-1$
}
}
finally {
BackendUtil.safeRecycle(acl);
}
}
示例13: getDelegatesFromAcl
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Reads the list of delegates from the ACL.
*
* <p>We don't use this code anymore, but it's kept here for
* sentimental reasons.
*
* @param database
* @return
* @throws NotesException
*/
private List<Delegate> getDelegatesFromAcl(Database database) throws NotesException {
List<Delegate> delegates = new ArrayList<Delegate>();
ACL acl = null;
Document profile = null;
try {
// Get the owner of the mailfile
profile = profileGet(database);
String owner = profile.getItemValueString(OWNER_ITEM);
// Get the ACL
acl = database.getACL();
ACLEntry entry = acl.getFirstEntry();
// Convert each ACL entry to a delegate
while ( entry != null ) {
Delegate delegate = null;
// Convert entry to delegate, unless this is the owner of the mail file
if ( owner == null || !owner.equalsIgnoreCase(entry.getName()) ) {
delegate = getDelegateFromAclEntry(entry);
}
// Add the delegate to the list
if ( delegate != null ) {
delegates.add(delegate);
}
entry = acl.getNextEntry();
}
}
finally {
BackendUtil.safeRecycle(acl);
BackendUtil.safeRecycle(profile);
}
return delegates;
}