0% found this document useful (0 votes)
289 views

Documentum Foundation Classes

The document provides an overview of interacting with content using EMC Documentum's Foundation Classes (DFC). It discusses using DFC to programmatically access documents in a repository through Java classes. Key classes and interfaces like IDfClient, IDfSession, IDfDocument and IDfFolder are described. Steps for setting up a DFC project and examples of using DFC to create folders and documents, query content, and clean up resources are also covered.

Uploaded by

Bogdan Manea
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
289 views

Documentum Foundation Classes

The document provides an overview of interacting with content using EMC Documentum's Foundation Classes (DFC). It discusses using DFC to programmatically access documents in a repository through Java classes. Key classes and interfaces like IDfClient, IDfSession, IDfDocument and IDfFolder are described. Steps for setting up a DFC project and examples of using DFC to create folders and documents, query content, and clean up resources are also covered.

Uploaded by

Bogdan Manea
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

EMC Documentums Foundation Classes (DFC)

Kamel BELGACEM S.C. Euroscript-Certitude S.R.L.

December 20 0

!o" to i#teract "it$ co#te#t%&


'si#( a Web Application Docume#tum Admi#istrator )ebtop 'si#( a Desktop Application Docume#tum Composer* also a de+elopme#t tool 'si#( a Query Tool ,D-L* ,#teracti+e D-L ,A.,* ,#teracti+e A.,/ became deprecated 'si#( a Custom Application 'si#( Docume#tum 0ou#datio# Classes 1D0C2 'si#( Docume#tum 0ou#datio# Ser+ices 1D0S2 'si#( a# Inte ration Tec!nolo y Docume#tum .rocess ,#te(rator

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

