2 Replies Latest reply on Jan 16, 2008 9:43 AM by jdelaney

    setting extended properties on doc sets modify activity for each property?





      I'm using the "Recent Activity" widget which is how I noticed this.  I am extending doccreateaction to set custom extended properties for the document using getProperties().put().  I noticed after editing a doc that I would see multiple duplicate entries for the same timestamp in "Recent Activity" for the modified doc (create works fine in only showing 1 entry b/c I assume there can ever only be 1 create activity for a doc so it never gets duplicated).  I played around with how many properties I set on my docs and sure enough, the number of times it was duplicated corresponded to the number of properties I set.  So I'm assuming document.getProperties().put() sets a new modify activity flag on each call?  Is there a way to get around this so that it is not executing modify activities all the time?  I would assume the modify activity would only be set in doccreateaction when execute() is successful so it only gets recorded once but apparently that's not the case.  Thanks for any info.



        • Re: setting extended properties on doc sets modify activity for each property?

          hi James,


          I see how this would be a problem, I'm not sure I have a clean workaround for you, but two things (neither or which are great options) to try:

          a) set the document state of the document you're editing to something other than published, save your document, add your properties, and then republish the document. I'm not even sure how many times it'll show up in the Activity list this way, but it might be better.

          b) change the following blocks of code in your copy of ActivityListener:

               public void documentModified(final DocumentEvent event) {
                    Document doc = event.getDocument();
                  if (doc.getDocumentState().getState().equals(DocumentState.PUBLISHED.getState())) {
                      Community community = doc.getCommunity();
                      manager.addActivity(doc, community, doc.getUser(), Activity.Type.modified);


               public void documentAdded(final DocumentEvent event) {
                    Document doc = event.getDocument();
                  if (doc.getDocumentState().getState().equals(DocumentState.PUBLISHED.getState())) {
                      Community community = event.getCommunity();
                      manager.addActivity(doc, community, doc.getUser(), Activity.Type.created);

          so that in the 'if' statement you check the 'Type' key of the DocumentEvent params, if it's value is 'propertyAdd' or 'propertyModify' or 'propertyDelete' then you should be able to ignore the event and not add it to the queue.


          I'll push this thread around internally to see what people think about changing this behavior.