本文整理汇总了Java中lotus.domino.EmbeddedObject类的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedObject类的具体用法?Java EmbeddedObject怎么用?Java EmbeddedObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmbeddedObject类属于lotus.domino包,在下文中一共展示了EmbeddedObject类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: scanForAttachedJson
import lotus.domino.EmbeddedObject; //导入依赖的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.EmbeddedObject; //导入依赖的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: removeAll
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void removeAll(Document doc) throws NotesException{
boolean save = false;
Vector<String> attachments = doc.getParentDatabase().getParent().evaluate("@AttachmentNames", doc);
for(String attach : attachments){
EmbeddedObject eo = doc.getAttachment(attach);
if(eo!=null && eo.getType() == EmbeddedObject.EMBED_ATTACHMENT){
eo.remove();
save = true;
}//end if
}//end for
//only save if we need to.
if(save) {
doc.save();
}
}
开发者ID:mwambler,项目名称:xockets.io,代码行数:21,代码来源:AttachUtils.java
示例4: attach
import lotus.domino.EmbeddedObject; //导入依赖的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
示例5: scanForAttachedJson
import lotus.domino.EmbeddedObject; //导入依赖的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
示例6: buildDocument
import lotus.domino.EmbeddedObject; //导入依赖的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
示例7: remove
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
public static void remove(Document doc, String attachmentName) throws NotesException{
EmbeddedObject eo = doc.getAttachment(attachmentName);
if(eo!=null){
eo.remove();
doc.save();
}
}
开发者ID:mwambler,项目名称:xockets.io,代码行数:8,代码来源:AttachUtils.java
示例8: attach
import lotus.domino.EmbeddedObject; //导入依赖的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
示例9: getFileSteam
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
public InputStream getFileSteam(FileHelper fh) {
try {
Database ndbCurrent = ExtLibUtil.getCurrentSession().getDatabase(
fh.getServer(), fh.getPath());
if (ndbCurrent == null)
return null;
Document docCurrent = ndbCurrent.getDocumentByUNID(fh.getDocID());
if (docCurrent == null){
ndbCurrent.recycle();
return null;
}
EmbeddedObject entity = docCurrent.getAttachment(fh.getName());
if (entity == null){
ndbCurrent.recycle();
docCurrent.recycle();
return null;
}
InputStream is = entity.getInputStream();
entity.recycle();
docCurrent.recycle();
ndbCurrent.recycle();
return is;// entity.getInputStream();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
开发者ID:OpenNTF,项目名称:myWebGate-Scrum,代码行数:32,代码来源:FileService.java
示例10: removeFile
import lotus.domino.EmbeddedObject; //导入依赖的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
示例11: getStream
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
/**
* @see biz.taoconsulting.dominodav.resource.DAVAbstractResource#getStream()
* Originally I tried EmbeddedObject.getInputStream(); but that didn't
* go down well with the servlet, so now I use a temp file approach
* where an attachment is stored into a temp file and then served to
* the servlet as fileinput stream
*/
public InputStream getStream() {
Session s = null;
InputStream curStream = null;
String notesURL = this.getInternalAddress();
Document curDoc = null;
s = DominoProxy.getUserSession();
if (s != null) {
try {
// We need to find the $File to isolate the document
int dollarFile = notesURL.lastIndexOf("/$File");
if (dollarFile < 0) {
// This is not an attachment
return null;
}
String docURL = notesURL.substring(0, dollarFile);
curDoc = (Document) s.resolve(docURL);
String curAttName = this.getName();
EmbeddedObject curAttachment = curDoc.getAttachment(curAttName);
File tempFile = this.getTempfile();
// Delete if it exists
if (tempFile.exists()) {
tempFile.delete();
}
curAttachment.extractFile(tempFile.getAbsolutePath());
curStream = new AttachmentInputStream(tempFile, this);
} catch (Exception e) {
LOGGER.error(e);
}
}
return curStream;
}
开发者ID:OpenNTF,项目名称:WebDAVForDomino,代码行数:43,代码来源:DAVResourceDominoAttachments.java
示例12: buildDocument
import lotus.domino.EmbeddedObject; //导入依赖的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
示例13: getAttachmentResource
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
/**
* Create a Attachment resource for an attachment inside of a document
*
* @param s
* @param curDoc
* @param curAttName
* @return
*/
private DAVResourceDominoAttachments getAttachmentResource(
boolean readOnly, Document curDoc, String curAttName) {
LOGGER.debug("Retrieving attachment [" + curAttName + "]");
EmbeddedObject curAttachment = null;
DAVResourceDominoAttachments curRes = null;
try {
curAttachment = curDoc.getAttachment(curAttName);
if (curAttachment == null) {
return null;
}
String docID = curDoc.getUniversalID();
Date curCreationDate = curDoc.getCreated().toJavaDate();
Date curChangeDate = curDoc.getLastModified().toJavaDate();
Long curSize = new Long(curAttachment.getFileSize());
String curName = curAttachment.getName();
String curInternalPath = docID + "/$File/"
+ curAttachment.getName();
// We hide the $File from external resources
String curExternalPath = docID + "/" + curAttachment.getName();
LOGGER.debug("Processing Attachment " + curName + " ("
+ curInternalPath + ")");
// Now the repository
String pubHRef = ((IDAVAddressInformation) this.getRepository())
.getPublicHref() + "/" + curExternalPath;
curRes = new DAVResourceDominoAttachments(this.getRepository());
curRes.setPublicHref(pubHRef);
curRes.setMember(true);
curRes.setName(curName);
curRes.setInternalAddress(((IDAVAddressInformation) this
.getRepository()).getInternalAddress()
+ "/"
+ curInternalPath);
curRes.setOwner(this.getRepository());
curRes.setResourceType("NotesAttachment");
curRes.setCreationDate(curCreationDate);
curRes.setLastModified(curChangeDate);
curRes.setContentLength(curSize);
curRes.setReadOnly(readOnly);
} catch (NotesException e) {
LOGGER.error(e);
}
return curRes;
}
开发者ID:OpenNTF,项目名称:WebDAVForDomino,代码行数:57,代码来源:DAVResourceDominoAttachments.java
示例14: getStream
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
/**
* @see biz.taoconsulting.dominodav.resource.DAVAbstractResource#getStream()
* Originally I tried EmbeddedObject.getInputStream(); but that didn't
* go down well with the servlet, so now I use a temp file approach
* where an attachment is stored into a temp file and then served to
* the servlet as fileinput stream
*/
public InputStream getStream() {
Session s = null;
InputStream curStream = null;
String notesURL = this.getInternalAddress();
// LOGGER.info("NotesUrl="+notesURL);
Document curDoc = null;
s = DominoProxy.getUserSession();
if (s != null) {
try {
// We need to find the $File to isolate the document
int dollarFile = notesURL.lastIndexOf("/$File");
if (dollarFile < 0) {
// This is not an attachment
return null;
}
String docURL = notesURL.substring(0, dollarFile);
// LOGGER.info("docURL="+docURL);
curDoc = (Document) s.resolve(docURL);
String curAttName = this.getName();
curAttName = java.net.URLDecoder.decode(curAttName, "utf-8");
// LOGGER.info("curAttName="+curAttName);
EmbeddedObject curAttachment = curDoc.getAttachment(curAttName);
if (curAttachment == null) {
LOGGER.info("Attachment is null");
}
File tempFile = this.getTempfile();
// Delete if it exists
if (tempFile.exists()) {
tempFile.delete();
}
curAttachment.extractFile(tempFile.getAbsolutePath());
LOGGER.info("Current attachment path extracted is ="
+ tempFile.getAbsolutePath());
curStream = new DocumentInputStream(tempFile, this);
} catch (Exception e) {
LOGGER.error(e);
}
}
return curStream;
}
开发者ID:OpenNTF,项目名称:WebDAVForDomino,代码行数:53,代码来源:DAVResourceDominoDocuments.java
示例15: getStream
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
/**
* @see biz.taoconsulting.dominodav.resource.DAVAbstractResource#getStream()
* Originally I tried EmbeddedObject.getInputStream(); but that didn't
* go down well with the servlet, so now I use a temp file approach
* where an attachment is stored into a temp file and then served to
* the servlet as fileinput stream
*/
public InputStream getStream() {
Session s = null;
InputStream curStream = null;
String notesURL = this.getInternalAddress();
// LOGGER.info("NotesUrl="+notesURL);
Document curDoc = null;
s = DominoProxy.getUserSession();
if (s != null) {
try {
// We need to find the $File to isolate the document
int dollarFile = notesURL.lastIndexOf("/$File");
if (dollarFile < 0) {
// This is not an attachment
return null;
}
String docURL = notesURL.substring(0, dollarFile);
LOGGER.info("docURL=" + docURL);
curDoc = (Document) s.resolve(docURL);
String curAttName = this.getName();
curAttName = java.net.URLDecoder.decode(curAttName, "utf-8");
LOGGER.info("curAttName=" + curAttName);
EmbeddedObject curAttachment = curDoc.getAttachment(curAttName);
if (curAttachment == null) {
LOGGER.info("�ttachment is null");
}
File tempFile = this.getTempfile();
// Delete if it exists
if (tempFile.exists()) {
tempFile.delete();
}
curAttachment.extractFile(tempFile.getAbsolutePath());
LOGGER.info("Current attachment path extracted is ="
+ tempFile.getAbsolutePath());
curStream = new CategorizedDocumentInputStream(tempFile, this);
} catch (Exception e) {
LOGGER.error(e);
}
}
return curStream;
}
开发者ID:OpenNTF,项目名称:WebDAVForDomino,代码行数:52,代码来源:DAVResourceDominoCategorizedDocuments.java
示例16: buildConfig
import lotus.domino.EmbeddedObject; //导入依赖的package包/类
private AppConfig buildConfig(Document docCfg){
InputStream in =null;
AppConfig cfg = new AppConfig();
try{
Session session = docCfg.getParentDatabase().getParent();
@SuppressWarnings("unchecked")
Vector<String> attachments = session.evaluate("@AttachmentNames",docCfg);
//find the .p12 attachment and load up the bytes
for(String a : attachments){
if(a.endsWith(".p12")){
EmbeddedObject eo = docCfg.getAttachment(a);
in = eo.getInputStream();
cfg.setApnKeyStore(IOUtils.toByteArray(eo.getInputStream()));
}
}
//set the appId.
cfg.setAppId(docCfg.getItemValueString("appId"));
//password used to authenticate to the APN, it is used w/ the .p12 certificate
cfg.setApnPassword(docCfg.getItemValueString("apnPassword"));
//set to determine which APN to target (TEST, or PROD)
cfg.setApnProd(new Boolean (docCfg.getItemValueString("apnProd")));
//set the app title.
cfg.setAppTitle(docCfg.getItemValueString("appTitle"));
//store the messages in the apn.nsf
cfg.setStoreMessages(new Boolean (docCfg.getItemValueString("storeMessages")));
}catch(Exception e){
logger.log(Level.SEVERE,null, e);
}finally{
CloseUtils.close(in);
}
return cfg;
}
开发者ID:mwambler,项目名称:webshell-xpages-ext-lib,代码行数:47,代码来源:AppConfigFactory.java
注:本文中的lotus.domino.EmbeddedObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论