本文整理汇总了Java中lotus.domino.Document.getFirstItem方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getFirstItem方法的具体用法?Java Document.getFirstItem怎么用?Java Document.getFirstItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Document
的用法示例。
在下文中一共展示了Document.getFirstItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDateField
import lotus.domino.Document; //导入方法依赖的package包/类
public static Calendar getDateField(Document doc, String fieldName) throws NotesException {
Calendar result=null;
Item someItem=null;
DateTime someDate=null;
try {
someItem=doc.getFirstItem(fieldName);
if(null != someItem && someItem.getType()==Item.DATETIMES) {
someDate=someItem.getDateTimeValue();
result=Calendar.getInstance();
result.setTime(someDate.toJavaDate());
}
return result;
} catch(NotesException ne) {
throw ne;
} finally {
recycleObjects(someItem, someDate);
}
}
示例2: getContent
import lotus.domino.Document; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<String> getContent() {
Database db = null;
Document doc = null;
Item item = null;
try {
db = NotesObjects.getDatabaseAsSigner(filename);
doc = NotesObjects.getDocumentById(db, noteid);
if (doc != null) {
item = doc.getFirstItem("EventList");
return new ArrayList<String>(item.getValues());
}
return null;
} catch (NotesException e) {
log.error(e);
return null;
} finally {
NotesObjects.incinerate(item, doc, db);
}
}
示例3: buildMessage
import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch(time=50)
public SocketMessage buildMessage(Document doc){
SocketMessage msg = null;
try{
RichTextItem rtitem = (RichTextItem) doc.getFirstItem(Const.FIELD_JSON);
String json = null;
if(doc.hasEmbedded()){
json = this.scanForAttachedJson(rtitem);
}else{
json = rtitem.getUnformattedText();
}
msg = JSONUtils.toObject(json, SocketMessage.class);
if(msg==null){
return new SocketMessage();//return empty invalid message.
}
}catch(Exception e){
LOG.log(Level.SEVERE,null, e);
try{
doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
doc.replaceItemValue(Const.FIELD_ERROR, e.getMessage());
doc.save();
}catch(NotesException n){
LOG.log(Level.SEVERE,null, n);
}
}
return msg;
}
示例4: loadProps
import lotus.domino.Document; //导入方法依赖的package包/类
public static Properties loadProps(Document doc, String fieldName){
Properties props=new Properties();
InputStream in = null;
Item item = null;
try{
if(doc==null) return props;
//make sure the field is multi-value,
//and uses new lines between each value.
item = doc.getFirstItem(fieldName);
if(item==null){
return props;
}
String data = item.getText().replace(';','\n');
in = new ByteArrayInputStream(data.getBytes());
props.load(in);
item.recycle();
}catch(Exception e){
//replace with your own logger.
logger.log(Level.SEVERE,null,e);
}finally{
IOUtils.closeQuietly(in);
}
return props;
}