二級數據中心一期工程項目培訓ucm接口_第1頁
二級數據中心一期工程項目培訓ucm接口_第2頁
二級數據中心一期工程項目培訓ucm接口_第3頁
二級數據中心一期工程項目培訓ucm接口_第4頁
二級數據中心一期工程項目培訓ucm接口_第5頁
已閱讀5頁,還剩32頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

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*在指定目錄下創(chuàng)建文件夾。調用FLD_CREATE_FOLDER服務。傳入所屬文件*標識符和文件夾名稱兩個參數。若想使用Folders_g組件創(chuàng)建文件夾*用黃色高亮部分的代**********用戶密要創(chuàng)建的文件夾上層文件夾標識文件夾publicclass}}publictestFolderpublicvoidpublictestFolderpublicvoidcreateFrameworkFolder(StringparentGUID,StringfolderName)throwsIdcClientException{StringuserName="sysadmin";StringIdcClientManagercm=newIdcClientManager();IdcClientclient=cm.createClient(connecString); try *ThefollowingcodeistocreatefolderwithFolders_gComponent: this.getFolderIdFromPath(idcClient,userContext,PATH)); //createtheDataBinderdataBinder=//populatethebinderwiththeparameters//創(chuàng)建folder存放在某個目錄下面(可是根目錄:/)"Public");//FolderSecurityGroup Delete*刪除指定文件夾。Delete*刪除指定文件夾。調用FLD_DELETE服務。指定要刪除的文件夾路徑。*指定fFolderGUID或者fFileGUID來指定要刪除的文件夾。(如高亮部示**********用戶密要刪除的項文件路dataBinder.putLocal("fOwner",//Jointhebinderandtheusercontextandperformthe client.sendRequest(userContext,dataBinder);//Converttheresponsetoa System.out.println("創(chuàng)建完目錄的 }catch(Exception{}}publicstaticvoidmain(Stringargs[])throws{testFoldermytest=newtestFolder}}*@param要創(chuàng)建的*@param要創(chuàng)建的文件夾上層文件夾標識**@param要創(chuàng)建的文件標*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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論