Hi,

For some document types we have a requirement to automatically prefix the usual generated document name with an additional code:

i.e. instead of the document with title "My Test Document" getting the name "my-test-document", it would be something like "XYZ123-my-test-document"

I first looked into using an event handling listening to the aboutToCreate event, but this does not work as any changes to the document path of the passed-in DocumentModel are not reflected/persisted. (Cannot remember the details but the handling class keeps a reference to the original name/path and uses that instead of the name/path that comes back in the DocumentModel passed in the Event).

As a fall-back I decided to override DocumentActionsBean with my own class (higher Seam install precedence) and modified the saveDocument(DocumentModel) appropriately.

This all work fine.... except I've now noticed an odd issue.... ticking the file/folder list checkboxes in the UI do not work...

Hunting, I believe the problem is due to the Seam Remoting for DocumentActions not being setup correctly. The generated javascript should be:

Seam.Remoting.type.documentActions = function() {
 this.__callback = new Object();
Seam.Remoting.type.documentActions.prototype.processSelectRow = function(p0, p1, p2, p3, callback) { return Seam.Remoting.execute(this, "processSelectRow", [p0, p1, p2, p3], callback);
 }
Seam.Remoting.type.documentActions.prototype.checkCurrentDocAndProcessSelectRow = function(p0, p1, p2, p3, p4, callback) { return Seam.Remoting.execute(this, "checkCurrentDocAndProcessSelectRow", [p0, p1, p2, p3, p4], callback);
 }
Seam.Remoting.type.documentActions.prototype.checkCurrentDocAndProcessSelectPage = function(p0, p1, p2, p3, callback) { return Seam.Remoting.execute(this, "checkCurrentDocAndProcessSelectPage", [p0, p1, p2, p3], callback);
 }
Seam.Remoting.type.documentActions.prototype.processSelectPage = function(p0, p1, p2, callback) { return Seam.Remoting.execute(this, "processSelectPage", [p0, p1, p2], callback);
 }
}
Seam.Remoting.type.documentActions.__name = "documentActions";


but is:

Seam.Remoting.type.documentActions = function() {
 this.comment = undefined;
Seam.Remoting.type.documentActions.prototype.getComment = function() { return this.comment; } Seam.Remoting.type.documentActions.prototype.setComment = function(comment) { this.comment = comment; }
}

Seam.Remoting.type.documentActions.__name = "documentActions";
Seam.Remoting.type.documentActions.__metadata = [
 {field: "comment", type: "str"}];


I guess this is due to the @WebRemote method declarations now being on a superclass instead of the actual class. I could copy-and-paste the whole of the original DocumentActionsBean, but this seems nasty.

Does anyone have any ideas on how to achieve what I want (auto prefixing of document names) in a nice way? Should the aboutToCreate event allow one to change the document name?

Any help much appreciated.

Thanks and regards,

Sean


--
Dr. Sean Radford, MBBS, MSc
http://www.tacola.com/
t: +44 (0)845 KEY HELP
t: +44 (0)845 539 4357
m: +44 (0)7802 24 24 86

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to