根据文档版本VSID,得到文档对象

摘要: 在filenet中,通常用getContent这个SERVLET来得到文档,要么在线查看,要么提供下载。在这个文件 content_redir.properties 中可以配置什么类型的文件,用那个页面打开。比如:# Uncomment the following line to display image format in the Image Viewer appletimage/pjpeg=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}

在filenet中,通常用getContent这个SERVLET来得到文档,要么在线查看,要么提供下载。
在这个文件 content_redir.properties 中可以配置什么类型的文件,用那个页面打开。
比如:
# Uncomment the following line to display image format in the Image Viewer applet
image/pjpeg=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}
image/jpg=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}
image/jpeg=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}
image/bmp=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}
image/tiff=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}
image/gif=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}
application/x-cold=/WcmJavaViewer.jsp?{JSP_QUERY_STRING}

比如我们可以增加自己的处理方式:
application/msword=/aaa.jsp?{JSP_QUERY_STRING}
也就是说用我们的aaa页面来打开 word 类型文档. 这个 ?{JSP_QUERY_STRING} 是系统传过来的参数,包括VSID(版本ID),objectStoreName(OS名称), 我们一般处理文档,都是得到文档的ID,而不是VSID, 用文档ID得到文档对象本身很容易。 但用VSID,我还不怎么清楚,在查阅了资料后,总结如下:
1.拿到CESESSION
2.得到版本系列。
3.得到文档。
程序如下:
controller.configurePage(application, request);
WcmDataStore dataStore = controller.getDataStore();
WcmServerCredentials credentials = dataStore.getServerCredentials();
String username = credentials.getUserId();
String password = credentials.getPassword();
// VWSession vwSession = credentials.getVWSession();
com.filenet.wcm.api.Session ceSession = credentials.getSession();

String sVSID =request.getParameter(WcmParameter.VS_ID);
String osName = request.getParameter(WcmParameter.OBJECT_STORE_NAME);
ObjectStore objectStore = ObjectFactory.getObjectStore(osName, ceSession);
Document document;
VersionSeries versionSeries = (VersionSeries)
objectStore.getObject(BaseObject.TYPE_VERSIONSERIES, sVSID);
document = versionSeries.getReleasedVersion();
if (document == null)
document = versionSeries.getCurrentVersion();
if (document == null)
document = versionSeries.getReservation();
String documentTitle = document.getPropertyStringValue(Property.DOCUMENT_TITLE);

这样就得到文档对象,要怎么处理就方便了。

需要的包: com.filenet.wcm.api.*,
com.filenet.wcm.toolkit.server.util.*,
com.filenet.wcm.toolkit.util.*,
com.filenet.wcm.toolkit.server.servlet.*,
java.util.*,
com.filenet.wcm.toolkit.server.base.*

上一篇: WAT编程方式简单的例子
下一篇: java.sql.SQLException: No suitable driver

Avatar

轻舞肥羊 评论于: 2011-10-18

还可以这样取到:
//根据版本ID得到文档。
VersionSeries vs = Factory.VersionSeries.fetchInstance(this.os, new Id(ID), null);
doc = (Document)vs.get_ReleasedVersion();
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号