150 likes | 373 Views
Creating Documentum Objects. Module Objectives. After completing this module you will: be able to create an object and set its attributes be familiar with methods from the following interfaces: IDfPersistentObject IDfSysObject IDfDocument IDfFolder. Topics. Creating Cabinet Objects
E N D
Module Objectives • After completing this module you will: • be able to create an object and set its attributes • be familiar with methods from the following interfaces: • IDfPersistentObject • IDfSysObject • IDfDocument • IDfFolder
Topics • Creating Cabinet Objects • Creating Folder Objects • Creating Document Objects
Object Creation Session, give me an empty object of type X Session Object, set your properties to these values and save yourself
Create a Cabinet Public Sub createCabinet(sess As IDfSession, cabinetName As String) Dim sysObj As IDfSysObject Dim pObj As IDfPersistentObject On Error GoTo ErrorHandler ' Create the dm_cabinet object, set some attributes, then save it. Set sysObj = sess.newObject("dm_cabinet") sysObj.setObjectName cabinetName sysObj.setSubject "DFC Example Cabinet" Set pObj = sysObj pObj.save ' Display details about the new object. displayObjectInfo sysObj ' Free memory. Set sysObj = Nothing Set pObj = Nothing Exit Sub ErrorHandler: debug.Print "createCabinet(): " + Err.Description, False End Sub
Interfaces and Methods Used: • Interfaces • IDfSession • required to interact with the Docbase and create new objects • newObject(object_type) • IDfSysObject • to assign attributes to the new cabinet object • setObjectName(name) • setSubject(subject) • IDfPersistentObject • to save cabinet object • save()
Create a Folder Public Sub createFolder(sess As IDfSession, folderName As String, linkName As String) Dim sysObj As IDfSysObject Dim pObj As IDfPersistentObject On Error GoTo ErrorHandler ' Create the dm_folder object, set some attributes, then save it. Set sysObj = sess.newObject("dm_folder") sysObj.setObjectName folderName sysObj.setSubject "DFC Example folder" ' Have the user specify the parent cabinet/folder. sysObj.link linkName Set pObj = sysObj pObj.save ' Display details about the new object. displayObjectInfo sysObj ' Free memory. Set sysObj = Nothing Set pObj = Nothing Exit Sub ErrorHandler: debug.Print "createFolder(): " + Err.Description, False End Sub
Interfaces and Methods Used: • Interfaces • IDfSession • required to interact with the Docbase and create new objects • newObject(object_type) • IDfSysObject • to assign attributes to the new folder object • setObjectName(name) • setSubject(subject) • link(path) • IDfPersistentObject • to save the folder object • save()
Create a Document Public Sub createDocument(sess As IDfSession, docName As String, contentFile As String, linkName As String) Dim sysObj As IDfSysObject Dim pObj As IDfPersistentObject ' Create the dm_document object, set some attributes, then save it. Set sysObj = sess.newObject("dm_document") sysObj.setObjectName docName sysObj.setSubject "DFC Example Doc" sysObj.setContentType "crtext" sysObj.setTitle "DFC Example Doc"
Create a Document, ctd. ' Have the user specify a file on disk. sysObj.setFile contentFile ' Have the user specify the parent cabinet/folder. sysObj.link linkName Set pObj = sysObj pObj.save ' Display details about the new object. displayObjectInfo sysObj ' Free memory. Set sysObj = Nothing Set pObj = Nothing Exit Sub ErrorHandler: debug.Print "createDocument(): " + Err.Description, False End Sub
Classes and Interfaces Used: • Classes • None • Interfaces • IDfSession • required to interact with the Docbase and create new objects • IDfSysObject • to assign attributes to the new document object • IDfPersistentObject • to save document object
Test Your Knowledge • In each example, the same method was used to create the different object types. What was the method and which interface implements it? • What interface and method would you use to assign the system ACL "public_doc" to the newly created objects?