Print  
Gray star Gray star Gray star Gray star Gray star --Not rated--
1738 Visits 6 Comments
Created
Gary S Ribar Gary S Ribar
Kablink Component
  • Teaming

I am attempting to build a custom add entry controller whose purpose is to do some application specific work after an entry has been added.  I have done this successfully with both the modify entry controller and the view entry controller (for workflow changes).  The problem I am having is trying to get the entryId after the super has created the entry.  I did try getting the response's parameter map after the entry was created but it appears to only have the action and binderId in it.  I was thinking about just trying to get the most recent entry in the folder but that is potentially inaccurate.

Any thoughts would be appreciated.

Workflow
Process State Action
Discussion workflow Active
This entry is currently active
Attachments(0)
Entry History
Tags
 
Replies
Thumbnail Image
Jong Kim Jong Kim

No "clean" way of doing this. Are you working with a released version of Teaming (eg. Teaming 2.1), or would that meet your requirement if I made this easier in an upcoming release, that is, Teaming 3.0?

Thumbnail Image
Gary S Ribar Gary S Ribar
Modified by
Gary S Ribar Gary S Ribar
Aug 3, 2010 12:03 PM

I am working with 2.1 now but a 3.0 solution would be acceptable.

Thanks

Thumbnail Image
Gary S Ribar Gary S Ribar

I just noticed the module listener example and wondered if that might be a better way to go.  Any thoughts and what are the advantages/disadvantages of the different approaches?

Gary

Thumbnail Image
Jong Kim Jong Kim

The module listener can certainly help you achieve your goal without going up to Teaming 3.0. However, I don't think you can do what you intend to do just by using module listener alone. You would still need to extend the controller.

The module listener provides a general mechanism where any entry point (i.e., public method) defined in the module interface (eg. addEntry, modifyEntry, etc.) can be intercepted by a plugin module. In your specific use case, you could write a module listener around the addEntry method which would then store the ID of the newly created entry in a thread-local variable. Then, when the execution control backs out to your controller level, you can grab the stored ID value and use it in whatever way you want. The reason why you still need to extend the controller is because the module listener itself has no access to the HTTP response object. The sample program in the source repository should give you the details.

Regards,

/Jong

 

Thumbnail Image
Jong Kim Jong Kim

I re-structured AddEntryController to contain the following protected method:

protected FolderEntry addReply(ActionRequest request, ActionResponse response,
Long folderId, Long parentId, String definitionId,
InputDataAccessor inputData, Map fileItems, Map options)

You can override this method in your subclass, and grab the ID from the resulting FolderEntry, and put it in the response object.

This change is available from the Teaming 3.0 trunk.

Thumbnail Image
Gary S Ribar Gary S Ribar

Sounds good. Thanks

Skip Footer Toolbar