3

I am new to Documentum DFC and I write a code using DFC API to check out a document and it worked properly. But now I want to check in the same file with a new file that is present in my local pc's drive with. I have tried to search it but didn't find any good as well as easy answers.

I will be grateful to you, if some one provides me guidance here.

Alex K
  • 22,315
  • 19
  • 108
  • 236

3 Answers3

6

New version (requires VERSION privileges):

boolean keepLock = false;
String versionLabels = "";
IDfSysObject doc = (IDfSysObject) session.getObject(new DfId("0900000000000000"));
doc.checkout();
doc.setFile("C:\\temp\\temp.jpg"); // assuming you're using windows
doc.checkin(keepLock, versionLabels);
  • keepLock - whether to keep the document checked out after checkin operation
  • versionLabels - label(s) (in addition to the built-in ones which are configured elsewhere)

Same version (requires WRITE privileges):

IDfSysObject doc = (IDfSysObject) session.getObject(new DfId("0900000000000000"));
doc.fetch(null);
doc.setFile("C:\\temp\\temp.jpg"); // again, assuming the worst ;)
doc.save();

Note that fetch(null) is needed to make sure you have the most current version of the document at hand.

For both examples above the content file is replaced without any further magic. Be sure to rename the document as desired, and set the correct format if necessary, e.g.:

doc.setObjectName("new_name");
doc.setContentType("new_format");
eivamu
  • 3,025
  • 1
  • 14
  • 20
2
public void checkinDoc(String objectId) throws Exception 
{
    sysObject = (IDfSysObject) idfSession.getObjectByID(objectId);
    //sysObject = (IDfSysObject) idfSession.getObjectByPath("/Cabinet/Folder/Document");
    if (sysObject.isCheckedOut() ) { // if it is checked out
        sysObject.checkin(false,”CURRENT”);
    }
}
Walery Strauch
  • 6,792
  • 8
  • 50
  • 57
drbronson
  • 21
  • 1
  • 1
  • 2
1

Use setFile on the checked out document, then checkin.

David Pierre
  • 9,459
  • 4
  • 40
  • 32