public abstract class ABasicResourceBean<E extends IFileDataEntity<?>,T extends IFileProviding<?,E> & INameProviding & IDescriptionProviding> extends FCContextBean
AJSFContext.RedirectOptions, AJSFContext.RedirectOptionsBuilder
Modifier and Type | Field and Description |
---|---|
static String |
FILENAME_RESOURCES_SUFFIX |
static String |
FILENAME_RESOURCES_ZIP |
protected boolean |
forceTextEdit
If true, show an editor for text files even if they are binary files or very large.
|
protected IEntityListModel<T> |
model |
protected org.primefaces.model.file.UploadedFile |
upload |
protected String |
uploadFileName |
protected Integer |
uploadFileSize |
systemUC
Constructor and Description |
---|
ABasicResourceBean() |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
checkResourceNameExist(String name) |
void |
checkResourceUploads(UploadInfo uploadInfo)
Before the files are uploaded, this checks for possible conflicts and other decisions the user has to make.
|
void |
cleanup() |
protected abstract T |
createResource(String resourceName,
String description,
String fileName,
byte[] data,
String userName) |
List<FileConflict> |
getFileConflicts() |
String |
getGeneratedUrl() |
abstract String |
getGeneratedUrl(T resource) |
org.primefaces.model.StreamedContent |
getMarkedResources()
Generates
StreamedContent from the List of all the marked resources contained within the model. |
IEntityListModel<T> |
getModel() |
protected abstract IEntityListModel<T> |
getNewModel() |
EContentType |
getPreviewType() |
ResourceContentBean |
getResourceContentBean() |
String |
getResourceName() |
protected org.primefaces.model.StreamedContent |
getStreamedContent(List<T> resources,
String zipFileName)
Generates
StreamedContent from the given List of resources. |
String |
getUploadFileName() |
Integer |
getUploadFileSize() |
boolean |
hasResourceData() |
boolean |
isForceTextEdit() |
boolean |
isImageResource(T resource) |
boolean |
isPreviewResource(T resource) |
boolean |
isReaderResource(T resource) |
boolean |
isShowImagePreview() |
boolean |
isShowPreview() |
boolean |
isShowReaderPreview() |
boolean |
isShowTextPreview()
Deprecated.
Use a more specific editor (JS, CSS etc.)
|
boolean |
isShowTextPreviewBinary() |
boolean |
isSourceCodeResource(T resource) |
boolean |
isTextPreviewSizeExceeded() |
boolean |
isTextResource(T resource) |
void |
onConflictsDialogClose()
Resumes the file upload once all file conflicts have been resolved.
|
protected abstract void |
openResourceConflictDialog() |
protected void |
resetUploadValues() |
void |
resolveConflicts()
Resolves all file conflicts by using the currently selected resolution.
|
void |
resolveConflicts(EFileConflictResolution resolution)
Resolves all current file conflicts by applying the given resolution to all conflicts.
|
void |
setForceTextEdit(boolean forceTextEdit) |
void |
setModel(IEntityListModel<T> model) |
void |
setResourceContentBean(ResourceContentBean resourceContentBean) |
void |
setResourceName(String resourceName) |
void |
updateModel() |
protected void |
updateResource(byte[] data)
Processes uploaded resource
|
protected abstract T |
updateResource(String resourceName,
String newResourceName,
String description,
String fileName,
byte[] data,
String userName) |
void |
upload(org.primefaces.event.FileUploadEvent event)
Uploads resource to Bean
|
void |
uploadAndPersist(org.primefaces.event.FileUploadEvent event)
Uploads a file and persists it as a new resource
|
getNavigationBean, getSessionBean, isSetupUser, redirectToDashboard, setNavigationBean, setSessionBean, switchMainView, switchMainView, switchSubView, switchSubView
ec, isDetached, isHasDB
destroySessionBean, encodeURL, findBean, findBean, findBean, findBean, findBean, findBean, findBean, findCurrentView, getBeanName, getBeanName, getContext, getCurrentViewBean, getLocaleBean, getRequest, getResponse, getSession, getSession, getSessionAttribute, isMasterServerContext, loadLazy, redirect, redirect, redirect, redirect, redirectToDashboard, redirectToDashboard, setLocaleBean, setSessionAttribute, uc
addErrorMsg, addErrorMsg, addErrorMsg, addErrorMsg, addErrorMsg, addErrorMsg, addErrorMsgFromString, addErrorMsgFromString, addErrorMsgToComponent, addErrorMsgToComponent, addErrorMsgToComponent, addErrorMsgToComponent, addErrorMsgToComponent, addErrorMsgToComponent, addInfoMsg, addInfoMsg, addInfoMsg, addInfoMsg, addInfoMsgFromString, addInfoMsgFromString, addInfoMsgToComponent, addInfoMsgToComponent, addInfoMsgToComponent, addInfoMsgToComponent, addMsg, addMsg, addMsg, addMsg, addMsgs, addMsgToComponent, addMsgToComponent, addWarnMsg, addWarnMsg, addWarnMsg, addWarnMsg, addWarnMsgFromString, addWarnMsgFromString, addWarnMsgToComponent, addWarnMsgToComponent, addWarnMsgToComponent, addWarnMsgToComponent, cleanErrorMsg, getErrorMessage, getNewErrorMsg, getNewErrorMsg, getNewErrorMsg, getNewInfoMsg, getNewInfoMsg, getNewMsg, getNewWarnMsg, getNewWarnMsg
public static final String FILENAME_RESOURCES_ZIP
public static final String FILENAME_RESOURCES_SUFFIX
protected boolean forceTextEdit
protected IEntityListModel<T extends IFileProviding<?,E> & INameProviding & IDescriptionProviding> model
protected org.primefaces.model.file.UploadedFile upload
protected String uploadFileName
protected Integer uploadFileSize
public ResourceContentBean getResourceContentBean()
public void setResourceContentBean(ResourceContentBean resourceContentBean)
public String getResourceName()
public void setResourceName(String resourceName)
public String getUploadFileName()
public Integer getUploadFileSize()
public void updateModel()
public IEntityListModel<T> getModel()
public void setModel(IEntityListModel<T> model)
model
- the model to setpublic boolean hasResourceData()
public boolean isShowPreview()
public EContentType getPreviewType()
public boolean isShowImagePreview()
public boolean isShowReaderPreview()
@Deprecated public boolean isShowTextPreview()
public boolean isShowTextPreviewBinary()
public boolean isTextPreviewSizeExceeded()
public boolean isForceTextEdit()
public void setForceTextEdit(boolean forceTextEdit)
public boolean isPreviewResource(T resource)
public boolean isImageResource(T resource)
public boolean isReaderResource(T resource)
public boolean isTextResource(T resource)
public boolean isSourceCodeResource(T resource)
public List<FileConflict> getFileConflicts()
public void checkResourceUploads(UploadInfo uploadInfo)
uploadInfo
- Details about the files that are to be uploaded, such as the file name and the file size.public void resolveConflicts()
public void resolveConflicts(EFileConflictResolution resolution)
resolution
- Conflict resolution that is applied to all conflicts.public void onConflictsDialogClose()
public org.primefaces.model.StreamedContent getMarkedResources()
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.StreamedContent
of all the marked model resourcespublic void upload(org.primefaces.event.FileUploadEvent event)
event
- FileUploadEvent
containing the resourcepublic void uploadAndPersist(org.primefaces.event.FileUploadEvent event)
event
- FileUploadEvent
containing the new resourceprotected org.primefaces.model.StreamedContent getStreamedContent(List<T> resources, String zipFileName)
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.protected void updateResource(byte[] data)
protected void resetUploadValues()
protected abstract IEntityListModel<T> getNewModel()
protected abstract T createResource(String resourceName, String description, String fileName, byte[] data, String userName) throws Exception
Exception
protected abstract T updateResource(String resourceName, String newResourceName, String description, String fileName, byte[] data, String userName) throws Exception
Exception
protected abstract boolean checkResourceNameExist(String name)
protected abstract void openResourceConflictDialog()
@PreDestroy public void cleanup()
public String getGeneratedUrl()
Copyright © 2021 XIMA MEDIA GmbH. All rights reserved.