Class ABasicResourceBean<E extends IFileDataEntity<?>,​T extends IFileProviding<?,​E> & INameProviding & IDescriptionProviding>

    • Constructor Detail

      • ABasicResourceBean

        public ABasicResourceBean()
    • Method Detail

      • updateModel

        public void updateModel()
      • setModel

        public void setModel​(IEntityListModel<T> model)
        Parameters:
        model - the model to set
      • hasResourceData

        public boolean hasResourceData()
      • isShowPreview

        public boolean isShowPreview()
      • isShowImagePreview

        public boolean isShowImagePreview()
      • isShowReaderPreview

        public boolean isShowReaderPreview()
      • isShowTextPreview

        @Deprecated
        public boolean isShowTextPreview()
        Deprecated.
        Use a more specific editor (JS, CSS etc.)
      • isShowTextPreviewBinary

        public boolean isShowTextPreviewBinary()
        Returns:
        Whether the currently selected resource should be displayed in a plain text / source code (according to its file extension), but cannot be displayed because it contains binary content (invalid UTF-8).
      • isTextPreviewSizeExceeded

        public boolean isTextPreviewSizeExceeded()
        Returns:
        Whether the currently selected resource should be displayed in a plain text / source code (according to its file extension), but cannot be displayed because it is too large.
      • isForceTextEdit

        public boolean isForceTextEdit()
      • setForceTextEdit

        public void setForceTextEdit​(boolean forceTextEdit)
      • isPreviewResource

        public boolean isPreviewResource​(T resource)
      • isImageResource

        public boolean isImageResource​(T resource)
      • isReaderResource

        public boolean isReaderResource​(T resource)
      • isTextResource

        public boolean isTextResource​(T resource)
      • isSourceCodeResource

        public boolean isSourceCodeResource​(T resource)
      • checkResourceUploads

        public void checkResourceUploads​(UploadInfo uploadInfo)
        Before the files are uploaded, this checks for possible conflicts and other decisions the user has to make.
        Parameters:
        uploadInfo - Details about the files that are to be uploaded, such as the file name and the file size.
      • resolveConflicts

        public void resolveConflicts()
        Resolves all file conflicts by using the currently selected resolution.
      • resolveConflicts

        public void resolveConflicts​(EFileConflictResolution resolution)
        Resolves all current file conflicts by applying the given resolution to all conflicts.
        Parameters:
        resolution - Conflict resolution that is applied to all conflicts.
      • onConflictsDialogClose

        public void onConflictsDialogClose()
        Resumes the file upload once all file conflicts have been resolved. When the conflict resolution was canceled, aborts the file upload.
      • getMarkedResources

        public org.primefaces.model.StreamedContent getMarkedResources()
        Generates StreamedContent from the List of all the marked resources contained within the model. If this list contains only a single entry the StreamedContent for this resource will be returned. If the list contains more than one entry the resources will be packed into a zip file and the generated StreamedContent of the zip file will be returned.
        Returns:
        the StreamedContent of all the marked model resources
      • upload

        public void upload​(org.primefaces.event.FileUploadEvent event)
        Uploads resource to Bean
        Parameters:
        event - FileUploadEvent containing the resource
      • uploadAndPersist

        public void uploadAndPersist​(org.primefaces.event.FileUploadEvent event)
        Uploads a file and persists it as a new resource if possible. If conflicts arise, a dialog will be shown for resolving the conflicts.
        Parameters:
        event - FileUploadEvent containing the new resource
      • getStreamedContent

        protected org.primefaces.model.StreamedContent getStreamedContent​(List<T> resources,
                                                                          String zipFileName)
        Generates StreamedContent from the given List of resources. If this list contains only a single entry the StreamedContent for this resource will be returned. If the list contains more than one entry the resources will be packed into a zip file with the specified filename and the generated StreamedContent of the zip file will be returned.
        Parameters:
        resources - List of the resources to generate StreamedContent for
        zipFileName - String name of the resulting zip file if more than one resource is contained within the given resource list
        Returns:
        the StreamedContent of all the marked model resources
      • preCreate

        protected void preCreate​(T resource)
      • preUpdate

        protected void preUpdate​(T resource)
      • createResource

        protected abstract T createResource​(String fileName,
                                            byte[] data,
                                            String userName)
      • updateResource

        protected abstract T updateResource​(String fileName,
                                            byte[] data,
                                            String userName)
      • checkResourceNameExist

        protected abstract boolean checkResourceNameExist​(String name)
      • checkResourceNameExist

        protected abstract boolean checkResourceNameExist​(String name,
                                                          T itemToExclude)
      • openResourceConflictDialog

        protected abstract void openResourceConflictDialog()
      • cleanup

        @PreDestroy
        public void cleanup()
      • getGeneratedUrl

        public String getGeneratedUrl()
      • getGeneratedUrl

        public abstract String getGeneratedUrl​(T resource)