当前位置: 首页>>代码示例>>Java>>正文


Java Item.MIME_PART属性代码示例

本文整理汇总了Java中lotus.domino.Item.MIME_PART属性的典型用法代码示例。如果您正苦于以下问题:Java Item.MIME_PART属性的具体用法?Java Item.MIME_PART怎么用?Java Item.MIME_PART使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在lotus.domino.Item的用法示例。


在下文中一共展示了Item.MIME_PART属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateMimePart

private void updateMimePart(String itemName, JsonJavaObject jsonObject) throws NotesException, JsonException {
	
	if ( document.hasItem(itemName) ) {
		Item item = document.getFirstItem(itemName);
		if ( item.getType() == Item.MIME_PART ) {
			
			// SPR #JJVX8RGJZG:  When updating _existing_ MIME parts, we were
			// leaving old attachments around.  The fix is to explicitly remove
			// the parts first.
			
			MIMEEntity entity = item.getMIMEEntity();
			entity.remove();
			document.closeMIMEEntities(true, itemName);
		}
	}
	
    Object jsonMime =  jsonObject.get(ATTR_CONTENT);
	List<JsonJavaObject> parts = (List<JsonJavaObject>)jsonMime;
	ParserContext context = new ParserContext(document, itemName);
	for ( int i = 0; i < parts.size(); i++ ) {
		JsonJavaObject obj = parts.get(i);
		boolean lastEntity = false;
		if ( (i+1) == parts.size() ) {
			lastEntity = true;
		}
		
		JsonMimeEntityAdapter adapter = new JsonMimeEntityAdapter(context, obj);
		context.setCurrentEntityAdapter(adapter);
		adapter.flushJsonProperties(lastEntity);
	}
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:31,代码来源:JsonDocumentContent.java

示例2: writeItem

protected void writeItem(JsonWriter jsonWriter, Item item, String propName) 
        throws NotesException, IOException, ServiceException {        
    String itemName = item.getName();
    int itemType = item.getType();
    
    if (itemType == Item.OTHEROBJECT) {
        // Skip Other Object Types
    }
    else if (itemType == Item.ATTACHMENT) {
        // Skip Attachment Types
    }
    else if (itemType == Item.NOTELINKS) {
        // Skip Note Links Types
    }
    else if (itemType == Item.SIGNATURE) {
        // Skip Signature Types
    }       
    else if (itemType == Item.RICHTEXT) {
        if (writtenRichTextItems == null) {
            writtenRichTextItems = new HashSet<String>();
        }
        if (!writtenRichTextItems.contains(itemName)) {
            writtenRichTextItems.add(itemName);
            writeRichTextItem(jsonWriter, item, propName);      
        }
    } 
    else if (itemType == Item.MIME_PART) {
        if (writtenMimeItems == null) {
            writtenMimeItems = new HashSet<String>();
        }
        if (!writtenMimeItems.contains(itemName)) {
            writtenMimeItems.add(itemName);
            writeRichTextItem(jsonWriter, item, propName);      
        }
    } 
    else {
        Vector<?> values = item.getValues();
        if (values != null && values.size() != 0) {
            if (values.size() == 1) {                           
                writeProperty(jsonWriter, propName, values.get(0));
            } else {
                writeProperty(jsonWriter, propName, values);
            }
        }
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:46,代码来源:JsonDocumentContent.java

示例3: getFirstMimeEntity

public MIMEEntity getFirstMimeEntity(boolean ignoreForm) throws NotesException {
	
	if ( _mimeEntity == null ) {

		Database database = _document.getParentDatabase();
		Session session = database.getParent();
		boolean restoreConvertMime = false;
		
		if (session.isConvertMime()) {
			// Do not convert MIME to rich text.
			session.setConvertMIME(false);
			restoreConvertMime = true;
		}
		
		try {
			Item item = _document.getFirstItem(_itemName);
			if (item != null) {
				if (item.getType() == Item.RICHTEXT) {
					if ( ITEM_BODY.equalsIgnoreCase(_itemName) && !ignoreForm) {
						_document.removeItem("$KeepPrivate"); //$NON-NLS-1$
						_document.convertToMIME(lotus.domino.Document.CVT_RT_TO_PLAINTEXT_AND_HTML, 0);
						_mimeEntity = _document.getMIMEEntity(_itemName);
					}
					else {
						_tempDocument = database.createDocument();
						_tempDocument.copyItem(item, ITEM_BODY);	
						_tempDocument.convertToMIME(lotus.domino.Document.CVT_RT_TO_PLAINTEXT_AND_HTML, 0);
						_mimeEntity = _tempDocument.getMIMEEntity(ITEM_BODY);	
					}
				} 
				else if (item.getType() == Item.MIME_PART) {
					_mimeEntity = _document.getMIMEEntity(_itemName);
				}
			}
		}
		finally {
			if (restoreConvertMime) {
				session.setConvertMime(true);
			}
		}
	}

	return _mimeEntity;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:44,代码来源:MimeEntityHelper.java


注:本文中的lotus.domino.Item.MIME_PART属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。