Class Attachments
- java.lang.Object
-
- org.silverpeas.core.contribution.attachment.model.Attachments
-
public class Attachments extends Object
A collection of files attached or in being attached to a contribution in Silverpeas. With this class we can operate on a whole of a contribution's attachments instead of each one of them.- Author:
- mmoquillon
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attachTo(Contribution contribution)
Attaches all the files to the specified contribution.void
attachTo(LocalizedContribution contribution)
Attaches all the files to the specified localized contribution.static Attachments
from(Collection<UploadedFile> uploadedFiles)
Creates a collection of attachments from the specified uploaded files.static Attachments
from(Map<String,String[]> fileParameters)
Creates a collection of attachments from the specified parameters some previously uploaded files.boolean
isEmpty()
-
-
-
Method Detail
-
from
public static Attachments from(Collection<UploadedFile> uploadedFiles)
Creates a collection of attachments from the specified uploaded files.- Parameters:
uploadedFiles
- a collection of uploaded files.- Returns:
- an
Attachments
representing the collection of uploaded files.
-
from
public static Attachments from(Map<String,String[]> fileParameters)
Creates a collection of attachments from the specified parameters some previously uploaded files.- Parameters:
fileParameters
- parameters on the uploaded files so that they can be retrieved.- Returns:
- an
Attachments
representing the collection of uploaded files.
-
isEmpty
public boolean isEmpty()
-
attachTo
public void attachTo(Contribution contribution)
Attaches all the files to the specified contribution. The default language of the platform is used to set the language of each of the attachment.- Parameters:
contribution
- the contribution to which the attachments have to be attached.
-
attachTo
public void attachTo(LocalizedContribution contribution)
Attaches all the files to the specified localized contribution. The localization of the contribution is used to set the localization of each attachment.In the case the contribution is a localized instance of an i18n contribution, then its expected the attachments are for this instance and hence their localization matches the one of the localized contribution.
- Parameters:
contribution
- the contribution to which the attachments have to be attached.
-
-