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 Stringstatic final Stringprotected booleanIf true, show an editor for text files even if they are binary files or very large.protected IEntityListModel<T>protected ResourceContentBeanprotected SessionUserManagerFields inherited from class de.xima.fc.gui.bean.FCContextBean
systemUCFields inherited from class de.xima.fc.gui.common.utils.msg.AJSFContext
localeBean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleancheckResourceNameExist(String name) protected abstract booleancheckResourceNameExist(String name, T itemToExclude) voidcheckResourceUploads(UploadInfo uploadInfo) Before the files are uploaded, this checks for possible conflicts and other decisions the user has to make.voidcleanup()protected abstract TcreateResource(String fileName, byte[] data, String userName) abstract StringgetGeneratedUrl(T resource) org.primefaces.model.StreamedContentGeneratesStreamedContentfrom the List of all the marked resources contained within the model.getModel()protected abstract IEntityListModel<T>protected org.primefaces.model.StreamedContentgetStreamedContent(List<T> resources, String zipFileName) GeneratesStreamedContentfrom the given List of resources.booleanbooleanbooleanisImageResource(T resource) booleanisPreviewResource(T resource) booleanisReaderResource(T resource) booleanbooleanbooleanbooleanDeprecated.Use a more specific editor (JS, CSS etc.)booleanbooleanisSourceCodeResource(T resource) booleanbooleanisTextResource(T resource) voidResumes the file upload once all file conflicts have been resolved.protected abstract voidprotected voidprotected voidvoidResolves all file conflicts by using the currently selected resolution.voidresolveConflicts(EFileConflictResolution resolution) Resolves all current file conflicts by applying the given resolution to all conflicts.voidsetForceTextEdit(boolean forceTextEdit) voidsetModel(IEntityListModel<T> model) voidprotected abstract TupdateResource(String fileName, byte[] data, String userName) voidupload(org.primefaces.event.FileUploadEvent event) Uploads resource to BeanvoiduploadAndPersist(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, switchSubViewMethods inherited from class de.xima.fc.gui.bean.ABackendJSFContext
ec, findEntityContext, isDetached, isHasDBMethods 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, ucMethods 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, msgMethods 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()GeneratesStreamedContentfrom the List of all the marked resources contained within the model. If this list contains only a single entry theStreamedContentfor this resource will be returned. If the list contains more than one entry the resources will be packed into a zip file and the generatedStreamedContentof the zip file will be returned.- Returns:
- the
StreamedContentof all the marked model resources
-
upload
public void upload(org.primefaces.event.FileUploadEvent event) Uploads resource to Bean- Parameters:
event-FileUploadEventcontaining 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-FileUploadEventcontaining the new resource
-
getStreamedContent
protected org.primefaces.model.StreamedContent getStreamedContent(List<T> resources, String zipFileName) GeneratesStreamedContentfrom the given List of resources. If this list contains only a single entry theStreamedContentfor 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 generatedStreamedContentof 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
-