本文整理汇总了Java中lotus.domino.Document.hasItem方法的典型用法代码示例。如果您正苦于以下问题:Java Document.hasItem方法的具体用法?Java Document.hasItem怎么用?Java Document.hasItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Document
的用法示例。
在下文中一共展示了Document.hasItem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import lotus.domino.Document; //导入方法依赖的package包/类
public Object evaluate(RestDocumentService service, Document document) throws ServiceException {
// TODO: How can we cache the item name so we do not reevaluate it all the time?
String itemName = getItemName();
try {
if(StringUtil.isNotEmpty(itemName) && document.hasItem(itemName)) {
return document.getItemValue(itemName);
}
} catch (NotesException e) {
throw new ServiceException(e);
}
String var = service.getParameters().getVar();
if(StringUtil.isNotEmpty(var)) {
// TODO: Do that on a per item basis only...
Object old = service.getHttpRequest().getAttribute(var);
try {
service.getHttpRequest().setAttribute(var,document);
return getValue();
} finally {
service.getHttpRequest().setAttribute(var,old);
}
} else {
return getValue();
}
}
示例2: isRecycled
import lotus.domino.Document; //导入方法依赖的package包/类
private boolean isRecycled(Document doc) {
try {
//call any method to check recycled state
doc.hasItem("~-~-~-~-~-~");
}
catch (NotesException e) {
if (e.id==4376 || e.id==4466)
return true;
}
return false;
}
示例3: run
import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {
if(TaskRunner.getInstance().isClosing()){
return;
}
if(server.getWebSocketAndObserverCount() == 0)return;
Session session = this.openSession();
try {
Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
View view = db.getView(Const.VIEW_MSG_QUEUE);
if(view.getAllEntries().getCount() > 0){
view.setAutoUpdate(false);
Document doc = view.getFirstDocument();
Document temp = null;
while(doc!=null){
if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){
this.processDoc(doc);
}else if(doc.isValid() && doc.hasItem(StringCache.FIELD_CONFLICT)){
this.processConflict(doc);
}
temp = view.getNextDocument(doc);
doc.recycle();
doc = temp;
}
view.setAutoUpdate(true);
}
} catch (NotesException e) {
LOG.log(Level.SEVERE,null,e);
}finally{
this.closeSession(session);
}
}
示例4: getViewName
import lotus.domino.Document; //导入方法依赖的package包/类
private String getViewName(Document viewDoc) throws NotesException {
String name = "";
String[] aliases = null;
Vector<?> names = viewDoc.getItemValue(FIELD_TITLE);
if ( names != null && names.size() > 0 ){
String title = (String)names.get( 0 );
//Compute the aliases
ArrayList<String> aliasesList = new ArrayList<String>();
StringTokenizer st = new StringTokenizer( title, "|");
while ( st.hasMoreTokens() ){
if ( name == null ){
name = st.nextToken().trim();
}else{
aliasesList.add( st.nextToken().trim() );
}
}
for ( int i = 1; i < names.size(); i++ ){
aliasesList.add( (String)names.get( i ) );
}
aliases = aliasesList.toArray( new String[0] );
}else if ( viewDoc.hasItem( FIELD_TITLE ) ) {
name=""; //Empty name
}
if (name.length() == 0)
if (aliases != null)
name = aliases[0];
return name;
}
示例5: fromJson
import lotus.domino.Document; //导入方法依赖的package包/类
public void fromJson(Document document) throws JsonException {
// SPR #DDEY9L6MX5: Add a Form item
try {
if ( !document.hasItem(FORM_ITEM) ) {
document.replaceItemValue(FORM_ITEM, MEMO_FORM);
}
}
catch (NotesException e) {
// Ignore exception
}
JsonFactory factory = new JsonObjectFactory(document);
JsonParser.fromJson(factory, _reader);
}
示例6: 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;
}
示例7: run
import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {
if(TaskRunner.getInstance().isClosing()){
return;
}
//exit if nobody on.
if(server.getWebSocketCount() == 0) return;
Session session = super.openSession();
try {
if(ServerInfo.getInstance().isCurrentServer(Config.getInstance().getBroadcastServer())){
Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
View view = db.getView(Const.VIEW_BROADCAST_QUEUE);
view.setAutoUpdate(false);
Document doc = view.getFirstDocument();
Document temp = null;
while(doc!=null){
if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){
this.buildDirectMessages(doc);
doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_SENT);
doc.save();
}
temp = view.getNextDocument(doc);
doc.recycle();
doc = temp;
}
view.setAutoUpdate(true);
}
} catch (NotesException e) {
LOG.log(Level.SEVERE,null,e);
}finally{
super.closeSession(session);
}
}
示例8: run
import lotus.domino.Document; //导入方法依赖的package包/类
@Override
public void run() {
if(TaskRunner.getInstance().isClosing()){
return;
}
Session session = super.openSession();
try {
Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
View view = db.getView(Const.VIEW_USERS);
view.setAutoUpdate(false);
Document doc = view.getFirstDocument();
Document temp = null;
while(doc!=null){
//can't seem to stop this from happening in clustered environment (hack for now)
if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){
IUser user = userFactory.createUser(doc);
if(Const.STATUS_ONLINE.equals(user.getStatus()) && !ServerInfo.getInstance().isCurrentServer(user.getHost())){
server.addUser(user);
}else if(Const.STATUS_OFFLINE.equals(user.getStatus()) && !ServerInfo.getInstance().isCurrentServer(user.getHost())){
server.removeUser(user);
}
}
//cleanup the conflicts. (hack... need to revisit)
else if( doc.isValid() && doc.hasItem(StringCache.FIELD_CONFLICT)){
this.processConflict(doc);
}
temp = view.getNextDocument(doc);
doc.recycle();
doc = temp;
}
view.setAutoUpdate(true);
} catch (NotesException e) {
LOG.log(Level.SEVERE,null,e);
}finally{
super.closeSession(session);
}
}
示例9: writeMimeOutput
import lotus.domino.Document; //导入方法依赖的package包/类
private void writeMimeOutput(Document document, String itemName, Writer writer)
throws NotesException, IOException {
MIMEEntity mimeEntity = null;
MIMEEntity mChild = null;
String contenttype = null;
String headers = null;
MimeEntityHelper helper = null;
if (!document.hasItem(itemName)) {
// SPR# WJBJ9PE86G: The body item doesn't exist, so create one now
mimeEntity = document.createMIMEEntity(itemName);
}
else {
helper = new MimeEntityHelper(document, itemName);
mimeEntity = helper.getFirstMimeEntity();
if (mimeEntity == null) {
throw new NullPointerException("Invalid item."); // $NLX-MimeMessageGenerator_InvalidItem-1$
}
}
try {
contenttype = mimeEntity.getContentType();
headers = mimeEntity.getHeaders();
// TODO: Is there a better way to output the headers?
if (!headers.startsWith("MIME-Version:")) { //$NON-NLS-1$
writer.write("MIME-Version: 1.0"); //$NON-NLS-1$
}
// Write MIMEEntity.
writeMimeEntity(writer, mimeEntity);
if (contenttype.startsWith(MULTIPART)) {
mChild = mimeEntity.getFirstChildEntity();
while (mChild != null) {
// Write MIMEEntity.
writeMimeEntity(writer, mChild);
MIMEEntity mChild2 = mChild.getFirstChildEntity();
if (mChild2 == null) {
mChild2 = mChild.getNextSibling();
if (mChild2 == null) {
mChild2 = mChild.getParentEntity();
if (mChild2 != null)
mChild2 = mChild2.getNextSibling();
}
}
mChild.recycle();
mChild = mChild2;
}
}
writer.write(mimeEntity.getBoundaryEnd());
} finally {
if (helper != null) {
helper.recycle();
}
}
}