Package de.xima.fc.user_portal.common
Class UserPortalFileUtils
- java.lang.Object
-
- de.xima.fc.user_portal.common.UserPortalFileUtils
-
public class UserPortalFileUtils extends Object
- Since:
- 8.4.0
- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description UserPortalFileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<UserPortalFileModel>
createFiles(List<de.xima.fc.api.rest.pub.client.form_record.model.BaseFormRecordAttachmentResource> attachments)
Creates a list of user portal file models from a list of attachment resources.static org.primefaces.model.StreamedContent
emptyStreamedContent()
Get an empty streamed content.static String
getDownloadLink(de.xima.fc.api.rest.pub.client.user_portal.model.BaseUserPortalFileResource resource)
Gets the download link for a file resource.static String
getDownloadLink(de.xima.fc.api.rest.pub.client.user.model.BaseUserProfileFileResource resource)
Gets the download link for a file resource.static byte[]
getFileData(Path file)
Get the binary data of a file on the file system as a byte array.static org.primefaces.model.StreamedContent
getStreamedContentFromFile(File file)
static String
getUniqueFileName(String fileName, List<String> fileNames)
-
-
-
Method Detail
-
getFileData
public static byte[] getFileData(Path file)
Get the binary data of a file on the file system as a byte array.- Parameters:
file
- The file for which to get the binary data.- Returns:
- The binary data of the file as a byte array.
-
emptyStreamedContent
public static org.primefaces.model.StreamedContent emptyStreamedContent()
Get an empty streamed content.- Returns:
- The empty streamed content.
-
getDownloadLink
public static String getDownloadLink(de.xima.fc.api.rest.pub.client.user_portal.model.BaseUserPortalFileResource resource)
Gets the download link for a file resource. This just returns thedownload
entries from the resourceslinks
section.- Parameters:
resource
- A file resource.- Returns:
- The download link for the file resource.
-
getDownloadLink
public static String getDownloadLink(de.xima.fc.api.rest.pub.client.user.model.BaseUserProfileFileResource resource)
Gets the download link for a file resource. This just returns thedownload
entries from the resourceslinks
section.- Parameters:
resource
- A file resource.- Returns:
- The download link for the file resource.
-
getStreamedContentFromFile
public static org.primefaces.model.StreamedContent getStreamedContentFromFile(File file)
-
createFiles
public static List<UserPortalFileModel> createFiles(List<de.xima.fc.api.rest.pub.client.form_record.model.BaseFormRecordAttachmentResource> attachments)
Creates a list of user portal file models from a list of attachment resources.- Parameters:
attachments
- The list of attachment resources.- Returns:
- A list of user portal file models.
-
-