• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RichTextItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: scanForAttachedJson

import lotus.domino.RichTextItem; //导入依赖的package包/类
/**
 * Scan for attached json.
 *
 * @param rtitem the rtitem
 * @return the string
 * @throws NotesException the notes exception
 */
private String scanForAttachedJson(RichTextItem rtitem)throws NotesException{
	String json = null;
	@SuppressWarnings("unchecked")
	Vector<EmbeddedObject> objects = rtitem.getEmbeddedObjects();
	for(EmbeddedObject eo: objects){
		if(eo.getName().toLowerCase().endsWith(StringCache.DOT_JSON)){
			InputStream in = eo.getInputStream();
			try {
				json = IOUtils.toString(in,StringCache.UTF8);
				int start = json.indexOf(StringCache.OPEN_CURLY_BRACE);
				int end = json.lastIndexOf(StringCache.CLOSE_CURLY_BRACE);
				json=json.substring(start,end) + StringCache.CLOSE_CURLY_BRACE;
			} catch (IOException e) {
				LOG.log(Level.SEVERE,null,e);
			}finally{
				IOUtils.closeQuietly(in);
				eo.recycle();
				eo = null;
			}
		}
	}
	return json;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:31,代码来源:SocketMessageFactory.java


示例2: attach

import lotus.domino.RichTextItem; //导入依赖的package包/类
/**
 * Attach.
 *
 * @param doc the doc
 * @param msg the msg
 */
private void attach(Document doc, SocketMessage msg){
	File file = JSONUtils.write(msg);
	try{
		RichTextItem rtitem = doc.createRichTextItem("json");
		EmbeddedObject eo = rtitem.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, file.getAbsolutePath(), Const.ATTACH_NAME);
		doc.save();

		//cleanup.
		eo.recycle();
		rtitem.recycle();
	}catch(Exception e){
		LOG.log(Level.SEVERE,null,e);

	}finally{
		if(file!=null && file.exists()){
			file.delete();
		}
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:26,代码来源:QueueMessage.java


示例3: publish

import lotus.domino.RichTextItem; //导入依赖的package包/类
@Override
public void publish(LogRecord logEvent) {
	if (m_Level.intValue() > logEvent.getLevel().intValue()) {
		return;
	}
	try {
		Session sesCurrent = ExtLibUtil.getCurrentSessionAsSigner();
		Database ndbCurrent = sesCurrent.getCurrentDatabase();
		Document docLog = ndbCurrent.createDocument();
		docLog.replaceItemValue("form", "frmLog");
		docLog.replaceItemValue("sevn", logEvent.getLevel().intValue());
		docLog.replaceItemValue("SRCNAME", m_CallerClass);
		docLog.replaceItemValue("ERRORMSG", logEvent.getMessage());
		if (logEvent.getThrown() != null) {
			Throwable trCurrent = logEvent.getThrown();
			StringWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			trCurrent.printStackTrace(pw);
			RichTextItem rtCurrent = docLog.createRichTextItem("BodyRT");
			rtCurrent.appendText(sw.toString());
		}
		docLog.save(true, false, true);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OpenNTF,项目名称:myWebGate-Scrum,代码行数:27,代码来源:DominoHandler.java


示例4: writeException

import lotus.domino.RichTextItem; //导入依赖的package包/类
private void writeException(Exception exCurrent, Document docJob) {
	Document docEx;
	try {
		docEx = docJob.getParentDatabase().createDocument();
		docEx.replaceItemValue("form", "frmException");
		docEx.replaceItemValue("MessageT", exCurrent.getMessage());
		docEx.replaceItemValue("JobIDT", m_JobID);
		if (exCurrent instanceof SQLConnectorException) {
			docEx.replaceItemValue("EventIDN",
					((SQLConnectorException) exCurrent).getEventNr());
		}
		docEx.makeResponse(docJob);
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		exCurrent.printStackTrace(pw);
		RichTextItem rtCurrent = docEx.createRichTextItem("BodyRT");
		rtCurrent.appendText(sw.toString());
		docEx.save(true, false, true);
	} catch (NotesException e) {
		e.printStackTrace();
	}
}
 
开发者ID:OpenNTF,项目名称:SyncTool4DOTS,代码行数:23,代码来源:JobDefinition.java


示例5: attach

import lotus.domino.RichTextItem; //导入依赖的package包/类
private void attach(Document doc, SocketMessage msg){
	File file = JSONUtils.write(msg);
	try{
		RichTextItem rtitem = doc.createRichTextItem("json");
		EmbeddedObject eo = rtitem.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, file.getAbsolutePath(), Const.ATTACH_NAME);
		doc.save();

		//cleanup.
		eo.recycle();
		rtitem.recycle();
	}catch(Exception e){
		logger.log(Level.SEVERE,null,e);

	}finally{
		if(file!=null && file.exists()){
			file.delete();
		}
	}

}
 
开发者ID:mwambler,项目名称:webshell-xpages-ext-lib,代码行数:21,代码来源:QueueMessage.java


示例6: scanForAttachedJson

import lotus.domino.RichTextItem; //导入依赖的package包/类
private String scanForAttachedJson(RichTextItem rtitem)throws NotesException{
	String json = null;
	@SuppressWarnings("unchecked")
	Vector<EmbeddedObject> objects = rtitem.getEmbeddedObjects();
	for(EmbeddedObject eo: objects){
		if(eo.getName().toLowerCase().endsWith(".json")){
			InputStream in = eo.getInputStream();
			try {
				json = IOUtils.toString(in,"UTF-8");
				int start = json.indexOf('{');
				int end = json.lastIndexOf('}');
				json=json.substring(start,end) + "}";
			} catch (IOException e) {
				logger.log(Level.SEVERE,null,e);
			}finally{
				IOUtils.closeQuietly(in);
				eo.recycle();
				eo = null;
			}
		}
	}
	return json;
}
 
开发者ID:mwambler,项目名称:webshell-xpages-ext-lib,代码行数:24,代码来源:SocketMessageFactory.java


示例7: buildDocument

import lotus.domino.RichTextItem; //导入依赖的package包/类
public Document buildDocument(HttpServletRequest req, Database db, File file) throws NotesException{
	Document doc = db.createDocument();
	int lastSlash = req.getContextPath().lastIndexOf("/");
	String type = req.getContextPath().substring(lastSlash,req.getContextPath().length());
	
	doc.replaceItemValue("type", type);
	doc.replaceItemValue("Form", "fmUpload");
	doc.replaceItemValue("author", ContextInfo.getUserSession().getEffectiveUserName());
	doc.replaceItemValue("contextPath", req.getContextPath());
	doc.replaceItemValue("author", db.getParent().getEffectiveUserName());
	
	RichTextItem rtitem = doc.createRichTextItem(WebshellConstants.FIELD_ATTACHMENTS);
	rtitem.embedObject(EmbeddedObject.EMBED_ATTACHMENT,null, file.getAbsolutePath(), file.getName());

	return doc;
}
 
开发者ID:mwambler,项目名称:webshell-xpages-ext-lib,代码行数:17,代码来源:DocFactory.java


示例8: buildMessage

import lotus.domino.RichTextItem; //导入依赖的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;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:33,代码来源:SocketMessageFactory.java


示例9: onOpenOrClose

import lotus.domino.RichTextItem; //导入依赖的package包/类
/**
 * On open or close.
 *
 * @param fun the fun
 */
private void onOpenOrClose(String fun){
	Session session = null;
	try{
		session = this.openSession();
		Database db = session.getDatabase(StringCache.EMPTY, dbPath());

		Document doc = db.createDocument();

		IUser user = (IUser) this.args[0];

		doc.replaceItemValue("userId",user.getUserId());
		doc.replaceItemValue("sessionId",user.getSessionId());
		doc.replaceItemValue("host",user.getHost());
		doc.replaceItemValue("status",user.getStatus());
		doc.replaceItemValue("uris",ColUtils.toVector(user.getUris()));
		doc.replaceItemValue(FUNCTION, fun);

		RichTextItem item = doc.createRichTextItem("Body");
		item.appendText(JSONUtils.toJson(user));
		doc.replaceItemValue("Form", user.getClass().getName());

		Agent agent = db.getAgent(StrUtils.rightBack(this.getSource(), "/"));
		agent.runWithDocumentContext(doc);


	}catch(NotesException n){
		
		LOG.log(Level.SEVERE, null, n);
	}finally{
		this.closeSession(session);
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:39,代码来源:AgentScript.java


示例10: onMessage

import lotus.domino.RichTextItem; //导入依赖的package包/类
/**
 * On message.
 */
private void onMessage(){
	Session session = null;
	try{
		session = this.openSession();
		Database db = session.getDatabase(StringCache.EMPTY, dbPath());

		Document doc = db.createDocument();

		SocketMessage msg = (SocketMessage) this.args[0];

		doc.replaceItemValue(FUNCTION, Const.ON_MESSAGE);
		doc.replaceItemValue("from", msg.getFrom());
		doc.replaceItemValue("to", msg.getTo());
		doc.replaceItemValue("text", msg.getText());
		doc.replaceItemValue(EVENT, Const.ON_MESSAGE);
		doc.replaceItemValue("targets", ColUtils.toVector(msg.getTargets()));

		RichTextItem item = doc.createRichTextItem("Body");
		item.appendText(msg.toJson());
		doc.replaceItemValue("Form", SocketMessage.class.getName());

		Agent agent = db.getAgent(StrUtils.rightBack(this.getSource(), "/"));
		agent.runWithDocumentContext(doc);



	}catch(NotesException n){
		
		LOG.log(Level.SEVERE, null, n);
	}finally{
		this.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:37,代码来源:AgentScript.java


示例11: attach

import lotus.domino.RichTextItem; //导入依赖的package包/类
public static void attach(File file, Document doc, String field) throws IOException, NotesException{
	RichTextItem item = getRichText(doc, field);
	item.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, file.getAbsolutePath(), file.getName());
	doc.save();
	item.recycle();
	file.delete();
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:8,代码来源:AttachUtils.java


示例12: removeFile

import lotus.domino.RichTextItem; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void removeFile(FileHelper fh) {
	try {
		Database ndbCurrent = ExtLibUtil.getCurrentSession().getDatabase(
				fh.getServer(), fh.getPath());
		if (ndbCurrent == null)
			return;
		Document docCurrent = ndbCurrent.getDocumentByUNID(fh.getDocID());
		if (docCurrent == null){
			ndbCurrent.recycle();
			return;
		}
		// RESULTS IN NOTE ITEM NOT FOUND ERROR AFTERWARDS
		// EmbeddedObject entity = docCurrent.getAttachment(fh.getName());
		// if (entity == null)
		// return;
		// entity.remove();

		RichTextItem rti = (RichTextItem) docCurrent.getFirstItem(fh
				.getFieldName());
		Vector<EmbeddedObject> entitys = rti.getEmbeddedObjects();

		for (EmbeddedObject entity : entitys) {
			if (entity.getType() == EmbeddedObject.EMBED_ATTACHMENT) {
				if (entity.getName().equals(fh.getName())) {
					entity.remove();
					break;
				}
			}
		}
		docCurrent.save(true, false, true);
		
		rti.recycle();
		docCurrent.recycle();
		ndbCurrent.recycle();
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OpenNTF,项目名称:myWebGate-Scrum,代码行数:41,代码来源:FileService.java


示例13: sendLink

import lotus.domino.RichTextItem; //导入依赖的package包/类
public static boolean sendLink(String strURL, String strID, List<String> sendTo, String strComment, Session sesCurrent) {
	try {
		Document docMail = sesCurrent.getCurrentDatabase().createDocument();
		docMail.replaceItemValue("SendTo", sendTo);
		docMail.replaceItemValue("Subject", sesCurrent.getCurrentDatabase().getTitle() + ": please check this link");
		
		RichTextItem rtiBody = docMail.createRichTextItem("Body");
		
		IScrumDocument doc = ScrumDocumentSessionFacade.get().getDocumentById(strID);
		if (doc != null) {
			rtiBody.appendText("Project: " + doc.getProject());
			rtiBody.addNewLine(1);
			rtiBody.appendText("Type: " + doc.getForm());
			rtiBody.addNewLine(1);
			rtiBody.appendText("Subject: " + doc.getSubject());
			rtiBody.addNewLine(2);
		}
		
		rtiBody.appendText("" + strURL);
		rtiBody.addNewLine(2);
		rtiBody.appendText(strComment);
		
		docMail.send(false);			
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	return true;
}
 
开发者ID:OpenNTF,项目名称:myWebGate-Scrum,代码行数:30,代码来源:MailerFactory.java


示例14: reportMsg

import lotus.domino.RichTextItem; //导入依赖的package包/类
private void reportMsg(SimpleDateFormat sdfCurrent, RichTextItem rtReport,
		String strMsg) {
	try {
		rtReport.appendText(sdfCurrent.format(new Date()) + " " + strMsg);
		rtReport.addNewLine();
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:OpenNTF,项目名称:SyncTool4DOTS,代码行数:10,代码来源:JobDefinition.java


示例15: buildDocument

import lotus.domino.RichTextItem; //导入依赖的package包/类
@Override
public Document buildDocument(Database db, File file, String form, String attachmentField) throws NotesException {
	Document doc = db.createDocument();
	doc.replaceItemValue("Form", form);
	doc.replaceItemValue("author", ContextInfo.getUserSession().getEffectiveUserName());
	RichTextItem rtitem = doc.createRichTextItem(attachmentField);
	rtitem.embedObject(EmbeddedObject.EMBED_ATTACHMENT,null, file.getAbsolutePath(), file.getName());
	doc.save();
	return doc;
}
 
开发者ID:mwambler,项目名称:webshell-xpages-ext-lib,代码行数:11,代码来源:DocFactory.java


示例16: buildMessage

import lotus.domino.RichTextItem; //导入依赖的package包/类
@Profiled
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.
		}


		msg.setJson(json);//so we don't have to re-serialize...

	}catch(Exception e){
		logger.log(Level.SEVERE,null, e);
		try{
			doc.replaceItemValue("sentFlag", -1);
			doc.replaceItemValue("error", e.getMessage());
			doc.save();
		}catch(NotesException n){
			logger.log(Level.SEVERE,null, n);
		}
	}
	return msg;
}
 
开发者ID:mwambler,项目名称:webshell-xpages-ext-lib,代码行数:35,代码来源:SocketMessageFactory.java


示例17: processDomino2Java

import lotus.domino.RichTextItem; //导入依赖的package包/类
public void processDomino2Java(Document docCurrent, Object objCurrent, String strNotesField, String strJavaField, HashMap<String, Object> addValues) {
	try {
		MimeMultipart strValue = null;
		Method mt = objCurrent.getClass().getMethod("set" + strJavaField, MimeMultipart.class);

		MIMEEntity entity = docCurrent.getMIMEEntity(strNotesField);
		if (entity != null) {
			strValue = MimeMultipart.fromHTML(entity.getContentAsText());
		} else if (docCurrent.hasItem(strNotesField)) {

			if (docCurrent.getFirstItem(strNotesField) != null) {
				if (docCurrent.getFirstItem(strNotesField).getType() != 1) {
					strValue = MimeMultipart.fromHTML(docCurrent.getItemValueString(strNotesField));
				} else {
					RichTextItem rti = (RichTextItem) docCurrent.getFirstItem(strNotesField);
					if (rti != null) {

						HttpServletRequest rq = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
						String curURL = rq.getRequestURL().toString();
						String docid = docCurrent.getUniversalID();

						String notesURL = curURL.substring(0, curURL.indexOf(rq.getContextPath()) + 1) + docCurrent.getParentDatabase().getFilePath() + "/0/" + docid + "/" + strNotesField
								+ "?OpenField";

						URL docURL = new URL(notesURL);
						URLConnection uc = docURL.openConnection();

						uc.setRequestProperty("Cookie", rq.getHeader("Cookie"));
						uc.connect();

						// do the HTTP request
						BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream(), "UTF-8"));

						// process the data returned
						StringBuffer strBuf = new StringBuffer();
						String tmpStr = "";
						while ((tmpStr = in.readLine()) != null) {
							strBuf.append(tmpStr);
						}

						strValue = MimeMultipart.fromHTML(strBuf.toString());

					}
				}
			}
		}
		mt.invoke(objCurrent, strValue);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OpenNTF,项目名称:myWebGate-Scrum,代码行数:52,代码来源:MimeMultipartBinder.java


示例18: checkLoad

import lotus.domino.RichTextItem; //导入依赖的package包/类
public void checkLoad() {
	if (m_Content != null) {
		return;
	}
	try {
		Database ndbCurrent = NotesContext.getCurrentUnchecked().getCurrentSession().getDatabase(m_Server, m_Database);
		if (ndbCurrent == null) {
			throw new XPTRuntimeException("Database "+ m_Server +"!!"+m_Database +" not accessable");
		}
		Document docCurrent = ndbCurrent.getDocumentByUNID(m_DocumentUNID);
		if (docCurrent == null) {
			throw new XPTRuntimeException("Document "+ m_Server +"!!"+m_Database +"/"+ m_DocumentUNID+" not accessable");
			
		}
		MIMEEntity mimeCurrent = docCurrent.getMIMEEntity(m_FieldName);
		if (mimeCurrent == null && !docCurrent.hasItem(m_FieldName)) {
			m_Content = MimeMultipart.fromHTML("");
			return;
		}
		if (mimeCurrent == null && docCurrent.hasItem(m_FieldName)) {
			if (docCurrent.getFirstItem(m_FieldName) != null) {
				Item itField = docCurrent.getFirstItem(m_FieldName);
				if (itField.getType() != 1) {
					m_Content = MimeMultipart.fromHTML(docCurrent.getItemValueString(m_FieldName));
				} else {
					RichTextItem rti = (RichTextItem) itField;
					if (rti != null) {
						DominoDocument dd = new DominoDocument();
						dd.setDocument(docCurrent);
						DominoRichTextItem drtCurrent = new DominoRichTextItem(dd, rti);
						m_Content = MimeMultipart.fromHTML(drtCurrent.getHTML());
					}
				}
				itField.recycle();
			}
			docCurrent.recycle();
			ndbCurrent.recycle();
		}
		processMime(mimeCurrent);
	} catch (Exception ex) {
		LoggerFactory.logError(this.getClass(), "Error druing checkLoad()", ex);
		throw new XPTRuntimeException("General Error with: Database "+ m_Server +"!!"+m_Database +" / Field: "+ m_FieldName +" / "+m_DocumentUNID);
	}
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:45,代码来源:MimeMultiPartExtended.java


示例19: onError

import lotus.domino.RichTextItem; //导入依赖的package包/类
/**
 * On error.
 */
private void onError(){
	Session session = null;
	try{
		session = this.openSession();
		Database db = session.getDatabase(StringCache.EMPTY, dbPath());

		Document doc = db.createDocument();

		IUser user = (IUser) this.args[0];

		Exception e = (Exception) args[0];

		e.printStackTrace();

		doc.replaceItemValue("error", e.getMessage() );
		doc.replaceItemValue(FUNCTION, Const.ON_ERROR);

		RichTextItem item = doc.createRichTextItem("Body");
		item.appendText(JSONUtils.toJson(user));
		doc.replaceItemValue("Form", user.getClass().getName());


		Agent agent = db.getAgent(StrUtils.rightBack(this.getSource(), "/"));
		agent.runWithDocumentContext(doc);


	}catch(NotesException n){
		
		LOG.log(Level.SEVERE, null, n);
	}finally{
		this.closeSession(session);
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:38,代码来源:AgentScript.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SOAPHeader类代码示例发布时间:2022-05-22
下一篇:
Java Editor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap