Hi,
All of our documents get a assigned unique numbers through an SBO.
We have a requirement that if a document is copied, it should get a new number. If it is moved, it should retain it's number.
I'm able to get this working if I override the doSaveAsNew method:
public IDfId doSaveAsNew (boolean shareContent, boolean copyRelations, Object[] extendedArgs)
throws DfException{
DfLogger.debug(this, "**** Entered method: doSaveasNew ****", null, null);
try {
DfLogger.debug(this, "Trying to set DEQ Number", null, null);
Util.setDocNameWithSBO(getSession(), this);
} catch (DfException dfe) {
DfLogger.error(this,"An error has occurred.", null, dfe);
}
IDfId idfid= super.doSaveAsNew(shareContent, copyRelations, extendedArgs);
IDfPersistentObject per = this.getSession().getObject(idfid);
DfLogger.info(this, "The document " + getObjectName() + " has been copied successfully.", null, null);
return idfid;
}
This works if I'm copying the document to a new folder. However, if I copy it to the same folder, it gets a name like
"Copy of Docname...."
I can see through the logs that if I copy to a different folder, it calls doSaveAsNew, but if I copy to the same folder, it only calls doSave.
Any help would be appreciated.