Skip to content

Commit

Permalink
[Misc] Apply javadoc formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tmortagne committed Jan 8, 2025
1 parent 3e901a8 commit 0dc8086
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@

/**
* Interface for operations related to temporary upload of attachments.
* <p>
* The idea of this API is to allow obtaining directly a temporary {@link XWikiAttachment} from a {@link Part} and to
* keep it in cache until it's saved.
* <P>
* The manager is handling a separated map of attachments for each {@link javax.servlet.http.HttpSession}.
*
* @version $Id$
Expand All @@ -53,8 +55,8 @@ public interface TemporaryAttachmentSessionsManager
* @param part the actual data that is uploaded.
* @return an attachment that is not saved yet but cached and contains the data of the given part.
* @throws TemporaryAttachmentException in case of problem when reading the part
* @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum
* filesize is reached)
* @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum filesize
* is reached)
*/
XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part)
throws TemporaryAttachmentException, AttachmentValidationException;
Expand All @@ -66,20 +68,22 @@ XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part)
* @param documentReference the reference of the document that the attachment should be attached to
* @param part the actual data that is uploaded
* @param filename an optional filename used instead of using {@link Part#getSubmittedFileName()}, ignored when
* {@code null} or blank
* {@code null} or blank
* @return an attachment that is not saved yet but cached and contains the data of the given part
* @throws TemporaryAttachmentException in case of problem when reading the part
* @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum
* filesize is reached)
* @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum filesize
* is reached)
* @since 14.9RC1
*/
XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part, String filename)
throws TemporaryAttachmentException, AttachmentValidationException;

/**
* Allow to temporarily attach the given instance of {@link XWikiAttachment} to the given document reference.
* <p>
* This can be useful if an API manipulates an {@link XWikiAttachment} without saving it, and want it to be
* discoverable when parsing a document through the download action for example.
* <p>
* Note that consumer of this API needs to be aware that the file attached to the {@link XWikiAttachment} might be
* deleted at the end of the session, as any temporary attachment.
*
Expand Down Expand Up @@ -110,6 +114,7 @@ void temporarilyAttach(XWikiAttachment attachment, DocumentReference documentRef

/**
* Retrieve a specific temporary attachment related to the given document reference and matching the given filename.
* <p>
* This method is only a helper to {@link #getUploadedAttachment(DocumentReference, String)}.
*
* @param attachmentReference the reference of the attachment to retrieve
Expand All @@ -129,7 +134,7 @@ default Optional<XWikiAttachment> getUploadedAttachment(AttachmentReference atta
* @param documentReference the reference for which to retrieve the temporary attachment.
* @param filename the filename to look for.
* @return {@code true} if the attachment have been found for deletion, {@code false} if no matching attachment
* could be find.
* could be find.
*/
boolean removeUploadedAttachment(DocumentReference documentReference, String filename);

Expand All @@ -139,13 +144,14 @@ default Optional<XWikiAttachment> getUploadedAttachment(AttachmentReference atta
*
* @param documentReference the reference for which to retrieve the temporary attachments.
* @return {@code true} if there was some temporary attachments in cache for the given document reference in the
* current user session, {@code false} if there was no matching temporary attachment in cache.
* current user session, {@code false} if there was no matching temporary attachment in cache.
*/
boolean removeUploadedAttachments(DocumentReference documentReference);

/**
* This method aims at attaching the {@link XWikiAttachment} that might have been previously temporary upload to the
* {@link XWikiDocument} they are targeting.
* <p>
* This method should only be called before performing a save of the document to actually persist them. Also note
* that this method cannot call {@link #removeUploadedAttachment(DocumentReference, String)} as removing the
* attachment would delete the data before they can be properly saved in the persistent storage. So the consumer of
Expand Down

0 comments on commit 0dc8086

Please sign in to comment.