Hi,
Here, a very useful class exposing a lot of functionalities of Documentum (found on the Internet https://worldofchaitu.wordpress.com/2012/11/08/documentum-dfc-standalone-sample-program/):
- To get a list of available docbase
- To create a cabinet (dm_cabinet) in docbase
- To create a folder (dm_folder object) in docbase
- To create a document (dm_document object) in docbase
- To check out a document from docbase using IDfOperations
- To check in a document to docbase using IDfOperations making use of IAPI methods
- To import a document into docbase
- To cancelcheckout a document into docbase
- To check out a document from docbase
- To check in a document to docbase
- To delete a document from docbase
- To update document’s in docbase
- To retrieve document’s attributes from docbase
- To create a virtual document in docbase
- To export a virtual document from docbase
- To view virtual document from docbase
- To retrieve document from document using IDQL
- To create and start workflow
- To view task in inbox
- To attach a lifeCycle to a document in docbase
- To promote a lifeCycle state of a document
- To demote a lifeCycle state of a document
- To expire a lifeCycle state of a document
- To resume a lifeCycle state of a document
- To assign a ACL to a document
001 | package com.huo.test.ecm.test1; |
002 |
003 | import java.util.ArrayList; |
004 | import java.util.GregorianCalendar; |
005 | import java.util.List; |
006 | import java.util.StringTokenizer; |
007 |
008 | import com.documentum.com.DfClientX; |
009 | import com.documentum.com.IDfClientX; |
010 | import com.documentum.fc.client.DfClient; |
011 | import com.documentum.fc.client.DfQuery; |
012 | import com.documentum.fc.client.IDfACL; |
013 | import com.documentum.fc.client.IDfActivity; |
014 | import com.documentum.fc.client.IDfClient; |
015 | import com.documentum.fc.client.IDfCollection; |
016 | import com.documentum.fc.client.IDfDocbaseMap; |
017 | import com.documentum.fc.client.IDfDocument; |
018 | import com.documentum.fc.client.IDfFolder; |
019 | import com.documentum.fc.client.IDfProcess; |
020 | import com.documentum.fc.client.IDfQuery; |
021 | import com.documentum.fc.client.IDfQueueItem; |
022 | import com.documentum.fc.client.IDfSession; |
023 | import com.documentum.fc.client.IDfSessionManager; |
024 | import com.documentum.fc.client.IDfSysObject; |
025 | import com.documentum.fc.client.IDfType; |
026 | import com.documentum.fc.client.IDfTypedObject; |
027 | import com.documentum.fc.client.IDfVirtualDocument; |
028 | import com.documentum.fc.client.IDfVirtualDocumentNode; |
029 | import com.documentum.fc.client.IDfWorkflow; |
030 | import com.documentum.fc.client.IDfWorkflowBuilder; |
031 | import com.documentum.fc.client.IDfWorkitem; |
032 | import com.documentum.fc.common.DfList; |
033 | import com.documentum.fc.common.DfLoginInfo; |
034 | import com.documentum.fc.common.IDfAttr; |
035 | import com.documentum.fc.common.IDfId; |
036 | import com.documentum.fc.common.IDfList; |
037 | import com.documentum.fc.common.IDfLoginInfo; |
038 | import com.documentum.operations.IDfCancelCheckoutNode; |
039 | import com.documentum.operations.IDfCancelCheckoutOperation; |
040 | import com.documentum.operations.IDfCheckinNode; |
041 | import com.documentum.operations.IDfCheckinOperation; |
042 | import com.documentum.operations.IDfCheckoutNode; |
043 | import com.documentum.operations.IDfCheckoutOperation; |
044 | import com.documentum.operations.IDfExportNode; |
045 | import com.documentum.operations.IDfExportOperation; |
046 | import com.documentum.operations.IDfImportNode; |
047 | import com.documentum.operations.IDfImportOperation; |
048 | import com.documentum.operations.IDfOperation; |
049 | import com.documentum.operations.IDfOperationError; |
050 |
051 | /** |
052 | See https://webcache.googleusercontent.com/search?q=cache:MW2FjC-Rg7YJ:https://worldofchaitu.wordpress.com/2012/11/08/documentum-dfc-standalone-sample-program/+&cd=3&hl=en&ct=clnk&gl=lu |
053 | Documentum DFC Standalone Sample Program |
054 |
055 |
056 | This blog contains sample DFC code snippet of all basic functionalities of Documentum |
057 |
058 | To get a list of available docbase |
059 | To create a cabinet (dm_cabinet) in docbase |
060 | To create a folder (dm_folder object) in docbase |
061 | To create a document (dm_document object) in docbase |
062 | To check out a document from docbase using IDfOperations |
063 | To check in a document to docbase using IDfOperations making use of IAPI methods |
064 | To import a document into docbase |
065 | To cancelcheckout a document into docbase |
066 | To check out a document from docbase |
067 | To check in a document to docbase |
068 | To delete a document from docbase |
069 | To update document's in docbase |
070 | To retrieve document's attributes from docbase |
071 | To create a virtual document in docbase |
072 | To export a virtual document from docbase |
073 | To view virtual document from docbase |
074 | To retrieve document from document using IDQL |
075 | To create and start workflow |
076 | To view task in inbox |
077 | To attach a lifeCycle to a document in docbase |
078 | To promote a lifeCycle state of a document |
079 | To demote a lifeCycle state of a document |
080 | To expire a lifeCycle state of a document |
081 | To resume a lifeCycle state of a document |
082 | To assign a ACL to a document |
083 | **/ |
084 |
085 | public class DFCWorkShop { |
086 |
087 | IDfSysObject sysObject = null ; |
088 | IDfSession idfSession = null ; |
089 | IDfSessionManager sessMgr = null ; |
090 |
091 | public DFCWorkShop(String user, String passwd, String docbase) throws Exception { |
092 | getDfSession(user, passwd, docbase); |
093 | } |
094 |
095 | public IDfSession getDfSession(String args1, String args2, String args3) |
096 | throws Exception { |
097 | |
098 | IDfLoginInfo login = new DfLoginInfo(); |
099 | login.setUser(args1); |
100 | login.setPassword(args2); |
101 | IDfClient client = DfClient.getLocalClient(); //new DfClient(); |
102 | sessMgr = client.newSessionManager(); |
103 | sessMgr.setIdentity(args3, login); |
104 | idfSession = sessMgr.getSession(args3); |
105 |
106 | if (idfSession != null ) |
107 | System.out.println( "Session created successfully" ); |
108 |
109 | return idfSession; |
110 | } |
111 |
112 |
113 | public void releaseSession() throws Exception { |
114 | sessMgr.release(idfSession); |
115 | } |
116 | |
117 | public void getAllDocbases() throws Exception { |
118 |
119 | IDfClient client = DfClient.getLocalClient(); |
120 | IDfDocbaseMap docbaseMap = client.getDocbaseMap(); |
121 | for ( int i = 0 ; i < docbaseMap.getDocbaseCount(); i++) { |
122 | System.out.println( "Docbase Name : " + docbaseMap.getDocbaseName(i)); |
123 | System.out.println( "Docbase Desc : " + docbaseMap.getDocbaseDescription(i)); |
124 | } |
125 | } |
126 |
127 | public void createCabinet() throws Exception { |
128 |
129 | IDfFolder cabinet = (IDfFolder) idfSession.newObject( "dm_cabinet" ); |
130 | if (cabinet != null ) { |
131 | cabinet.setObjectName( "Training Cabinet XXX" ); |
132 | cabinet.save(); |
133 | } |
134 | } |
135 |
136 | public void createFolder() throws Exception { |
137 |
138 | IDfFolder folder = (IDfFolder) idfSession.newObject( "dm_folder" ); |
139 | if (folder != null ) { |
140 | folder.setObjectName( "Folder Level 2" ); |
141 | folder.link( "/Training Cabinet XXX" ); |
142 | folder.save(); |
143 | } |
144 | } |
145 |
146 | public IDfDocument createDocument() throws Exception { |
147 |
148 | IDfDocument document = (IDfDocument) idfSession |
149 | .newObject( "dm_document" ); |
150 | if (document != null ) { |
151 | document.setObjectName( "Test-Document" ); |
152 | document.setContentType( "crtext" ); |
153 | document.setFile( "C:\\Documentum\\config\\dfc.properties" ); |
154 | document.link( "/Training Cabinet XXX/Folder Level 1" ); |
155 | document.save(); |
156 | } |
157 | return document; |
158 | } |
159 |
160 | public void updateAttributes() throws Exception { |
161 |
162 | sysObject = (IDfSysObject) idfSession |
163 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 1/New Document" ); |
164 | sysObject.setString( "object_name" , "New Document" ); |
165 | sysObject.setString( "authors" , "Prasad" ); |
166 | sysObject.setRepeatingString( "authors" , 1 , "RamKumar" ); |
167 | sysObject.save(); |
168 | } |
169 |
170 | public void getAttributes() throws Exception { |
171 |
172 | sysObject = (IDfSysObject) idfSession |
173 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 1/New Document" ); |
174 | if (sysObject != null ) { |
175 | System.out.println( "objectName " |
176 | + sysObject.getString( "object_name" )); |
177 | // System.out.println("authors " + sysObject.getString("authors")); |
178 | String authors = sysObject.getAllRepeatingStrings( "authors" , "," ); |
179 |
180 | List list = new ArrayList(); |
181 | StringTokenizer st = new StringTokenizer(authors, "," ); |
182 | System.out.println( "length of st " + st.countTokens()); |
183 | while (st.hasMoreTokens()) { |
184 | list.add(st.nextElement()); |
185 | } |
186 | System.out.println( "length " + list.size()); |
187 |
188 | for ( int i = 0 ; i < list.size(); i++) { |
189 | System.out.println( "Author[" + i + "] " + list.get(i)); |
190 | } |
191 | } |
192 | } |
193 |
194 | public void getTypeAttributes() throws Exception { |
195 |
196 | IDfType type = (IDfType) idfSession.newObject( "dm_document" ); |
197 | for ( int i = 0 ; i < type.getAttrCount(); i++) { |
198 | IDfAttr attr = type.getAttr(i); |
199 | System.out.println( "Name " + attr.getName()); |
200 | System.out.println( "Datatype " + attr.getDataType()); |
201 | System.out.println( "Length " + attr.getLength()); |
202 | System.out.println( "IS Repeating Attr " + attr.isRepeating()); |
203 | } |
204 | } |
205 |
206 | public void checkoutDoc() throws Exception { |
207 |
208 | sysObject = (IDfSysObject) idfSession |
209 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 1/" ); |
210 | if (!sysObject.isCheckedOut()) // if it is not checked out |
211 | sysObject.checkout(); |
212 |
213 | System.out.println( "is Check out " + sysObject.isCheckedOut()); |
214 | } |
215 |
216 | public void checkinDoc() throws Exception { |
217 |
218 | sysObject = (IDfSysObject) idfSession |
219 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 1/Test-Document" ); |
220 |
221 | if (sysObject.isCheckedOut()) { // if it is checked out |
222 | sysObject.checkin( false , "CURRENT" ); |
223 | } |
224 | } |
225 |
226 | public void deleteDoc() throws Exception { |
227 |
228 | sysObject = (IDfSysObject) idfSession |
229 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 1/Test-Document" ); |
230 | if (sysObject != null ) { |
231 | sysObject.destroyAllVersions(); // delete all versions |
232 | System.out.println( "object destroyed….." ); |
233 | } |
234 | } |
235 |
236 | public void createVirtualDocument() throws Exception { |
237 |
238 | IDfSysObject pSys = (IDfSysObject) idfSession |
239 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 2/log4j.properties" ); |
240 | IDfSysObject cSys = (IDfSysObject) idfSession |
241 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 1/trace.log" ); |
242 |
243 | pSys.setIsVirtualDocument( true ); |
244 | pSys.save(); |
245 | IDfVirtualDocument vDoc = pSys.asVirtualDocument( "CURRENT" , false ); |
246 | IDfVirtualDocumentNode pNode = vDoc.getRootNode(); |
247 | pSys.checkout(); |
248 |
249 | IDfVirtualDocumentNode nodeChild1 = vDoc.addNode(pNode, null , cSys |
250 | .getChronicleId(), "CURRENT" , false , false ); |
251 |
252 | pSys.checkin( false , "CURRENT" ); |
253 | } |
254 |
255 | public void viewVirtualDocument() throws Exception { |
256 |
257 | IDfSysObject pSys = (IDfSysObject) idfSession |
258 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 2/log4j.properties" ); |
259 | if (pSys.isVirtualDocument()) { |
260 | System.out.println( "virtual document –> true" ); |
261 | IDfVirtualDocument vDoc = pSys.asVirtualDocument( "CURRENT" , false ); |
262 | IDfVirtualDocumentNode pNode = vDoc.getRootNode(); |
263 |
264 | System.out.println( "Iterating thru the lis to get the child nodes" ); |
265 | for ( int i = 0 ; i < pNode.getChildCount(); i++) { |
266 | IDfVirtualDocumentNode cNode = pNode.getChild(i); |
267 | System.out.println( "Child Name " |
268 | + cNode.getSelectedObject().getObjectName()); |
269 | } |
270 | } |
271 | } |
272 |
273 | public void exportVirtualDocument() throws Exception { |
274 |
275 | System.out.println( "exporting virtual document" ); |
276 |
277 | IDfClientX clientx = new DfClientX(); |
278 | IDfExportOperation expOperation = clientx.getExportOperation(); |
279 |
280 | IDfSysObject sysObject = (IDfSysObject) idfSession |
281 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 2/log4j.properties" ); |
282 | if (sysObject.isVirtualDocument()) { |
283 | IDfVirtualDocument Vdoc = sysObject.asVirtualDocument( "CURRENT" , |
284 | false ); |
285 | IDfExportNode expNode = (IDfExportNode) expOperation.add(sysObject); |
286 | expOperation.setDestinationDirectory(expOperation |
287 | .getDefaultDestinationDirectory()); |
288 | boolean flag = expOperation.execute(); |
289 | displayError(expOperation, flag); |
290 | } |
291 | } |
292 |
293 | public void cancelCheckoutDocument() throws Exception { |
294 |
295 | IDfClientX clientx = new DfClientX(); |
296 | IDfCancelCheckoutOperation cancelcheckoutOper = clientx |
297 | .getCancelCheckoutOperation(); |
298 | sysObject = (IDfSysObject) idfSession |
299 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 2/log4j.properties" ); |
300 |
301 | IDfCancelCheckoutNode node = (IDfCancelCheckoutNode) cancelcheckoutOper |
302 | .add(sysObject); |
303 | boolean flag = cancelcheckoutOper.execute(); |
304 | displayError(cancelcheckoutOper, flag); |
305 | } |
306 |
307 | public void checkoutDocument() throws Exception { |
308 |
309 | IDfClientX clientx = new DfClientX(); |
310 | IDfCheckoutOperation checkoutOper = clientx.getCheckoutOperation(); |
311 |
312 | System.out.println( "Checkout Dir " |
313 | + checkoutOper.getDefaultDestinationDirectory()); |
314 | checkoutOper.setDestinationDirectory(checkoutOper |
315 | .getDefaultDestinationDirectory()); |
316 |
317 | sysObject = (IDfSysObject) idfSession |
318 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 2/log4j.properties" ); |
319 |
320 | IDfCheckoutNode node = (IDfCheckoutNode) checkoutOper.add(sysObject); |
321 | boolean flag = checkoutOper.execute(); |
322 | displayError(checkoutOper, flag); |
323 |
324 | } |
325 |
326 | public void checkinDocument() throws Exception { |
327 |
328 | IDfClientX clientx = new DfClientX(); |
329 | IDfCheckinOperation checkinOper = clientx.getCheckinOperation(); |
330 |
331 | IDfCheckinNode node = (IDfCheckinNode) checkinOper.add(sysObject); |
332 | System.out.println( "Flag —->" + checkinOper.execute()); |
333 | } |
334 |
335 | public void importDocument() throws Exception { |
336 |
337 | IDfSysObject sysObject = (IDfFolder) idfSession |
338 | .getObjectByPath( "/Training Cabinet XXX/Folder Level 2" ); |
339 | System.out.println( "Object ID " + sysObject.getObjectId()); |
340 |
341 | IDfClientX clientx = new DfClientX(); |
342 | IDfImportOperation importOper = clientx.getImportOperation(); |
343 | importOper.setSession(idfSession); |
344 |
345 | if (importOper == null ) |
346 | System.out.println( "operation object is null" ); |
347 |
348 | importOper.setDestinationFolderId(sysObject.getObjectId()); |
349 | importOper.setVersionLabels( "imported using operation" ); |
350 |
351 | IDfImportNode node = (IDfImportNode) importOper |
352 | .add( "C:\\Documentum\\config\\log4j.properties" ); |
353 | node.setFormat( "pdf" ); |
354 |
355 | boolean flag = importOper.execute(); |
356 | displayError(importOper, flag); |
357 | } |
358 |
359 | public void displayError(IDfOperation operation, boolean flag) |
360 | throws Exception { |
361 |
362 | if (!flag) { |
363 |
364 | IDfList errlist = operation.getErrors(); |
365 |
366 | for ( int i = 0 ; i < errlist.getCount(); i++) { |
367 | IDfOperationError errOperation = (IDfOperationError) errlist |
368 | .get(i); |
369 | System.out.println( "Error MSG " + errOperation.getMessage()); |
370 | } |
371 | } |
372 | } |
373 |
374 | public void dmclAPI() throws Exception { |
375 |
376 | System.out.println( "Starting..." ); |
377 | IDfSysObject sysObj = (IDfSysObject) idfSession |
378 | .getObjectByQualification( "dm_document where object_name='Test-Document'" ); |
379 | String rObjectId = sysObj.getObjectId().getId(); |
380 |
381 | String name = (String) idfSession.apiGet( "get" , rObjectId+ ",object_name" ); |
382 | System.out.println( "Name : " + name); |
383 | // idfSession.apiSet("set",rObjectId+",title","sample-doc"); |
384 | idfSession.apiExec( "link" ,rObjectId+ ",/Training Cabinet XXX/Folder Level 2" ); |
385 | System.out.println( "Linked " + idfSession.apiExec( "save" , rObjectId)); |
386 | } |
387 |
388 | public void collection() throws Exception { |
389 |
390 | IDfQuery query = new DfQuery(); |
391 | query |
392 | .setDQL( "select * from dm_document where object_name='New Document' and any r_version_label like 'CURRENT%'" ); |
393 | IDfCollection coll = query.execute(idfSession, 0 ); |
394 |
395 | while (coll.next()) { |
396 | IDfTypedObject typeObject = (IDfTypedObject) coll.getTypedObject(); |
397 | System.out.println( "Object Name " |
398 | + typeObject.getString( "r_object_id" )); |
399 | System.out.println( "creation date " |
400 | + typeObject.getString( "r_creation_date" )); |
401 | } |
402 |
403 | if (coll != null ) |
404 | coll.close(); |
405 | } |
406 |
407 | public void startWorkflow() throws Exception { |
408 |
409 | // to get the attachment document |
410 | IDfSysObject sysObj = (IDfSysObject) idfSession |
411 | .getObjectByQualification( "dm_document where object_name='DFCtest'" ); |
412 |
413 | // to get the Workflow Template |
414 | IDfProcess process = (IDfProcess) idfSession |
415 | .getObjectByQualification( "dm_process where object_name like '%INDIA_TIMES%'" ); |
416 |
417 | // to create a Workflo Builder to start a workflow |
418 | IDfWorkflowBuilder builder = idfSession.newWorkflowBuilder(process |
419 | .getObjectId()); |
420 | IDfId wfId = builder.initWorkflow(); |
421 |
422 | // get the First Activity |
423 | IDfList startActivityNames = builder.getStartActivityNames(); |
424 | IDfList startActivities = builder.getStartActivityIds(); |
425 | String activityName = startActivityNames.getString( 0 ); |
426 | IDfId activityID = (IDfId) startActivities.get( 0 ); |
427 | IDfActivity activity = (IDfActivity) idfSession.getObject(activityID); |
428 |
429 | // to get the Package Name , Port and Package DocType |
430 | int nPorts = activity.getPortCount(); |
431 | String InputPortName = null ; |
432 | String PkgType = null ; |
433 | String PkgName = null ; |
434 |
435 | for ( int j = 0 ; j < nPorts; j++) { |
436 | System.out.println( "Port Name: " + activity.getPortName(j) + ", " |
437 | + "Port Type = " + activity.getPortType(j)); |
438 |
439 | if (activity.getPortType(j).equals( "INPUT" )) { |
440 | InputPortName = activity.getPortName(j); |
441 | PkgType = activity.getPackageType(j); |
442 | PkgName = activity.getPackageName(j); |
443 | } |
444 | } |
445 |
446 | // to Add the attachment document to List |
447 | IDfList dfList = new DfList(); |
448 | dfList.append(sysObj.getObjectId()); |
449 |
450 | IDfId wfId2 = builder.runWorkflow(); |
451 | // Add a Package to Workflow Builder |
452 | builder.addPackage(activityName, InputPortName, PkgName, PkgType, null , |
453 | false , dfList); |
454 | System.out.println( "package added" ); |
455 |
456 | } |
457 |
458 | public void getInbox() throws Exception { |
459 | // IDfCollection getTasks(String userName, int filter, String additionalAttributes, String orderBy) |
460 | IDfCollection tasks = idfSession.getTasks( "huoadm" , IDfSession.DF_TASKS, "name, date_sent, message " , "task_name" ); |
461 |
462 | try { |
463 | while (tasks.next()) { |
464 | IDfWorkitem wi = (IDfWorkitem) idfSession.getObject(tasks.getId( "item_id" )); |
465 | IDfId queueItemId = wi.getQueueItemId(); |
466 | IDfQueueItem qi = (IDfQueueItem) idfSession.getObject(queueItemId); |
467 | System.out.println(tasks.getString( "sent_by" ) + " " |
468 | + tasks.getString( "task_name" ) + " " |
469 | + tasks.getString( "date_sent" ) + " " |
470 | + tasks.getString( "message" ) + " " |
471 | + qi.getItemName()); |
472 | IDfActivity dfActivity = wi.getActivity(); |
473 | System.out.println( "\tActivity Information : " + dfActivity.getString( "object_name" )); |
474 | IDfCollection packColl = null ; |
475 | try { |
476 | packColl = wi.getPackages( "" ); |
477 | while (packColl.next()) { |
478 | IDfSysObject sysObj = (IDfSysObject) idfSession.getObject(packColl.getId( "r_component_id" )); |
479 | System.out.println( "\t Package Information: " + sysObj.getString( "object_name" )); |
480 | } |
481 | |
482 | } finally { |
483 | if (packColl != null ) |
484 | packColl.close(); |
485 | } |
486 | // to finish a Task or Workitem |
487 | // finishTask(wi); |
488 | } |
489 | } finally { |
490 | if (tasks != null ) |
491 | tasks.close(); |
492 | } |
493 | } |
494 |
495 | public void finishTask(IDfWorkitem wi) throws Exception { |
496 |
497 | if (wi.getRuntimeState() == IDfWorkflow.DF_WF_STATE_DORMANT) { |
498 | wi.acquire(); |
499 | } |
500 | wi.complete(); |
501 | } |
502 |
503 | public void attachLC() throws Exception { |
504 |
505 | IDfSysObject mDocs = (IDfSysObject) idfSession |
506 | .getObjectByQualification( "dm_document where object_name='UniqueDoc' " ); |
507 |
508 | IDfSysObject procObj = (IDfSysObject) idfSession |
509 | .getObjectByQualification( "dm_policy where object_name='Training_LC' " ); |
510 | mDocs.attachPolicy(procObj.getObjectId(), "Author" , "" ); |
511 |
512 | } |
513 |
514 | public void promoteLC(String State) throws Exception { |
515 | IDfSysObject mDocs = (IDfSysObject) idfSession |
516 | .getObjectByQualification( "dm_document where object_name='UniqueDoc' " ); |
517 | mDocs.promote(State, false , false ); |
518 | } |
519 |
520 | public void demoteLC(String State) throws Exception { |
521 | IDfSysObject mDocs = (IDfSysObject) idfSession |
522 | .getObjectByQualification( "dm_document where object_name='UniqueDoc' " ); |
523 | mDocs.demote(State, false ); |
524 | } |
525 |
526 | public void expireLC(String State) throws Exception { |
527 | IDfSysObject mDocs = (IDfSysObject) idfSession |
528 | .getObjectByQualification( "dm_document where object_name='UniqueDoc' " ); |
529 | mDocs.suspend(State, false , false ); |
530 | } |
531 |
532 | public void resumeLC(String State) throws Exception { |
533 | IDfSysObject mDocs = (IDfSysObject) idfSession |
534 | .getObjectByQualification( "dm_document where object_name='UniqueDoc' " ); |
535 | mDocs.resume(State, false , false , false ); |
536 | } |
537 |
538 |
539 | public void assignACL() throws Exception { |
540 |
541 | IDfSysObject mDocs = (IDfSysObject) idfSession |
542 | .getObjectByQualification( "dm_document where object_name='UniqueDoc' " ); |
543 | IDfACL dfACL = (IDfACL) idfSession |
544 | .getObjectByQualification( "dm_acl where object_name='TrainingACL' " ); |
545 | mDocs.setACL(dfACL); |
546 | mDocs.save(); |
547 | } |
548 |
549 | |
550 | public static void main(String[] args) throws Exception { |
551 |
552 | String user = "huoadm" ; |
553 | String passwd = "pass_4_huoadm" ; |
554 | String docbase = "MY_DOCBASE_DEV" ; |
555 | DFCWorkShop object = new DFCWorkShop(user, passwd, docbase); |
556 |
557 | try { |
558 |
559 | // To get a list of available docbase |
560 | /* |
561 | Session created successfully |
562 | Docbase Name : MY_DOCBASE2_DEV |
563 | Docbase Desc : Company Repository 2 |
564 | Docbase Name : MY_DOCBASE_DEV |
565 | Docbase Desc : Company Repository |
566 | Docbase Name : GLOBALR |
567 | Docbase Desc : Global Registry Repository |
568 | Docbase Name : MY_DOCBASE3_DEV |
569 | Docbase Desc : Company Repository 3 |
570 | Docbase Name : MY_DOCBASE4_DEV |
571 | Docbase Desc : Company Repository 4 |
572 | */ |
573 | // object.getAllDocbases(); |
574 |
575 | // To create a cabinet (dm_cabinet) in docbase |
576 | // object.createCabinet(); |
577 |
578 | // To create a folder (dm_folder object) in docbase |
579 | // object.createFolder(); |
580 |
581 | // To create a document (dm_document object) in docbase |
582 | // object.createDocument(); |
583 |
584 | // To check out a document from docbase using IDfOperations |
585 | // object.checkoutDocument(); |
586 |
587 | // To check in a document to docbase using IDfOperations |
588 | // object.checkinDocument(); |
589 |
590 | // making use of IAPI methods |
591 | // object.dmclAPI(); |
592 |
593 | // To import a document into docbase |
594 | // object.importDocument(); |
595 |
596 | // To cancelcheckout a document into docbase |
597 | // object.cancelCheckoutDocument(); |
598 |
599 | // To check out a document from docbase |
600 | // object.checkoutDoc(); |
601 |
602 | // To check in a document to docbase |
603 | // object.checkinDoc(); |
604 |
605 | // To delete a document from docbase |
606 | // object.deleteDoc(); |
607 |
608 | // To update document's in docbase |
609 | // object.updateAttributes(); |
610 |
611 | // To retrieve document's attributes from docbase |
612 | // object.getAttributes(); |
613 |
614 | // To create a virtual document in docbase |
615 | // object.createVirtualDocument(); |
616 |
617 | // To export a virtual document from docbase |
618 | // object.exportVirtualDocument(); |
619 |
620 | // To view virtual document from docbase |
621 | // object.viewVirtualDocument(); |
622 |
623 | // To retrieve document from document using IDQL |
624 | // object.collection(); |
625 |
626 | // To create and start workflow |
627 | // object.startWorkflow(); |
628 |
629 | // to view task in inbox |
630 | object.getInbox(); |
631 |
632 | // To attach a lifeCycle to a document in docbase |
633 | // object.attachLC(); |
634 |
635 | // To promote a lifeCycle state of a document |
636 | // object.promoteLC("Review"); |
637 |
638 | // To demote a lifeCycle state of a document |
639 | // object.demoteLC("Author"); |
640 |
641 | // To expire a lifeCycle state of a document |
642 | // object.expireLC("Author"); |
643 |
644 | // To resume a lifeCycle state of a document |
645 | // object.resumeLC("Author"); |
646 |
647 | // To assign a ACL to a document |
648 | // object.assignACL(); |
649 |
650 | } finally { |
651 | // to release a docbase session |
652 | object.releaseSession(); |
653 | } |
654 | } |
655 | } |
Kind regards,
Huseyin