二级数据中心一期工程项目培训ucm接口_第1页
二级数据中心一期工程项目培训ucm接口_第2页
二级数据中心一期工程项目培训ucm接口_第3页
二级数据中心一期工程项目培训ucm接口_第4页
二级数据中心一期工程项目培训ucm接口_第5页
已阅读5页,还剩32页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

UCM接口文UCM接口文 Searchby Searchbymultiple Searchworkin Check Check Checkinbyte Checkintospecific Checkinno Create Delete Browse Search Search Check Check Update importoracle.stellent.ridc.IdcContext; 连接及登录。idcContext用来存储 连接及登录。idcContext用来存储若用户名和密码都不为空,则第一个参为*用户名,第二个为密码。若用户名不为空密码为空,则使用用户名登陆。若户*名和密码都为空,则以Guest身份登******用户密publictestConnect{publicpublictestConnect(StringconnUrl,Stringusername,String{tryinitial(connUrl,username,}catch(IdcClientException{}}Stringpassword)throwsIdcClientException{//Createthe tryIdcClientidcClient=}catch(IdcClientException{}//SeeifthereareoptionalparameterstofillouttheSearchby根Searchby根据特定的元数据搜索内容。例子是按照dDocName进行搜索,也可按*dDocTitle,dDocAuthor等,只需要将dDocName改成相应元数据名称*替换黄色高亮部分可以更改搜索条件(matches,contains等)。调GET_SEARCH_RESULTS服务。根据QueryText语句进行搜索并输出相*信息@param内容名**@param查询语* }elseif(username!=null&&password==null)//Second(optional)argumentistheusernameIdcContextidcContext=newIdcContext(username);}else//Onlyoneparameter,defaultsto"guest"accessIdcContextidcContext=newIdcContext();}}publicstaticvoidmain(String }}*@param结果数*@param结果数**@param所属文件夹标识*publicclasstestSearch{publicpublicvoidsearchBydDocName(StringdDocName){if(dDocName==null||"".equals(dDocName.trim())){}IdcClientManagercm=newIdcClientManager();IdcClient<?,?,?>client=IdcContextuserContext=new//createtheDataBinderdataBinder=client.createBinder//populatethebinderwiththeparameters//dataBinder.putLocal("QueryText","dDocName<matches>`"+dDocName+"`");//dataBinder.putLocal("QueryText","dDocName<contains>`"+dDocName+"`");dataBinder.putLocal("QueryText","dDocName<substring>`"+dDocName+"`");//JointhebinderandtheusercontextandperformtheservicecallServiceResponseresponse=client.sendRequest(userContext,DataBinderresponseData=response.getResponseAsBinder();DataResultSetsearchResults=StringdocName=null;StringdId=null;StringpFile=null;StringcpFile=null;for(DataObjectdataObjectsearchResults.getRows()){dIdSearchbymultiple 根据多个条件搜Searchbymultiple 根据多个条件搜索内容。例子是按照dDocName和dDocTitle进行搜*用黄色高亮部分可以替换为其他元数据名称,and可以替换成or等搜*条件。调用GET_SEARCH_RESULTS服务,生成QueryText,根据查询语*进行搜索并输出相应信息********内容名内容标查询语结果数publicclasstestSearch{publicpublicvoidsearch(StringdDocTitle){pFile=dataObject.get("primaryFile");cpFile=dataObject.get("xCpdIsLocked");System.out.println("dId==="+dId);System.out.println("dDocName==="+docName);System.out.println("primaryFile==="+pFile);System.out.println("xCpdIsLocked==="+cpFile);}{}}publicstaticvoidmain(Stringargs[]){testSearchmytest=new}IdcClientclient=IdcClientclient=IdcContextuserContext=new//createtheDataBinderdataBinder=client.createBinder//populatethebinderwiththeparametersStringqueryText=//generateif(dDocName!=null&&queryText="dDocName<substring>`"+dDocName}if(dDocTitle!=null&&if(null!=queryText=queryText+"<and><substring>`"+dDocTitle+queryText="dDocTitle<substring>`"++}if(null!=}dataBinder.putLocal("ResultCount","10");//JointhebinderandtheusercontextandperformtheservicecallServiceResponseresponse=client.sendRequest(userContext,DataBinderresponseData=response.getResponseAsBinder();DataResultSetsearchResults=StringdocName="";StringdocTitle="";StringfilePath="";for(DataObjectdataObject:searchResults.getRows()){docName=docTitle=Searchworkin*搜索进行中的Searchworkin*搜索进行中的工作。调用WORK_IN_PROGRESS服务。输出搜索结果文档********用户密查询语publicclasspublicpublicvoidsearchWorkInProgress()throws{StringconnecString="idc://66:4444";StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString);IdcContextuserContext=new}}}publicstaticvoidmain(Stringargs[]){testSearchmytest=new}CheckChecktry//createtheDataBinderdataBinder=client.createBinder//populatethebinderwiththeparameters//dataBinder.putLocal("whereClause","ANDRevisions.Ddocnamelike'%TOM0001%'");//dataBinder.putLocal("orderClause","ANDRevisions.Ddocnamelike'%TOM0001%'orderbyRevisions.Drevlabeldesc,dInDate//JointhebinderandtheusercontextandperformtheservicecallServiceResponseresponse=client.sendRequest(userContext,DataBinderresponseData=response.getResponseAsBinder();DataResultSetsearchResults=for(DataObjectdataObject:searchResults.getRows()){StringdocName=}}catch(IdcClientException{}}publicstaticvoidmain(Stringargs[])throwsIdcClientException{testConnectmyconnect=newtestConnect();}CheckCheck*检入。调用CHECKIN_UNIVERSAL服务。设好元数********用户密结果数publicclasspublictestCheckInpublicvoidcheckin()throws{ServiceResponsemyServiceResponse=null;FileInputStreamfileStream=null;StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=IdcContextIdcContextuserContext=newtry//createtheDataBindermyRequestDataBinder=//populatethebinderwiththe//TitleoftheUploadedfile//NameofAuthor//Securityforthecontent(GroupandAccount)//JointhebinderandtheusercontextandperformtheservicecallmyServiceResponse=InputStreammyInputStream=StringmyResponseString=System.out.println("Uploadedfiledetails:\n"+//ConverttheresponsetoaDataBindermyResponseDataBinder=}catch(IdcClientExceptionidcce)Checkinbyte*检入Checkinbyte*检入流文件。调用CHECKIN_NEW服务。设好元数*****用户System.out.println("IDCClientExceptionoccurred.Unabletouploadfile.Message:"+idcce.getMessage()+",Stacktrace:");}catch(IOExceptionioe)System.out.println("IOExceptionoccurred.Unabletouploadfile.Message:"+ioe.getMessage()+",Stacktrace:");}catch(Exceptione)System.out.println("Exceptionoccurred.Unabletouploadfile.Message:"+e.getMessage()+",Stacktrace:");}finallyif(myServiceResponse!={}if(fileStream!={try{}catch(Exception{}}}}publicstaticvoidmain(Stringargs[])throwsIdcClientException{testCheckInmytest=newtestCheckIn();}}密**@param要in的文件密**@param要in的文件所在当地的目**@param文件in到UCM中的目录标*publicclasspublictestCheckInpublicDataBindercheckinByteStream(StringfilePath)throwsIdcClientException{DataBinderresponseData=null;Filefile=null;BufferedInputStreambufferedInputStream=null;ByteArrayOutputStreamarrayOutputStream=null;StringPATH="/CAD";///ContributionFoldersStringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString);IdcContextuserContext=newtry//createtheDataBinderdataBinder=client.createBinder//populatethebinderwiththeparametersdataBinder.putLocal("IdcService","CHECKIN_NEW");dataBinder.putLocal("dDocTitle","Test");dataBinder.putLocal("dDocType","Document");dataBinder.putLocal("dAccount","");dataBinder.putLocal("dDocAccount","Public");dataBinder.putLocal("dSecurityGroup","Public");System.out.println("NowSystem.out.println("NowCheckinfile:"file=newFile(filePath);bufferedInputStream=newarrayOutputStream=newbyte[]bytes=newbyte[1];while(bufferedInputStream.read(bytes)!=-1)}bytes=arrayOutputStream.toByteArray();newTransferFile(newByteArrayInputStream(bytes),filePath,bytes.length));try//JointhebinderandtheusercontextandtheserviceServiceResponseresponse=client.sendRequest(userContext,dataBinder);//ConverttheresponsetoadataBinderresponseData=response.getResponseAsBinder();//Displaythestatusoftheservicecallresponse:%s",responseData.getLocal}catch(IdcClientException{}}catch(IOException{}catch(Exception{}finallytryif(arrayOutputStream!=null)if(bufferedInputStream!=null)}catch(Exceptione)Checkintospecific*检入新内容。传入文件Checkintospecific*检入新内容。传入文件夹标识符和文件名称两个参数调用CHECKIN_NEW服务设*好元数据值。将本地文件in到UCM指定文件目录下**********用户密文件publicclasspublictestCheckInpublicvoidcheckInNew(StringfolderId,StringfileName)throwsIdcClientException{DataBinderresponseData=StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientclient=}}return}publicstaticvoidmain(Stringargs[])throwsIdcClientException{testCheckInmytest=newtestCheckIn();}}IdcContextIdcContextuserContext=newtry//createtheDataBinderdataBinder//populatethebinderwiththeparametersdataBinder.putLocal("dDocTitle","Test");dataBinder.putLocal("dDocName","Test"+dataBinder.putLocal("dDocAccount","");dataBinder.putLocal("dSecurityGroup","Public");",newTransferFile(new}catch(IOException{}//JointhebinderandtheusercontextandperformtheServiceResponseresponse=client.sendRequest(userContext,dataBinder);//ConverttheresponsetoadataBinderresponseData=response.getResponseAsBinder();//Displaythestatusoftheservicecallresponse:%s",responseData.getLocal("StatusMessage")));}catch(IdcClientExceptionice)Checkinno*检入新内容但不通Checkinno*检入新内容但不通知。调用CHECKIN_ARCHIVE_NO_NOTIFY服务。必须传入的*数包括dSecurityGroup,dDocAccount***********用户密文件publicclasstestCheckInpublictestCheckInpublicvoidcheckinNoNotify()throws{DataBinderresponseData=StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString);IdcContextuserContext=new}}publicstaticvoidmain(Stringargs[])throwsIdcClientException{testCheckInmytest=newtestCheckInmytest.checkInNew}}FileFilefile=null;try{DataBinderdataBinder=client.createBinder//populatethebinderwiththeparametersdataBinder.putLocal("IdcService",dataBinder.putLocal("dDocTitle","Test");dataBinder.putLocal("Action","Insert");dataBinder.putLocal("dDocAuthor","ann");dataBinder.putLocal("dDocType","Document");dataBinder.putLocal("dAccount","");dataBinder.putLocal("dSecurityGroup",trynew}catch(IOException{}//JointhebinderandtheusercontextandperformtheserviceServiceResponseresponse=client.sendRequest(userContext,dataBinder);//ConverttheresponsetoadataBinderresponseData=response.getResponseAsBinder();//Displaythestatusoftheservicecallresponse:%s",responseData.getLocal}catch(Exception{}}publicstaticvoidmain(Stringargs[])throwsIdcClientException{testCheckInmytest=newtestCheckInCreate*在指定目录Create*在指定目录下创建文件夹。调用FLD_CREATE_FOLDER服务。传入所属文件*标识符和文件夹名称两个参数。若想使用Folders_g组件创建文件夹*用黄色高亮部分的代**********用户密要创建的文件夹上层文件夹标识文件夹publicclass}}publictestFolderpublicvoidpublictestFolderpublicvoidcreateFrameworkFolder(StringparentGUID,StringfolderName)throwsIdcClientException{StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); try *ThefollowingcodeistocreatefolderwithFolders_gComponent: this.getFolderIdFromPath(idcClient,userContext,PATH)); //createtheDataBinderdataBinder=//populatethebinderwiththeparameters//创建folder存放在某个目录下面(可是根目录:/)"Public");//FolderSecurityGroup Delete*删除指定文件夹。Delete*删除指定文件夹。调用FLD_DELETE服务。指定要删除的文件夹路径。*指定fFolderGUID或者fFileGUID来指定要删除的文件夹。(如高亮部示**********用户密要删除的项文件路dataBinder.putLocal("fOwner",//Jointhebinderandtheusercontextandperformthe client.sendRequest(userContext,dataBinder);//Converttheresponsetoa System.out.println("创建完目录的 }catch(Exception{}}publicstaticvoidmain(Stringargs[])throws{testFoldermytest=newtestFolder}}*@param要创建的*@param要创建的文件夹上层文件夹标识**@param要创建的文件标*publicclasstestFolderpublictestFolderpublicvoiddeleteFrameworkFolder()throws{StringconnecString="idc://9:4444";StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); try//createtheDataBinderdataBinder=//populatethebinderwiththeparameters删除//dataBinder.putLocal("item1","fFolderGUID:");//SortbyFolder//dataBinder.putLocal("item1","fFileGUID//Jointhebinderandtheusercontextandperformtheservicecall //ConverttheresponsetoaDataBinderserverBinder=//resultsetwillnotbecreated for(DataObjectdataObject:searchResults.getRows())//Displaythestatusoftheservice//1: }Browse*浏览指定文件夹。调用Browse*浏览指定文件夹。调用FLD_BROWSE服务。指定要浏览的文件夹路径。若*指定文件夹路径,则必须指定fFolderGUID(如高亮部分所示**********用户密要浏览的文件夹文件夹标识publicclasstestFolderpublictestFolderpublicvoidbrowseFrameworkFolder()throws{StringconnecString="idc://9:4444";StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); try//createthe}catch(Exception{}}publicstaticvoidmain(Stringargs[])throws{testFoldermytest=newtestFolder();}} @path:RequiredifnolFolderGUIDisspecified.Thefullpathtothecurrentfolder.@fFolderGUID:Requiredifnopathisspecified.Canbeusedinsteadofthepathtoreferencethecurrent*@fldapp:SpecifiestheFoldersApplicationofthelocationtowhichtheuserisbrowsing.@folderCount:Thenumberoffolderstoreturn.Thedefaultvalueis50.@folderStartRow:Therownumberatwhichtostartreturningdata.Usedforpagination.Thedefaultvalueis@fileCount:Thenumberoffilestoreturn.Thedefaultvalueis50@fileStartRow:Therownumberatwhichtostartreturningdata.Usedforpagination.Thedefaultvalueis0.**//populatethebinderwiththeparameters//Jointhebinderandtheusercontextandperformtheservice client.sendRequest(userContext,dataBinder);//Converttheresponsetoa //resultsetwillnotbecreated StringnumFiles=serverBinder.getLocal("numFiles"); System.out.println("HasMoreChildFolders:"+hasMoreChildFolders+",NumFiles:"+numFiles+",HasMoreChildFiles:"+hasMoreChildFiles);如何查看对应的属性,可使用URL地址参数IsSoap=1,//BrowseFolderfor(DataObjectdataObject:{StringfFolderGUID=dataObject.get("fFolderGUID");StringfFolderName=dataObject.get("fFolderName");StringfParentGUID=dataObject.get("fParentGUID");System.out.println("fFolderGUID="+fFolderGUID+ fFolderName }//BrowseChildFoldersif(null!=childFolders)for(DataObjectdataObject:{StringfFolderGUID=dataObject.get("fFolderGUID");StringfFolderName=dataObject.get("fFolderName");StringfParentGUID=dataObject.get("fParentGUID");System.out.println("fFolderGUID="+fFolderGUID+ fFolderName }Search*搜索条件为空时显示所有Search*搜索条件为空时显示所有文件夹信息。调用FLD_FOLDER_SEARCH服务*按照指定字段排序输出所有文件夹信**********用户密排序字排序顺publicclasstestFolderpublictestFolderpublicvoidsearchFrameworkFolder()throws{StringconnecString="idc://9:4444";StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); try//createthe}}publicstaticvoidmain(Stringargs[])throws{testFoldermytest=newtestConnect();}} //populatethebinderwiththeparameters"fFolderName");//SortbyFolderName//Jointhebinderandtheusercontextandperformtheservice client.sendRequest(userContext,dataBinder);//Converttheresponsetoa //resultsetwillnotbecreated for(DataObjectdataObject: dataObject.get("fFolderGUID");StringfFolderName=dataObject.get("fFolderName");StringfParentGUID=System.out.println("fFolderGUID="+fFolderGUID+ fFolderName }}catch(Exception{}}publicstaticvoidmain(Stringargs[])throws{testFoldermytest=newtestFolder();}Search*搜索条件不为空时显示搜Search*搜索条件不为空时显示搜索到的信息。调用FLD_FOLDER_SEARCH服务*搜索文件夹名中子字符包含test的文件夹。(如高亮语句所示************用户密排序字排序顺查询语publicclasstestFolderpublictestFolderpublicvoidsearchFrameworkFolder()throws{StringconnecString="idc://9:4444";StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); try//createthe //populatethebinderwiththeparameters"fFolderName<substring>`test`");"fFolderName");//SortbyFolderNameCheckCheck//Jointhebinderandtheusercontextandperformtheservice client.sendRequest(userContext,dataBinder);//ConverttheresponsetoaDataBinderserverBinder=//resultsetwillnotbecreated for(DataObjectdataObject: dataObject.get("fFolderGUID");StringfFolderName=dataObject.get("fFolderName");StringfParentGUID=System.out.println("fFolderGUID="+fFolderGUID+ fFolderName }}catch(Exception{}}publicstaticvoidmain(Stringargs[])throws{testFoldermytest=newtestFolder();}Check*根据文件Check*根据文件名检出文件。先调用GET_SEARCH_RESULTS服务,根据文件名*搜索到文件。再调用CHECKOUT_BY_NAME服务将文件检出********用户密查询语publicclasspublictestCheckOut IdcClientException{StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); if(dDocName==null||{}//Search//createtheDataBinderDataBinderdataBinder=client.createBinder//populatethebinderwiththeparametersdataBinder.putLocal("IdcService","GET_SEARCH_RESULTS");dataBinder.putLocal("QueryText","dDocName<matches>`"+dDocName+//JointhebinderandtheusercontextandperformtheservicecallServiceResponseresponse=client.sendRequest(userContext,//ConverttheresponsetoaDataBinderresponseData=//resultsetwillnotbecreated StringdocName=null;StringdId=null;StringpFile=null;StringcpFile=null;StringdIsCheckedOut=null;for(DataObjectdataObject:searchResults.getRows()){dId=docName=dataObject.get("dDocName");pFile=dataObject.get("primaryFile");cpFile=dataObject.get("xCpdIsLocked");if(null!=dataObject.get("dIsCheckedOut"))dIsCheckedOut=System.out.println("dId==="+dId);System.out.println("dDocName==="+docName);System.out.println("primaryFile==="+pFile);System.out.println("xCpdIsLocked==="+cpFile);System.out.println("dIsCheckedOut==="+dIsCheckedOut);}//CheckoutSystem.out.println("CheckoutContentItem:"+dId);dataBinder.putLocal("dID",dId);dataBinder.putLocal("dDocName",dDocName);response=client.sendRequest(userContext,//ConverttheresponsetoaUpdate//Displaythestatusoftheservicecall {}}publicstaticvoidmain(Stringargs[])throws{testCheckOutmytest=newtestCheckOut();}}*更新文档信息。调用UPDATE_DOCINFO服务。dID标*更新文档信息。调用UPDATE_DOCINFO服务。dID标示要更新的文档,其他元*据是要更新的字段**************用户密文档名文档标上层文件夹标识publicclasspublictestUpdatepublicvoidupdateShell()throws{DataBinderresponseData=StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); try//createtheDataBinderdataBinder=//populatethebinderwiththeparametersdataBinder.putLocal("IdcService","UPDATE_DOCINFO");dataBinder.putLocal("dID","9100");dataBinder.putLocal("dDocName","test11");dataBinder.putLocal("dDocTitle","Test02");//Jointhebinderandtheusercontextandperformtheservicecall (userContext,//Converttheresponsetoa*根据提供的dID输出文档的相应*根据提供的dID输出文档的相应信息**********用户密文档名publicclasspublictestDocInfo IdcClientException{StringuserName="sysadmin";StringresponseData=//Displaythestatusoftheservicecallresponse:%s",responseData.getLocal}catch(IdcClientException{}}publicstaticvoidmain(Stringargs[])throws{testUpdatemytest=newtestUpdate();}}IdcClientManagercm=newIdcClientManager();IdcClientIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); //createtheDataBinderdocInfoBinder=//populateth

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论