Package de.xima.fc.gui.bean.resource
Class ABasicResourceBean<E extends IFileDataEntity<?>,T extends IFileProviding<?,E> & INameProviding & IDescriptionProviding>
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClientResourceBean
,ProjectResourceBean
public abstract class ABasicResourceBean<E extends IFileDataEntity<?>,T extends IFileProviding<?,E> & INameProviding & IDescriptionProviding>
extends FCContextBean
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.xima.fc.gui.common.utils.msg.AJSFContext
AJSFContext.RedirectOptions, AJSFContext.RedirectOptionsBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
protected boolean
If true, show an editor for text files even if they are binary files or very large.protected IEntityListModel<T>
protected ResourceContentBean
protected SessionUserManager
Fields inherited from class de.xima.fc.gui.bean.FCContextBean
systemUC
Fields inherited from class de.xima.fc.gui.common.utils.msg.AJSFContext
localeBean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
checkResourceNameExist
(String name) protected abstract boolean
checkResourceNameExist
(String name, T itemToExclude) 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 fileName, byte[] data, String userName) abstract String
getGeneratedUrl
(T resource) org.primefaces.model.StreamedContent
GeneratesStreamedContent
from the List of all the marked resources contained within the model.getModel()
protected abstract IEntityListModel<T>
protected org.primefaces.model.StreamedContent
getStreamedContent
(List<T> resources, String zipFileName) GeneratesStreamedContent
from the given List of resources.boolean
boolean
boolean
isImageResource
(T resource) boolean
isPreviewResource
(T resource) boolean
isReaderResource
(T resource) boolean
boolean
boolean
boolean
Deprecated.Use a more specific editor (JS, CSS etc.)boolean
boolean
isSourceCodeResource
(T resource) boolean
boolean
isTextResource
(T resource) void
Resumes the file upload once all file conflicts have been resolved.protected abstract void
protected void
protected void
void
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
protected abstract T
updateResource
(String fileName, byte[] data, String userName) void
upload
(org.primefaces.event.FileUploadEvent event) Uploads resource to Beanvoid
uploadAndPersist
(org.primefaces.event.FileUploadEvent event) Uploads a file and persists it as a new resource if possible.Methods inherited from class de.xima.fc.gui.bean.FCContextBean
getNavigationBean, getSessionBean, isSetupUser, redirectToDashboard, setNavigationBean, setSessionBean, switchMainView, switchMainView, switchSubView, switchSubView
Methods inherited from class de.xima.fc.gui.bean.ABackendJSFContext
ec, findEntityContext, isDetached, isHasDB
Methods inherited from class de.xima.fc.gui.common.utils.msg.AJSFContext
destroySessionBean, encodeURL, findBean, findBean, findBean, findBean, findBean, findBean, findBean, findCurrentView, findUserContext, getBeanName, getBeanName, getContext, getCurrentViewBean, getLocaleBean, getRequest, getResponse, getSession, getSession, getSessionAttribute, isMasterServerContext, loadLazy, redirect, redirect, redirect, redirect, redirectToDashboard, redirectToDashboard, redirectToDashboard, setLocaleBean, setSessionAttribute, uc
Methods inherited from class de.xima.fc.gui.common.utils.msg.MessageUtils
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, addMsgs, addMsgToComponent, addMsgToComponent, addWarnMsg, addWarnMsg, addWarnMsg, addWarnMsg, addWarnMsgFromString, addWarnMsgFromString, addWarnMsgToComponent, addWarnMsgToComponent, addWarnMsgToComponent, addWarnMsgToComponent, cleanErrorMsg, errorMsg, errorMsg, getErrorMessage, getNewErrorMsg, getNewErrorMsg, getNewErrorMsg, getNewInfoMsg, getNewInfoMsg, getNewMsg, getNewWarnMsg, getNewWarnMsg, msg
Methods inherited from class de.xima.fc.gui.common.utils.msg.I18nUtils
getFacesContext, getLocale, rbValue, rbValue, rbValue, rbValueOrDefault, rbValueOrDefault
-
Field Details
-
FILENAME_RESOURCES_ZIP
- See Also:
-
FILENAME_RESOURCES_SUFFIX
- See Also:
-
resourceContentBean
-
userManager
-
forceTextEdit
protected boolean forceTextEditIf true, show an editor for text files even if they are binary files or very large. -
model
protected IEntityListModel<T extends IFileProviding<?,E> & INameProviding & IDescriptionProviding> model
-
-
Constructor Details
-
ABasicResourceBean
public ABasicResourceBean()
-
-
Method Details
-
updateModel
public void updateModel() -
getModel
- Returns:
- the model
-
setModel
- Parameters:
model
- the model to set
-
hasResourceData
public boolean hasResourceData() -
isShowPreview
public boolean isShowPreview() -
getPreviewType
-
isShowImagePreview
public boolean isShowImagePreview() -
isShowReaderPreview
public boolean isShowReaderPreview() -
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
-
isImageResource
-
isReaderResource
-
isTextResource
-
isSourceCodeResource
-
getFileConflicts
-
checkResourceUploads
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
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()GeneratesStreamedContent
from the List of all the marked resources contained within the model. If this list contains only a single entry theStreamedContent
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 generatedStreamedContent
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) GeneratesStreamedContent
from the given List of resources. If this list contains only a single entry theStreamedContent
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 generatedStreamedContent
of the zip file will be returned. -
preCreate
-
preUpdate
-
getNewModel
-
createResource
-
updateResource
-
checkResourceNameExist
-
checkResourceNameExist
-
openResourceConflictDialog
protected abstract void openResourceConflictDialog() -
cleanup
@PreDestroy public void cleanup() -
getGeneratedUrl
-
getGeneratedUrl
-