On 01/06/2010 04:58 PM, Caleb James DeLisle wrote:
Sounds good.
+1
canDelete() means this user has permission to remove from recycle bin?
There are two checks, first is the permission one, second is the minimum
age (configurable, by default 7 days for non-admins, 0 days for admins).
I was confused at first glance because it's
already deleted.
If you have a better name, please say it. Purge would be good.
PermanentlyDelete and DeleteFromTrash are a bit too long. Delete is good
for consistency, since it's the term used for all other types of
entities, and it's a common name in computer storage.
IMO it's your call.
Caleb
Sergiu Dumitriu wrote:
> Hi devs,
>
> In order to solve the ancient XWIKI-37 (Deleted attachments not
> accessible via document history) and XWIKI-2254 (Attachment recycle
> bin), we need an API for accessing and handling deleted attachments.
> Note that the functionality already exists, it only needs to be
> exposed.
>
> I have implemented an API similar to the one for deleted documents:
> (a) the class com.xpn.xwiki.api.DeletedAttachment:
> - public DeletedAttachment(com.xpn.xwiki.doc.DeletedAttachment,
> XWikiContext);
> - public String getFilename();
> - public String getDocName();
> - public long getDocId();
> - public Date getDate();
> - public String getDeleter();
> - public long getId();
> - public boolean canUndelete();
> - public boolean canDelete();
> - public com.xpn.xwiki.doc.DeletedAttachment getDeletedAttachment();
> - public Attachment getAttachment();
>
> (b) 3 getDeletedAttachment(s) methods in com.xpn.xwiki.api.XWiki:
> - public List<DeletedAttachment> getDeletedAttachments(String docName);
> - public List<DeletedAttachment> getDeletedAttachments(String
> docName, String filename);
> - public DeletedAttachment getDeletedAttachment(String docName,
> String filename, String id);
> In addition, I need to find the right place for a delete() method.
> Since there was no delete() method for deleted documents either, I'd
> propose to:
>
> (c) add delete() to the DeletedAttachment and DeletedDocument API classes.
> The alternative is to add it to the XWiki class.
>
>
> I know that the old API should rarely be changed, since it is going to
> be replaced by the new model, but I think that this change is OK
> because:
> * I don't think the old API is going to be removed that soon
> * The change is not dangerous because it only adds new stuff, and does
> not modify or remove anything
> * The added functionality is very similar to the existing one for
> deleted documents, so it doesn't really add new stuff, it adds missing
> stuff that should have already been there for a long time.
> * It would be nice for our users to be able to manage deleted
> attachments now, not much later when the new model is fully adopted.
>
> To sum up, I'm +1 for:
>
> 1) adding the API for deleted attachments ( see above (a) and (b) )
> 2) adding a delete() method to the DeletedAttachment and
> DeletedDocument API classes (c).
--
Sergiu Dumitriu
http://purl.org/net/sergiu/