Professional Documents
Culture Documents
December 20 0
Docume#tum 0ou#datio# Classes Set o3 "a#a classes 14a+a A.,2 Ma5e ser#er $unctionalities a+ailable to custom client applications Ma6 be co#sidered as t$e %b&ect-'elational-Mapper 17RM2 3or pro(rammaticall6 accessi#( docume#ts i#side t$e repositor6 1t$e docbase2
Setti#( up a D0C pro8ect 'se a#6 IDE 1Eclipse/ ;etbea#s/ 4De+eloper/ etc.2 ,#stall<Get t$e 3rame"or5s
DFC $rame*ork +%,-" 1optio#al. Most 5#o"# lo((i#( A., 3or 4a+a2
public class DFCTutorial { private static final String DOCBASE private static final String USERNAME private static final String PASSWORD private IDfSessionManager sessionMgr private IDfSession session null; "(your docbase)"; "(your username)"; "(your password)"; null;
private void connect!" throws #$ce%tion { IDfClient client DfClient.getLocalClient!"; sessionMgr client.ne&SessionManager!"; IDfLoginInfo login new DfLoginInfo!"; login.set'ser! USERNAME"; login.set(ass&ord!PASSWORD"; login.setDomain!null"; sessionMgr.setIdentit)!DOCBASE* login"; session + private void disconnect!" throws #$ce%tion { sessionMgr.release!session"; // Do not forget this everytime youre finished with sessions + + sessionMgr.ne&Session! DOCBASE";
Create a 3older
,...import import import import import import ,...com.documentum.fc.client.Df.uer); com.documentum.fc.client.IDfCollection; com.documentum.fc.client.IDfDocument; com.documentum.fc.client.IDfFolder; com.documentum.fc.client.IDf.uer); com.documentum.fc.common.IDfId;
public class DFCTutorial { ,...private static final String DIR_NAME private IDfFolder folder ,...null;
"SubDirectory";
private void createFolder!" throws #$ce%tion { folder !IDfFolder" session.ne&/01ect!"dm_folder""; folder.set/01ect2ame!DIR_NAME"; folder.lin3!"/Temp""; folder.sa4e!"; S)stem.out.%rintln!" reated folder! " 5 folder.getId!"r_ob"ect_id"""; + +
private void createDocument!" throws #$ce%tion { document !IDfDocument" session.ne&/01ect! "dm_document""; document.set/01ect2ame!FILE_NAME"; document.setContentT)%e! "crte&t""; document.setFile! "$!/%resentation#ppt&""; // 'dd content to this dm_document document.sa4e!"; // Dont forget to save your modifications S)stem.out.%rintln! " reated file! " 5 document.getId!"r_ob"ect_id"""; + private void linkFileToFolder!" throws #$ce%tion { document.lin3!DIR_PATH"; document.sa4e!"; // Dont forget this + +
private void modifyDocument!" throws #$ce%tion { document.c6ec3out!"; int num7ut6ors document.get7ut6orsCount!"; document.set7ut6ors!num7ut6ors* DOC_AUTHOR"; // doc#chec.in(false/ "%revents promotion to document.c6ec3in!false* null"; // // // // + + 011*2T")3
4hen a null version label is provided/ D$ automatically gives the new version an implicit version label (5#5/ 5#6/ etc#) and the symbolic label " 011*2T"#
try { collection =uer).e$ecute!session* IDf.uer). DF_READ_QUERY"; while !collection.ne$t!"" { count55; String id collection.getString! "r_ob"ect_id""; doc2ame collection.getString! "ob"ect_name""; S)stem.out.%rintln!id 5 "! " 5 doc2ame"; + + finally { // '+4'8S7 clean up your collections if !collection < null" { collection.close!"; + + + +
private void !ueryDocument"y#ath !" throws #$ce%tion { // ,et the file by path ### IDfDocument doc !IDfDocument" session.get/01ect8)(at6! FILE_PATH"; // ### and start using it7 + private void !ueryDocument"yDQ !" throws #$ce%tion { String d=lString "S*+* T r_ob"ect_id $19- dm_document" 5 " 4;*1* ob"ect_name = <" 5 FILE_NAME 5 "<" 5 " '2D '28 authors = <" 5 DOC_AUTHOR 5 "<"; IDf.uer) =uer) new Df.uer)!"; =uer).setD.L!d=lString"; IDfCollection collection =uer).e$ecute!session* IDf.uer ).DF_READ_QUERY"; try { collection.ne$t!"; // -ove the pointer to the first item doc !IDfDocument" session.get/01ect!collection.getI d!"r_ob"ect_id"""; + finally { // '+4'8S7 clean up your collections if !collection < null" { collection.close!"; + + + +