logo资料库

oracle UCM代码用例说明.docx

第1页 / 共7页
第2页 / 共7页
第3页 / 共7页
第4页 / 共7页
第5页 / 共7页
第6页 / 共7页
第7页 / 共7页
资料共7页,全文预览结束
UCM代码调用示例说明
1.代码说明
2.检出文件
3.上传文件说明
4.修改文件说明
5.删除文件说明
6.查询文件说明
UCM 代码调用示例说明 版本编号 时间 作者 内容 1.0 2012-10-17 汤永辉 1. 代码说明 示例代码 参加 1003 项目 svn: HTA111102SHJCRJJSPT\1-系统开发实施\(3) 编码\集团内网门户\PortalUCM 通过 client.sendRequest 方法发送文件。第一个参数为配置参数,第二个为数据文件。 //Join the binder and the user context and perform the service call ServiceResponse response = client.sendRequest (getUserContext (), dataBinder); 2. 检出文件 dataBinder.putLocal ("IdcService", "CHECKOUT_BY_NAME"); //如果已经存在的文件先检出,再检入 //文件标题
dataBinder.putLocal ("dDocTitle", "Test File"); //文件名称 dataBinder.putLocal ("dDocName", "tangtest112011.rar"); //文件类型 dataBinder.putLocal ("dDocType", "Document"); //安全级别 dataBinder.putLocal ("dSecurityGroup", "Public"); //账号所属账号 dataBinder.putLocal ("dDocAccount",""); //文件入库时间 dataBinder.getLocalData ().setDate ("dInDate", new Date ()); ServiceResponse response = client.sendRequest (getUserContext (), dataBinder); dataBinder.putLocal ("IdcService", "CHECKIN_UNIVERSAL"); //create a random stream byte [] bytes = new byte [1024]; new Random ().nextBytes (bytes); 3. 上传文件说明 UCM 上传文件主要通过 DataBinder 接口来实现。
Checking-in an item is also described in the manual: http://download.oracle.com/docs/cd/E17904_01/doc.1111/e10807/c0 9_ridc.htm#CIHCHACB The example set only the very basic set of metadata (mandatory minimum: dDocTitle, dDocType, dSecurityGroup and primaryFile). 这四个参数是必须设置的。 //如果已经存在的文件先检出,再检入 dataBinder.putLocal ("IdcService", "CHECKOUT_BY_NAME"); //文件标题 dataBinder.putLocal ("dDocTitle", "Test File"); //文件名称 dataBinder.putLocal ("dDocName", "tangtest112011.rar"); //文件类型 dataBinder.putLocal ("dDocType", "Document"); //安全级别 dataBinder.putLocal ("dSecurityGroup", "Public"); //账号所属账号 dataBinder.putLocal ("dDocAccount",""); //文件入库时间 dataBinder.getLocalData ().setDate ("dInDate", new Date ());
ServiceResponse response = client.sendRequest (getUserContext (), dataBinder); dataBinder.putLocal ("IdcService", "CHECKIN_UNIVERSAL"); //create a random stream byte [] bytes = new byte [1024]; new Random ().nextBytes (bytes); //上传文件 IdcClient client = getClient(); DataBinder dataBinder = client.createBinder (); //Populate the binder for a checkin service dataBinder.putLocal ("IdcService", "CHECKIN_UNIVERSAL"); //文件标题 dataBinder.putLocal ("dDocTitle", "Test File"); //文件名称 dataBinder.putLocal ("dDocName", "test-checkin-" + new Random ().nextInt ()); //文件类型 dataBinder.putLocal ("dDocType", "Document"); //安全级别
dataBinder.putLocal ("dSecurityGroup", "Public"); //账号所属账号 dataBinder.putLocal ("dDocAccount",""); //文件入库时间 dataBinder.getLocalData ().setDate ("dInDate", new Date ()); //create a random stream byte [] bytes = new byte [1024]; new Random ().nextBytes (bytes); //上传文件 dataBinder.addFile ("primaryFile", new TransferFile (new ByteArrayInputStream (bytes), bytes.length, "application/octet-stream")); "testfile.bin", String contentsInHex = toHexString (bytes); System.out.println (String.format("First 10 bytes of random content in hex: %s", contentsInHex.substring (0, 10).toUpperCase ())); //Join the binder and the user context and perform the service call
ServiceResponse response = client.sendRequest (getUserContext (), dataBinder); //Convert the response to a dataBinder DataBinder responseData = response.getResponseAsBinder (); 4. 修改文件说明 暂时没有发现修改的调用方法。 5. 删除文件说明 IdcClient client = getClient(); //Call the service to delete the file DataBinder dataBinder = client.createBinder (); dataBinder.putLocal ("IdcService", "DELETE_DOC"); dataBinder.putLocal ("dID", dID); dataBinder.putLocal ("dDocName", dDocName); ServiceResponse response = client.sendRequest (getUserContext(), dataBinder); 6. 查询文件说明 查询接口返回列表。 //Call the service to perform the search
DataBinder dataBinder = client.createBinder (); //查询服务 dataBinder.putLocal ("IdcService", "GET_SEARCH_RESULTS"); dataBinder.putLocal ("SortField", "dInDate"); dataBinder.putLocal ("SortOrder", "Desc"); //查询结果数量 dataBinder.putLocal ("ResultCount", "2"); //查询条件 dataBinder.putLocal ("QueryText", "tang4343"); dataBinder.putLocal ("SearchQueryFormat", "Universal"); //Convert the response to a databinder ServiceResponse response = client.sendRequest (getUserContext (), dataBinder); DataBinder responseData = response.getResponseAsBinder (); //Get the SearchResults resultset DataResultSet searchResults = responseData.getResultSet ("SearchResults");
分享到:
收藏