D0C !ierarc$6 Dia(ram

'se3ul classes a#d i#ter3aces


ID$Client Establis$es a#d ma#a(es sessio# "it$ ser+er .ro+ides i#3ormatio# about ser+er ID$Collection .ro+ides access to collectio# ob8ects ID$Document .ro+ides 3u#ctio#alit6 to i#teract "it$ dm9docume#t ob8ect ID$Folder .ro+ides access to 3older-related data stored i# 3olders ID$(ersistent%b&ect Base class 3or all Docume#tum persiste#t ob8ects

'se3ul classes a#d i#ter3aces


ID$Query .ro+ides 3u#ctio#alit6 to ru# D-L :ueries a(ai#st a repositor6 ID$)ession E#capsulates a sessio# "it$i# Docume#tum repositor6 ID$)essionMana er Ma#a(es ide#tities/ pooled sessio#s a#d tra#sactio#s ID$)ys%b&ect .ro+ides 3u#ctio#alit6 to i#teract "it$ dm9s6sob8ect ob8ect ID$Typed%b&ect .ro+ides basic operatio#s 3or all t6ped ob8ects

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

Li#5 t$e 4ARs


d$c.&ar d$cbase.&ar lo -&.&ar 1optio#al/ i3 6ou "a#t better lo((i#(2

Create a#d add to 6our pro8ect director6


config/ as a s6mbolic li#5 to <dcmt-install>/config/

Lo( i#<out o3 t$e DocBase


import import import import import import com.documentum.fc.client.DfClient; com.documentum.fc.client.IDfClient; com.documentum.fc.client.IDfSession; com.documentum.fc.client.IDfSessionManager; com.documentum.fc.common.DfLoginInfo; com.documentum.fc.common.IDfLoginInfo;

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"""; + +

Create a#d li#5 a docume#t


,...public class DFCTutorial { ,...private static final String FILE_NAME private static final String DIR_PATH private IDfDocument document ,...null;

"Documentums D#$# # %resentation"; "/Temp/" 5 DIR_NAME;

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 + +

Modi36 a docume#t 1metadata2


,...public class DFCTutorial { ,...private static final String DOC_AUTHOR ,...-

"(amel )*+,' *-";

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"#

0etc$ 3older co#te#t 1usi#( ,D30older2


,...public class DFCTutorial { ,...private void fetchFolderContentUsingIDfFolder!" throws #$ce%tion { IDfFolder folder session.getFolder8)(at6!DIR_PATH"; // (7) ontrol the case when null IDfCollection collection null; IDfDocument doc null; int count 9; try { // ,et all the documents inside the folder and iterate on them collection folder.getContents!"r_ob"ect_id""; while !collection.ne$t!"" { count55; IDfId id collection.getId!"r_ob"ect_id""; doc !IDfDocument" session.get/01ect!id"; S)stem.out.%rintln!id 5 :; : 5 doc.get/01ect2ame!""; + + finally { // '+4'8S7 clean up your collections if !collection < null" { collection.close!"; + + + +

0etc$ 3older co#te#t 1usi#( D-L2


,...public class DFCTutorial { ,...private void fetchFolderContentUsingDQ !" throws #$ce%tion { String d=lString "S*+* T r_ob"ect_id/ ob"ect_name $19- dm_document " : "4;*1* folder(<" 5 DIR_PATH 5 "<)3"; IDf.uer) =uer) new Df.uer)!"; =uer).setD.L!d=lString"; IDfCollection collection String doc2ame null; int count 9; null;

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!"; + + + +

-uer6 docume#ts 1b6 pat$2


,...public class DFCTutorial { ,...private static final String FILE_PATH ,...-

DIR_PATH : "/" : FILE_NAME;

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!"; + + + +

Remo+e 3olders a#d docume#ts


,...public class DFCTutorial { ,...private void removeDocument!" throws #$ce%tion { document.destro)7ll>ersions!"; // Dont forget that versionning is enabled + private void removeFolder!" throws #$ce%tion { folder.destro)7ll>ersions!"; // Dont forget that versionning is enabled + +

Best .ractices 3or Resource Clea#up =$e ID$Collection ob8ect


Similar to a &a#a.s/l.'esult)et ob8ect 7#ce ope#ed/ $as to be closed ;umber o3 collectio#s ope#ed is limited

=$e ID$)ession ob8ect


Similar to a &a#a.s/l.Connection ob8ect 7pe#ed a#d closed b6 ID$)essionMana er Do#>t 3or(et to release t$e sessio# o#ce 3i#is$ed

C$ec5poi#t Sa6 i3 t$ese i#3ormatio# are true or 3alse*


ID$Collection ob8ects are automaticall6 closed ID$)ession ob8ects $a+e to be closed ma#uall6 )e ca##ot 3etc$ 3older co#te#t usi#( DQ+. ,t s$ould be per3ormed usi#( ID$Folder ob8ect 7#ce a c!eckin12 is per3ormed/ a sa#e12 $as to be called ot$er"ise c$ec5i# is aborted Disco##ecti#( 3rom t$e docbase is per3ormed b6 closi#( all ope# sessio#s

C$ec5poi#t )$at $appe#s "$e# ru##i#( t$is met$od &


private void update$uthors!" throws #$ce%tion { IDfDocument doc !IDfDocument" session.get/01ect8)(at6!FILE_PATH"; int num7ut6ors document.get7ut6orsCount!"; document.set7ut6ors!num7ut6ors* DOC_AUTHOR"; document.c6ec3in!false* null"; +

Does t$is $elp to upload m6 ?@A.=?= docume#t &


private void upload%yDocument!" throws #$ce%tion { IDfDocument document ne& DfDocument!"; document.set/01ect2ame!"-y >8?#T>T Document""; document.setContentT)%e!"crte&t""; document.setFile!"$!/>8?#T>T""; +

A#s"ers Sa6 i3 t$ese i#3ormatio# are true or 3alse*


False* ID$Collection ob8ects s$ould be ma#uall6 closed True* ID$)ession ob8ects $a+e to be closed ma#uall6 False* )e ca# 3etc$ 3older co#te#t usi#( DQ+ a#d ID$Folder ob8ect False* c!eckin12 uploads a #e" +ersio# o3 t$e docume#t a#d its metadata up-to-date/ so #o sa#e12 is re:uired True* Closi#( all sessio#s disco##ects us 3rom t$e docbase

A#s"ers =$is "ill raise a# eBceptio#. !ereCs t$e correctio#*


private void update$uthors!" throws #$ce%tion { IDfDocument doc !IDfDocument" session.get/01ect8)(at6!FILE_PATH"; document&checkout'(; // hec.ing out a document before modification is re@uired int num7ut6ors document.get7ut6orsCount!"; document.set7ut6ors!num7ut6ors* DOC_AUTHOR"; document.c6ec3in!false* null"; +

;o/ it does#Ct $elp si#ce it raises a# eBceptio#. !ereCs t$e correctio#*


private void upload%yDocument!" throws #$ce%tion { // 4e cannot instantiate (A)DfDocument/ we need to pass by a builder (Session) IDfDocument document 'IDfDocument( session&new)b*ect'"dm_document"(; document.set/01ect2ame!"-y >8?#T>T Document""; document.setContentT)%e!"crte&t""; document.setFile!"$!/>8?#T>T""; document&save'(; // Af you dont save the document/ nothing will happen +

T!ank you #ery muc!0 12 mul3umesc 0

You might also like