Class FileDocument
- java.lang.Object
-
- com.jalios.jstore.BasicStorable
-
- com.jalios.jcms.Data
-
- com.jalios.jcms.Publication
-
- com.jalios.jcms.Content
-
- com.jalios.jcms.FileDocument
-
- All Implemented Interfaces:
EditableData
,JcmsConstants
,ImportConstants
,MashupConstants
,StrongLockable
,Searchable
,Storable
,JaliosConstants
,LangPropertyArgument
,TreeNode
,java.lang.Cloneable
,java.lang.Comparable<BasicStorable>
- Direct Known Subclasses:
DBFileDocument
public class FileDocument extends Content
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileDocument.AssociatedFileFilter
Filter files against a FileDocument instance to retrieve only File which are associated to the specified FileDocument (PDF file, txt file, thumbnail etc).static class
FileDocument.ContentTypeComparator<T extends FileDocument>
static class
FileDocument.ContentTypeSelector
This DataSelector selects all the FileDocument matching the given content type.static class
FileDocument.DeleteThumbnailListener
static class
FileDocument.DimensionsComparator<T extends FileDocument>
This comparators compare FileDocuments of image file type according to their dimensions.static class
FileDocument.DurationComparator<T extends FileDocument>
This comparators compare FileDocuments of audio file type according to their duration.static class
FileDocument.HiddenSelector
This DataSelector selects all the Hidden FileDocumentstatic class
FileDocument.MediaTypeSelector
This DataSelector selects all the FileDocument corresponding to the given media type.static class
FileDocument.SizeComparator<T extends FileDocument>
static class
FileDocument.SizeSelector
This DataSelector selects all the FileDocument in the given range size.-
Nested classes/interfaces inherited from class com.jalios.jcms.Publication
Publication.AdateComparator<T extends Publication>, Publication.AdateSelector, Publication.AudienceRightComparator<T extends Publication>, Publication.AudienceRightSelector, Publication.AuthorComparator<T extends Publication>, Publication.AuthorizedSelector, Publication.CanWorkOnSelector, Publication.DdateComparator<T extends Publication>, Publication.EdateComparator<T extends Publication>, Publication.EdateSelector, Publication.PdateComparator<T extends Publication>, Publication.PdateSelector, Publication.PopularityComparator<T extends Publication>, Publication.PstatusComparator<T extends Publication>, Publication.PstatusSelector, Publication.ReaderComparator<T extends Publication>, Publication.ReadRightSelector, Publication.RelatedCategoryComparator<T extends Publication>, Publication.RightComparator<T extends Publication>, Publication.SdateComparator<T extends Publication>, Publication.SdateSelector, Publication.TitleComparator<T extends Publication>, Publication.TrackedSelector, Publication.TypeComparator<T extends Publication>, Publication.UdateComparator<T extends Publication>, Publication.UdateSelector, Publication.UserContentSelector, Publication.VisibleStateSelector, Publication.VoteScoreComparator<T extends Publication>, Publication.WorkspaceAuthorSelector, Publication.WorkspaceComparator<T extends Publication>, Publication.WorkspaceSelector
-
Nested classes/interfaces inherited from class com.jalios.jcms.Data
Data.AuthorSelector, Data.CdateSelector, Data.DataNameComparator<T extends Data>, Data.DeletableSelector, Data.ImportSelector, Data.MdateSelector, Data.OpAuthorComparator<T extends Data>, Data.RowIdComparator<T extends Data>, Data.StrongLockSelector
-
Nested classes/interfaces inherited from class com.jalios.jstore.BasicStorable
BasicStorable.CdateComparator<T extends Storable>, BasicStorable.IdComparator<T extends Storable>, BasicStorable.MdateComparator<T extends Storable>
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
contentType
static java.lang.String
CTXT_CHECK_FILE_REFERRER
static java.lang.String
CTXT_FILE_MERGE
static java.lang.String
DEFAULT_DETAIL_VIEW_PROP
static java.lang.Class<? extends FileDocument>
defaultUploadClass
protected java.lang.String
description
protected java.util.HashMap<java.lang.String,java.lang.String>
descriptionML
static java.lang.String
DO_NOT_REMOVE_FILE
protected java.lang.String
filename
static int
HIDDEN_PSTATUS
static boolean
isDefaultDetailView
static java.lang.String
OPENOFFICE_MIMETYPE
static java.lang.String
OPENXML_PRESENTATION_MIMETYPE
protected java.lang.String
originalFilename
protected java.util.Date
pdfUploadDate
protected java.lang.String
remoteUri
static java.lang.String
REMOVE_ALL_FILES_ON_DELETE_PROP
static java.lang.String
REMOVE_FILE_PROP
static java.lang.String
THUMBNAIL_PREFIX
static java.lang.String
THUMBNAIL_REGEXP
protected java.util.Date
uploadDate
-
Fields inherited from class com.jalios.jcms.Publication
ACL_CAN_ATTACH_WS, adate, attachWorkspaceSet, ATTACHWS_CHECK_PUB_RIGHTS_PROP, authorizedGroupSet, authorizedMemberSet, authorizedMemberSetDBID, categories, categorySet, classificationLevel, CTRL_TOPIC_ADVANCED, CTRL_TOPIC_CATEGORIES, CTRL_TOPIC_WORKFLOW, CTX_PSTATUS_UPDATE, dbFriendlyURLSet, dbFriendlyURLSetInit, edate, extendedReadRightsDBData, friendlyURLSet, hasAttachWS, hasNoReadRightsDBData, hasNoReadRightsDBDataInitialized, indexMgr, isTracked, mainInstance, mainInstanceId, mainLanguage, majorVersion, mergeDate, mergeId, minorVersion, pdate, pstatus, PUBLICATION_WFNOTE, readAck, readerCount, restrictUpdateRights, roleMap, sdate, SYNC_ATTACH_WORKSPACE_MEDIA_ENABLED_PROP, templates, title, titleML, udate, updateGroupSet, updateMemberSet, voteCount, voteScore, weakDataImage, wfExpressAlarmEntry, wfReminderAlarmEntry, workflowId, workspace, workspaceId
-
Fields inherited from class com.jalios.jcms.Data
author, authorDBID, channel, DISPLAY_URL_EXTRA_INFO, extension, extraDataMap, extraDBDataMapToSaveOnOp, importMap, opAuthor, opDelegate, WRITE_IN_PROGRESS_EXTRA_INFO, WYSIWYG_INLINE_EDIT_REQUEST_PARAMETER
-
Fields inherited from class com.jalios.jstore.BasicStorable
cdate, ddate, id, isStoreCache, mdate, store
-
Fields inherited from interface com.jalios.jcms.mashup.ImportConstants
IMPORT_ALARM_MGR, IMPORT_AUTHOR_PROP, IMPORT_CATEGORY_DEFAULT, IMPORT_DC_ATTR, IMPORT_DC_STEP, IMPORT_DIR, IMPORT_ENABLED, IMPORT_JDOM_ELEMENT, IMPORT_LOG_FILE, IMPORT_LOG_MAX, IMPORT_OPTIONS, IMPORT_OPTIONS_DC_CONTEXT, IMPORT_ROOT_PROP, IMPORT_SOURCE_FILE, IMPORT_SOURCE_PREFIX_PROP, IMPORT_SOURCES_DIR, IMPORT_STEP_CLEAN, IMPORT_STEP_IMPORT, IMPORT_STEP_UPDATE_REF, IMPORT_WS_PROP
-
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
-
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DATA_DIRECTORY, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_MINI, PHOTO_MINI_HEIGHT, PHOTO_MINI_PROP_PREFIX, PHOTO_MINI_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_DIR, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
-
Fields inherited from interface com.jalios.jcms.mashup.MashupConstants
DATA_TAG, DATASET_TAG, FIELD_CLASS, FIELD_ENTRY, FIELD_ITEM, FIELD_KEY, FIELD_NAME, FIELD_TAG, FIELD_VALUE, FILE_FIELD, FILE_ID, FILE_MTIME, FILE_SIZE, FILE_TAG, FILE_TICKET, FILESET_TAG, RELATED_TAG
-
-
Constructor Summary
Constructors Constructor Description FileDocument()
FileDocument(FileDocument other)
FileDocument(Publication other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canBeUploadedBy(Member mbr)
Returns true a new version of the file can be uploaded for this document by the given member.boolean
canCreateCopy(Member mbr, boolean isWorkCopy)
This method override canCreateCopy() and returns true for workCopy and false otherwise (2 FileDocuments cannot target the same file)static boolean
canUploadTracks(FileDocument doc, Member member)
Check if this document should allow member to add tracks to it.ControllerStatus
checkDelete(Member mbr, java.util.Map context)
Checks if the deletion can be performedControllerStatus
checkIntegrity(java.util.Map context)
Checks whether or not data integrity constraints are respected.ControllerStatus
checkWrite(int op, Member mbr, boolean checkIntegrity, java.util.Map context)
In case of upload of a new document, and target doc class is Media (or a Media sub type), check that document is of valid type (image, audio, video, or flash).void
clearInternalCache()
Clear internal cache of this FileDocument.java.lang.String
computeSignature(boolean includePublicationFields, boolean hash)
Compute the signature of this publication.java.util.Set<java.io.File>
deleteAssociatedFiles()
Delete all the File associated to this FileDocument.boolean
deleteAssociatedPDF()
Delete the associated PDF to the current file.boolean
deleteThumbnails()
Delete every thumbnail of this FileDocument if there are any.static boolean
deleteThumbnails(java.io.File originalFile)
Delete every thumbnail associated to this FileDocument if there are any.static long
directoryToFileDocuments(java.io.File dir, java.io.FileFilter filter, FileDocument refFileDoc, Member opAuthor, java.util.Map<java.lang.String,? extends java.lang.Object> contextMap)
Create FileDocumens from all files in the specified directory (and its sub directory).void
discardCopy(Publication copy)
This method is called when the creation of copy or a work copy of this publication has failed.void
exportXmlField(java.lang.StringBuffer sb, int indentLevel)
Fills the given StringBuffer with Xml export of fields of this data.java.util.Date
generateUploadDate()
Generates an upload date consistent with the environment (ie the RDBMS)java.lang.String
getAbsDownloadUrl()
Returns the absolute download URL for this document.java.lang.String
getAbstract()
Returns the abstract of this publication in the channel's main language.java.lang.String
getAbstract(java.lang.String lang, boolean useDefault)
Retrieve the value of this FileDocument's abstract field (description) in the specified language.java.lang.String
getAccessibilityInformation(java.util.Locale locale, boolean htmlDisplay)
Returns a formatted string displaying accessibility information.java.util.Set<java.lang.String>
getAllFilePath()
Gives the set of all relatives path to all kind (image, media) of files linked from the given publication.java.lang.String
getAllWikiText()
Retrieve a String containing all the wiki text available for this FileDocument.java.lang.String
getAllWysiwygText()
Retrieve a String containing all the wiki text available for this FileDocument.java.util.Set<java.io.File>
getAssociatedFileSet()
Retrieve a Set of File associated to this FileDocument.java.io.File
getAssociatedPDF()
Returns the pdf associated with a FileDocument.static java.util.Comparator<FileDocument>
getComparator(java.lang.String str, boolean reverse)
Deprecated.java.lang.String
getContentType()
static <T extends FileDocument>
java.util.Comparator<T>getContentTypeComparator()
java.lang.String
getDataIcon()
Returns source information for the icon associated to this Data, either a relative path or sprite classes name.java.lang.String
getDataIconTitle(java.lang.String lang)
Returns the icon's tooltip.java.lang.String
getDataImage()
Returns a data image of this publication based on the image contains in its wiki or wysiwyg fields.java.lang.String
getDataImage(java.lang.String lang, boolean useDefault)
Retrieves the image path of this data.static java.lang.String
getDefaultContentType()
static java.lang.Class<? extends FileDocument>
getDefaultUploadClass()
Returns the default document class to use for upload.static Workflow
getDefaultWorkflow()
Returns the Default Workflow associated with FileDocumentjava.lang.String
getDescription()
java.lang.String
getDescription(java.lang.String lang)
java.lang.String
getDescription(java.lang.String lang, boolean useDefault)
java.util.HashMap<java.lang.String,java.lang.String>
getDescriptionML()
java.lang.String
getDimensions()
Returns the dimensions of the image in the following form: "{width}×{height}" (withouth quotes).static <T extends FileDocument>
java.util.Comparator<T>getDimensionsComparator()
java.lang.String
getDownloadName(java.lang.String lang)
Returns the (file) name to use to download this document.java.lang.String
getDownloadName(java.lang.String lang, boolean addVersion)
Returns the (file) name to use to download this document.java.lang.String
getDownloadTicket()
java.lang.String
getDownloadUrl()
Returns the download URL for this document.java.lang.String
getDownloadUrl(boolean relative)
Returns the download URL for this document.java.lang.String
getDownloadUrl(boolean relative, boolean encodeForHTMLAttribute)
Returns the download URL for this document.long
getDuration()
Returns the duration of the audio (reserved for audio files)static <T extends FileDocument>
java.util.Comparator<T>getDurationComparator()
java.lang.String
getExportXmlDataValue()
Returns a string representation of this data used by exportXml().static java.lang.String
getExtension(java.lang.String filename)
This method return the lowercase extension of a given file name it return string after last '.' of the filename.
ie.static java.lang.String
getExtension(java.lang.String filename, java.util.Set<java.lang.String> authorizedExtensions)
This method return the lowercase extension of a given file name it return string after last '.' of the filename.
ie.java.lang.Object
getFieldValue(java.lang.String fieldName, java.lang.String lang, boolean useDefault)
Gets theObject
value of the given field name for thisFileDocument
.java.io.File
getFile()
Returns the File object for the corresponding the filenamestatic FileDocument
getFileDocumentFromFile(java.io.File file)
Retrieves the first FileDocument bound to the given File.static FileDocument
getFileDocumentFromFilename(java.lang.String filename)
Retrieves the first FileDocument bound to the given filename.static java.io.File
getFileFromThumbnail(java.io.File thumbnailFile)
Retrieve the original File associated with the given thumbnail File.java.util.Date
getFileIndexingDate()
java.lang.String
getFilename()
Retrieve the path relative to the webapp of the file pointed by this FileDocument.
Example:upload/docs/image/jpg/welcome.gif
It should not start with a slash ("/").<T extends Data>
java.util.Set<T>getFileReferrerSet(java.lang.Class<T> clazz)
Returns all the data referring the file of this FileDocument (except this FileDocument itself).static java.lang.Class<? extends FileDocument>
getFirstDocumentClassAuthorized(Member member, Workspace workspace)
Retrieve the first document class authorized for publication by the specified member.static java.lang.Class<? extends FileDocument>
getFirstDocumentClassAuthorized(Member member, Workspace workspace, java.lang.String contentType)
Retrieve the first document class authorized for publication by the specified member and workspace, and the most relevant regarding specified contentType.static java.lang.Class<? extends FileDocument>
getFirstDocumentClassAuthorized(Member member, Workspace workspace, java.lang.String contentType, java.util.Map<java.lang.String,?> contextMap)
Retrieve the first document class authorized for publication by the specified member and workspace, and the most relevant regarding specified contentType.java.lang.String
getGenericContentType()
Returns the generic content-type of this FileDocument (eg "video" if content-type contains "video/mpeg").java.lang.String
getGenericThumbnail()
Returns a generic thumbnail for this FileDocument.long
getHeight()
Retrieve the height of the image represented by this filedoc.static FileDocument.HiddenSelector
getHiddenSelector()
java.lang.String
getIcon()
java.util.Date
getIndexedDate()
Deprecated.static FileDocument
getInstance(java.lang.Class<? extends FileDocument> clazz, java.lang.String filename, java.lang.String title, java.lang.String description, Category[] categories, Member author, Workspace ws)
Constructs a FileDocument from an existing file for the given class.static FileDocument
getInstance(java.lang.String filename)
Constructs a FileDocument from an existing file.static FileDocument
getInstance(java.lang.String filename, Member author, Workspace ws)
Constructs a FileDocument from an existing file.static FileDocument
getInstance(java.lang.String filename, java.lang.String title, java.lang.String description, Category[] categories)
Constructs a FileDocument from an existing file.static FileDocument
getInstance(java.lang.String filename, java.lang.String title, java.lang.String description, Category[] categories, Member author, Workspace ws)
Constructs a FileDocument from an existing file.long
getLastModified()
Returns the time that this filedocument was last modified.static java.util.Set<FileDocument>
getLockedDocumentSet(Workspace ws, Member mbr)
Returns the set of FileDocument which have a strong lock.java.lang.String
getMediaType()
Retrieves the media type of this FileDocument as a String.static FileDocument.MediaTypeSelector
getMediaTypeSelector(java.lang.String mediaType)
java.lang.String
getMetaData(java.lang.String tag)
Returns the value bound to the given metadatajava.util.Map<java.lang.String,java.lang.String>
getMetaDataMap()
Returns the map of metadatastatic java.lang.String[]
getNewDocumentDirectoryAndName(java.lang.String fileName, java.lang.String contentType)
Retrieves the file's name and the relative path of the directory to use for creation of a new FileDocument for the given file's name.
E.g : given file name"Présentation finale.ps"
, can return a path such as"upload/docs/application/postscript/2006/06/presentation-finale.ps"
static java.lang.String[]
getNewDocumentDirectoryAndName(java.lang.String fileName, java.lang.String contentType, java.util.Set<java.lang.String> authorizedExtensions)
Retrieves the file's name and the relative path of the directory to use for creation of a new FileDocument for the given file's name.
E.g : given file name"Présentation finale.ps"
, can return a path such as"upload/docs/application/postscript/2006/06/presentation-finale.ps"
static java.lang.String
getNewDocumentFilename(java.lang.String fileName)
Retrieves the relative path (==filename) to use for creation of a new FileDocument for the given file's name.
E.g : given file name"Présentation finale.ps"
, can return a path such as"upload/docs/application/postscript/2006/06/presentation-finale.ps"
static java.lang.String
getOriginalDocumentFromPDF(java.lang.String pdfFilename)
Returns the filename of the original document bound to the given PDF filename otherwise returns null.java.lang.String
getOriginalFilename()
java.util.Date
getPdfUploadDate()
Returns the date at which the Associated PDF file was uploaded (if uploaded by user).static java.lang.String
getQualifiedName(java.lang.String filename)
This method return the name of a given file without the extension.static java.lang.String
getRealContentType(java.lang.String contentType, java.lang.String extension)
This method retrieve the real content type from a given one.java.lang.String
getRemotePreviewUrl()
Returns the preview URL for Remote Document.java.lang.String
getRemoteThumbnailUrl()
Returns the thumbnail URL for Remote Document.java.lang.String
getRemoteUri()
java.lang.String[]
getSearchStrings()
Retrieve an array of String containing all the text that may be searched.long
getSize()
Returns the size of the file encapsulated by this FileDocument.static <T extends FileDocument>
java.util.Comparator<T>getSizeComparator()
java.lang.String
getThumbnail(int width, int height)
Returns the thumbnail of this document with the given width and height.static java.io.File
getThumbnailFile(java.io.File file, int maxWidth, int maxHeight)
Gets the File to use for a thumbnail of the given image file, using given dimensions.static java.io.File
getThumbnailFile(java.io.File file, int maxWidth, int maxHeight, boolean square)
Gets the File to use for a thumbnail of the given image file, using given dimensions.static java.io.File
getThumbnailFile(java.io.File file, int maxWidth, int maxHeight, boolean square, java.lang.String extension)
Gets the File to use for a thumbnail of the given image file, using given dimensions.static java.lang.String
getThumbnailFilename(java.lang.String originalFilename, int maxWidth, int maxHeight)
Returns the file name of the thumbnail to create given an original filename
Uses the following format for the new filename:
th-{maxWidth}x{maxHeight}-{originalFilename}.{ext}
where{ext}
is the file extension of the default thumbnail image format as specified with propertytag.thumbnail.format
static java.lang.String
getThumbnailFilename(java.lang.String originalFilename, int maxWidth, int maxHeight, boolean square)
Returns the file name of the thumbnail to create given an original filename
Uses the following format for the new filename:
th-{maxWidth}x{maxHeight}-{originalFilename}.{ext}
where{ext}
is the file extension of the default thumbnail image format as specified with propertytag.thumbnail.format
static java.lang.String
getThumbnailFilename(java.lang.String originalFilename, int maxWidth, int maxHeight, boolean square, java.lang.String extension)
Returns the file name of the thumbnail to create given an original filename
Uses the following format for the new filename:
th-{maxWidth}x{maxHeight}-{originalFilename}.{ext}
where{ext}
is the file extension of the default thumbnail image format as specified with propertytag.thumbnail.format
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>
getTracksMap()
Return a map containg all media tracks grouped by track kind.java.lang.String
getTypeInfo(java.lang.String lang)
Returns the information bound to the type this FileDocumentstatic java.lang.Class<? extends FileDocument>
getUploadClass(java.lang.String contentType)
Returns the FileDocument class to be used for the given contentType or null if no mapping is declared for this content-type.java.util.Date
getUploadDate()
Returns the date of the last upload.java.util.Set<Publication>
getWeakReferrerSet()
Returns the set of weak referrers.long
getWidth()
Retrieve the width of the image represented by this filedoc.boolean
hasDuration()
Returns true if this document has a duration (only for audio/video).boolean
hasStrongLock()
Deprecated.boolean
hasSubtitles()
Check if this document has subtitles attached to it.boolean
hasTrackKind(java.lang.String trackKind)
Check if this document has a kind of tracks attached to it.boolean
hasTracks()
Check if this document has track attached to it.void
importXml(org.jdom.Element elt, ImportOptions options)
Fill this data with the values contains in the JDOM element.protected void
importXmlFieldsWithReferences(org.jdom.Element elt, ImportOptions options)
void
initCopy(Member newAuthor)
Initialize this publication once it has been cloned for a copy (eg by duplicate.jsp)boolean
isAudio()
Returns true if this FileDocument is an audio file.boolean
isDefaultDetailView()
Returns true if this FileDocument must be viewed in detail by default.boolean
isFlash()
Returns true if this FileDocument is a flash file.static boolean
isGeneratedPDF(java.lang.String filename)
Returns true if the given filename is a PDF file generated with JCMS Universal.static boolean
isGenericContentType(java.lang.String contentType)
boolean
isImage()
Returns true if this FileDocument is an image.boolean
isIndexed()
boolean
isLocalFile()
Returns true if this document is a local (on this site) Document.boolean
isMedia()
Check if this FileDocument is a media file (ie : an image, audio, video or flash file)boolean
isRemote()
Returns true if this document is a Remote Document.boolean
isText()
Returns true if this FileDocument is a text file.static boolean
isThumbnail(java.io.File file)
Returns true if the given file is a thumbnail.boolean
isVideo()
Returns true if this FileDocument is a video file.boolean
isWebImage()
Returns true if this FileDocument contains an image displayable in a Web browser (i.e.ControllerStatus
mergeWith(FileDocument tgtDoc, Member loggedMember)
Merges this document with the given the document.protected void
performAfterWrite(int op, Member mbr, java.util.Map context)
Called to perform some action after the write.protected void
performBeforeWrite(int op, Member mbr, java.util.Map context)
Called to perform some action before the write.void
performDelete(Member mbr, java.util.Map context)
Performs data deletionvoid
performUpdate(Member mbr, java.util.Map context)
Performs data updateprotected void
prepareMergeCopy(Publication copy)
boolean
previewRemoteWithIFrame()
Returns true if this RemoteDocument can ben previewed with an iFrame.boolean
previewRemoteWithMedia()
Returns true if this RemoteDocument can be previewed as a media.void
setAbstract(java.lang.String lang, java.lang.String value)
Convenient method to set the value of the Abstract field in any language (default site language or any other).
depending on the specified language.void
setContentType(java.lang.String v)
void
setDescription(java.lang.String v)
void
setDescription(java.lang.String lang, java.lang.String value)
Convenient method to set the value of the Description field in any language (default site language or any other).
This method will set the proper field value (setDescription(String)
orsetDescriptionML(HashMap)
) depending on the specified language.void
setDescriptionML(java.util.HashMap<java.lang.String,java.lang.String> v)
void
setFieldValue(java.lang.String fieldName, java.lang.Object value, java.lang.String lang)
Sets the value of the givenObject
field name for the currentData
.void
setFilename(java.lang.String v)
void
setOriginalFilename(java.lang.String v)
void
setPdfUploadDate(java.util.Date date)
Set the date at which the Associated PDF file was uploaded (if uploaded by user).void
setRemoteUri(java.lang.String v)
void
setUploadDate(java.util.Date date)
Set the date of the last upload.boolean
showDownload(Member member)
Check if the download action should be proposed to the specified member.boolean
supportsThumbnail()
Returns true if a thumbnail can be generated for this document.long
unzipToFileDocuments(java.io.FileFilter filter, Member opAuthor)
Unzip this FileDocument to n FileDocument.static long
unzipToFileDocuments(java.io.File zipFile, java.io.FileFilter filter, FileDocument refFileDoc, Member opAuthor)
Unzip the specified File to n new FileDocument.-
Methods inherited from class com.jalios.jcms.Publication
ackRead, addAuthorizedGroup, addAuthorizedMember, addCategory, addFollower, addWeakReferrer, addWFExpressAlarm, addWFReminderAlarm, assignCommonPublicationFields, assignRole, assignRole, attachPublication, attachTo, canBeArchived, canBeArchived, canBeAttachedBy, canBeAttachedTo, canBeDetachedFrom, canBeEditedFieldByField, canBeFollowedBy, canBeReadBy, canBeReadBy, canBeReadBy, canBeReadBy, canBeVotedBy, canCreateCopy, canCreateCopy, canCreateWorkCopy, canMergeWorkCopy, canRequestUnlock, checkAndPerformTrash, checkAndPerformUntrash, checkCreate, checkIntegrity, checkLang, checkMember, checkMerge, checkStateChange, checkStateChange, checkTemplateEntry, checkTrash, checkUntrash, checkUpdate, cleanHybridCollections, clearTransientIndex, cloneDBDataCollections, computeSignature, containsCategory, createCopy, createCopy, createWFNote, createWFNote, createWorkCopy, createWorkCopy, detachFrom, exportXmlRelated, getAbstract, getAbstractAsText, getAbstractML, getAccessCount, getAdate, getAdateComparator, getAdateSelector, getAllCatIdSet, getAttachWorkspaceSet, getAttachWSIdSet, getAudiencedRightsString, getAudienceRightComparator, getAudienceRightSelector, getAuthGrpIdSet, getAuthMbrIdSet, getAuthorizedGroupSet, getAuthorizedMemberSet, getAuthorizedMemberSet, getAuthorizedMemberSetDBID, getAuthorizedSelector, getCanWorkOnSelector, getCategories, getCategories, getCategorySet, getCatIdSet, getClassificationLevel, getComparator, getComparator, getCSVHeader, getCurrentWorkerSet, getDataName, getDate, getDate, getDateSelector, getDBDataRevision, getDbFriendlyURLSet, getDdateComparator, getDefaultTemplateUsage, getDescendantCategorySet, getDescendantCategorySet, getDescendantCategorySet, getDisplayTemplateFile, getDocumentLinkSet, getEdate, getEdateComparator, getEdateSelector, getEffectiveClassificationLevel, getEstimatedReminderCount, getExtendedReadRights, getExternalLinkSet, getFieldInMainLanguage, getFirstDescendantCategory, getFirstDescendantCategory, getFirstDescendantCategory, getFollowerList, getFriendlyURLSet, getHasAttachWS, getHasNoReadRights, getImportConflictCopy, getImportVersion, getIndexingDate, getInternalWorkflow, getLinkDataSet, getMainInstance, getMainInstanceId, getMainLanguage, getMajorVersion, getMemberSetAssignedToRole, getMergeDate, getMergeId, getMinorVersion, getNextWFStateSet, getPdate, getPdateComparator, getPdateSelector, getPopularity, getPopularityComparator, getPstatus, getPstatusAlarmEntry, getPstatusComparator, getPstatusSelector, getPstatusSelector, getQueryTemplateFile, getReadAck, getReadAckCount, getReaderComparator, getReaderCount, getReaderTracker, getReaderTrackerList, getReadRightSelector, getReadRightsString, getReferrerSet, getRestrictUpdateRights, getRightComparator, getRoleMap, getRoleMapStr, getSdate, getSdateComparator, getSdateSelector, getTemplate, getTemplateEntry, getTemplateEntry, getTemplateEntrySet, getTemplatePath, getTemplatePath, getTemplates, getTitle, getTitle, getTitle, getTitleComparator, getTitleComparator, getTitleML, getTitleMLE, getTrackedSelector, getTreeChildren, getTreeParent, getTreeRoot, getTypeComparator, getTypeFieldLabel, getTypeLabel, getUdate, getUdateComparator, getUdateSelector, getUpdateGroupSet, getUpdateGrpIdSet, getUpdateMbrIdSet, getUpdateMemberSet, getVersionString, getVisibleStateSelector, getVoteCount, getVoteScore, getVoteScoreComparator, getVoteValue, getWFNoteList, getWFState, getWFStateLabel, getWFStateLabelHtml, getWorkCopySet, getWorkflow, getWorkflowId, getWorkspace, getWorkspaceAuthorSelector, getWorkspaceComparator, getWorkspaceId, getWorkspaceSelector, getWSTypeEntry, getWSTypeEntry, hasAlreadyVoted, hasAnyReadRights, hasBeenReadAckBy, hasBeenReadBy, hasCategory, hasImportConflict, hasNoReadRights, hasWeakReferrers, importConvertToLocal, importMarkAsMerged, importOverrideAndUpdate, init, initializeDBDataCollections, internalCanBeReadBy, invalidateWeakDataImage, isAudienced, isClassified, isDefaultTemplate, isFollowedBy, isImportConflictCopy, isInRole, isInVisibleState, isPublic, isRoleAssigned, isTracked, isTrashed, isTreeLeaf, isTreeNode, isUserContent, isUserContentType, isVersioned, isVotable, isWorkCopy, majorUpdate, notifyFollowers, performCreate, performMerge, performMerge, performTrash, performUntrash, putPstatusAlarmEntry, recomputeScore, removeAllDescendants, removeAllFollowers, removeAllReaderTracker, removeAuthorizedGroup, removeAuthorizedMember, removeCategory, removeDataSet, removeFollower, removeImportMetadata, removePstatusAlarmEntry, removeWeakReferrer, removeWFExpressAlarm, removeWFReminderAlarm, resolveTypeTemplateEntry, setAbstract, setAdate, setAllCatIdSet, setAttachWorkspaceSet, setAttachWSIdSet, setAuthGrpIdSet, setAuthMbrIdSet, setAuthorizedGroupSet, setAuthorizedMemberSet, setAuthorizedMemberSetDBID, setCategories, setCategorySet, setCatIdSet, setCdate, setClassificationLevel, setDbFriendlyURLSet, setEdate, setExtendedReadRights, setFriendlyURLSet, setHasAttachWS, setHasNoReadRights, setImportConflictCopy, setImportVersion, setMainInstance, setMainInstanceId, setMainLanguage, setMajorVersion, setMergeDate, setMergeId, setMinorVersion, setPdate, setPstatus, setReadAck, setReaderCount, setRestrictUpdateRights, setRoleMap, setRoleMapStr, setRoleMemberSetMap, setSdate, setTemplate, setTemplates, setTitle, setTitle, setTitleML, setTitleMLE, setTracked, setUdate, setUpdateGroupSet, setUpdateGrpIdSet, setUpdateMbrIdSet, setUpdateMemberSet, setVoteCount, setVoteScore, setWorkflow, setWorkflowId, setWorkspace, setWorkspaceId, splitHybridCollections, supportsClassification, toCSV, toFullString, toString, trackReader, trackReader, unassignMember, unassignRole, updateDisplayLinkCss, updateDisplayLinkDataAttribute, updatePstatus, updateTemplate
-
Methods inherited from class com.jalios.jcms.Data
canBeReadBy, canBeUnlockedBy, checkAndPerformCreate, checkAndPerformCreate, checkAndPerformDelete, checkAndPerformDelete, checkAndPerformUpdate, checkAndPerformUpdate, checkCreate, checkDelete, checkLockMember, checkStrongLockMember, checkStrongLockMember, checkUpdate, cleanHybridCollection, cleanHybridCollection, cleanHybridCollection, clone, computeDBIDArray, computeDBIDList, computeDBIDSet, exportXml, exportXml, exportXml, exportXml, exportXmlRelated, fillExportXmlFieldAttributes, getAllReferrerSet, getAllReferrerSet, getAllTypeFieldEntry, getAuthor, getAuthor, getAuthorComparator, getAuthorDBID, getAuthorId, getAuthorSelector, getBooleanFieldValue, getBooleanFieldValue, getCaddyComparator, getCategoryFieldValue, getCategoryFieldValue, getCdateSelector, getDataIconAlt, getDataIconCSS, getDataIconHtml, getDataIconHtml, getDataImage, getDataNameComparator, getDeletableSelector, getDisplayLink, getDisplayLink, getDisplayLink, getDisplayLinkCss, getDisplayLinkDataAttribute, getDisplayLinkHtmlAttributes, getDisplayUrl, getDoubleFieldValue, getDoubleFieldValue, getExtension, getExtraData, getExtraDataMap, getExtraDBData, getExtraDBDataMap, getExtraInfo, getExtraInfoMap, getFieldStatusMap, getFieldValue, getFieldValue, getFieldValue, getGenericThumbnail, getImportAuthor, getImportBatch, getImportDate, getImportDisplayUrl, getImportId, getImportMap, getImportMdate, getImportSelector, getImportSignature, getImportSource, getImportSourceUrl, getImportUrl, getIntFieldValue, getIntFieldValue, getLangPropertyValue, getLinkCount, getLinkIndexedDataSet, getLinkIndexedDataSet, getLockDate, getLockInfo, getLockMember, getLongFieldValue, getLongFieldValue, getMdateSelector, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getOpAuthor, getOpAuthorComparator, getOpAuthorId, getOpDelegate, getReadAuthorizedSelector, getReferrerSet, getRowId, getRowIdComparator, getStrongLock, getStrongLockContext, getStrongLockContextData, getStrongLockDate, getStrongLockInfo, getStrongLockMember, getStrongLockSelector, getTypeEntry, getTypeFieldsEntries, getUpdateInstance, getVirtualIDSet, importXmlFiles, importXmlReferences, isDBData, isImported, isImportUpdated, isInDatabase, isLocked, isPersisted, isStrongLocked, lock, markNewImport, mergeHybridLink, mergeHybridLink, performCreate, performDelete, performUpdate, prepareUpdateContext, printDataName, printDisplayLinkEnd, printDisplayLinkStart, printDisplayLinkStart, printDisplayUrl, printDisplayUrl, putStrongLock, putStrongLock, releaseStrongLock, releaseStrongLock, removeExtraData, removeExtraDBData, removeExtraInfo, setAuthor, setAuthorDBID, setAuthorId, setBooleanFieldValue, setCategoryFieldValue, setDoubleFieldValue, setExtension, setExtraData, setExtraDataMap, setExtraDBData, setExtraDBDataMap, setExtraDBDataMap, setExtraInfo, setFieldValue, setImportAuthor, setImportBatch, setImportDate, setImportDisplayUrl, setImportId, setImportMap, setImportMdate, setImportSignature, setImportSource, setImportSourceUrl, setImportUpdated, setIntFieldValue, setLongFieldValue, setMdate, setOpAuthor, setOpAuthorId, setOpDelegate, setRowId, unlock, unlock, unmarkNewImport, updateDisplayLinkHtmlAttributes, updateExtraDataMap, updateExtraDBDataMap, updateIndexTreeSet
-
Methods inherited from class com.jalios.jstore.BasicStorable
clearId, compareTo, equals, getAttribute, getAttributes, getCdate, getCdateComparator, getDdate, getId, getIdComparator, getMdate, getMdateComparator, getStore, getUrid, hasBeenUpdated, hashCode, isStored, resetInternalCaches, resolveAtt, resolveVal, setAttributes, setAttributes, setDdate, setId, setStore, toXml
-
-
-
-
Field Detail
-
HIDDEN_PSTATUS
public static final int HIDDEN_PSTATUS
- See Also:
- Constant Field Values
-
THUMBNAIL_PREFIX
public static final java.lang.String THUMBNAIL_PREFIX
- See Also:
- Constant Field Values
-
THUMBNAIL_REGEXP
public static final java.lang.String THUMBNAIL_REGEXP
- See Also:
- Constant Field Values
-
OPENXML_PRESENTATION_MIMETYPE
public static final java.lang.String OPENXML_PRESENTATION_MIMETYPE
- See Also:
- Constant Field Values
-
OPENOFFICE_MIMETYPE
public static final java.lang.String OPENOFFICE_MIMETYPE
- See Also:
- Constant Field Values
-
DEFAULT_DETAIL_VIEW_PROP
public static final java.lang.String DEFAULT_DETAIL_VIEW_PROP
- See Also:
- Constant Field Values
-
CTXT_CHECK_FILE_REFERRER
public static final java.lang.String CTXT_CHECK_FILE_REFERRER
- See Also:
- Constant Field Values
-
CTXT_FILE_MERGE
public static final java.lang.String CTXT_FILE_MERGE
- See Also:
- Constant Field Values
-
DO_NOT_REMOVE_FILE
public static final java.lang.String DO_NOT_REMOVE_FILE
- See Also:
- Constant Field Values
-
REMOVE_FILE_PROP
public static final java.lang.String REMOVE_FILE_PROP
- See Also:
- Constant Field Values
-
REMOVE_ALL_FILES_ON_DELETE_PROP
public static final java.lang.String REMOVE_ALL_FILES_ON_DELETE_PROP
- See Also:
- Constant Field Values
-
isDefaultDetailView
public static final boolean isDefaultDetailView
-
defaultUploadClass
public static java.lang.Class<? extends FileDocument> defaultUploadClass
-
description
protected java.lang.String description
-
descriptionML
protected java.util.HashMap<java.lang.String,java.lang.String> descriptionML
-
filename
protected java.lang.String filename
-
originalFilename
protected java.lang.String originalFilename
-
remoteUri
protected java.lang.String remoteUri
-
contentType
protected java.lang.String contentType
-
uploadDate
protected java.util.Date uploadDate
-
pdfUploadDate
protected java.util.Date pdfUploadDate
-
-
Constructor Detail
-
FileDocument
public FileDocument()
-
FileDocument
public FileDocument(Publication other)
-
FileDocument
public FileDocument(FileDocument other)
-
-
Method Detail
-
getInstance
public static FileDocument getInstance(java.lang.String filename)
Constructs a FileDocument from an existing file. The FileDocument is not created in the store.- Parameters:
filename
- the filename. It must be relative to the context path- Returns:
- a FileDocument wrapped to the given file or null if this file does not exist
- Since:
- jcms-4.0
-
getInstance
public static FileDocument getInstance(java.lang.String filename, Member author, Workspace ws)
Constructs a FileDocument from an existing file. The FileDocument is not created in the store.- Parameters:
filename
- the filename. It must be relative to the context pathauthor
- the author of the document or nullws
- the workspace of the publication- Returns:
- a FileDocument wrapped to the given file or null if this file does not exist
- Since:
- jcms-5.6.0
-
getInstance
public static FileDocument getInstance(java.lang.String filename, java.lang.String title, java.lang.String description, Category[] categories)
Constructs a FileDocument from an existing file. The FileDocument is not created in the store.- Parameters:
filename
- the filename. It must be relative to the context pathtitle
- a proposed title (if null, use the name without its extension as title)description
- the description (may be null)categories
- the categories (may be null)- Returns:
- a FileDocument wrapped to the given file or null if this file does not exist
- Since:
- jcms-4.0
-
getInstance
public static FileDocument getInstance(java.lang.String filename, java.lang.String title, java.lang.String description, Category[] categories, Member author, Workspace ws)
Constructs a FileDocument from an existing file. The FileDocument is not created in the store.- Parameters:
filename
- the filename. It must be relative to the context pathtitle
- a proposed title (if null, use the name without its extension as title)description
- the description (may be null)categories
- the categories (may be null)author
- the author of the document or nullws
- the workspace of the publication- Returns:
- a FileDocument wrapped to the given file or null if this file does not exist
- Since:
- jcms-5.6.0
-
getInstance
public static FileDocument getInstance(java.lang.Class<? extends FileDocument> clazz, java.lang.String filename, java.lang.String title, java.lang.String description, Category[] categories, Member author, Workspace ws)
Constructs a FileDocument from an existing file for the given class. The FileDocument is not created in the store.- Parameters:
clazz
- the FileDocument class to instanciatefilename
- the filename. It must be relative to the context pathtitle
- a proposed title (if null, use the name without its extension as title)description
- the description (may be null)categories
- the categories (may be null)author
- the author of the document or nullws
- the workspace of the publication- Returns:
- a FileDocument wrapped to the given file or null if this file does not exist
- Since:
- jcms-6.2.0
-
getUploadClass
public static java.lang.Class<? extends FileDocument> getUploadClass(java.lang.String contentType)
Returns the FileDocument class to be used for the given contentType or null if no mapping is declared for this content-type. Mapping is declared with properties such as :file-document.upload.class.image: generated.Media
- Parameters:
contentType
- the contentType (eg. image/jpeg, video/mp4, ...)- Returns:
- Return the FileDocument class to be used for the given contentType.
- Since:
- jcms-10.0.0
-
getDefaultUploadClass
public static java.lang.Class<? extends FileDocument> getDefaultUploadClass()
Returns the default document class to use for upload.- Returns:
- the default document class to use for upload.
- Since:
- jcms-10.0.0
-
getFirstDocumentClassAuthorized
public static java.lang.Class<? extends FileDocument> getFirstDocumentClassAuthorized(Member member, Workspace workspace)
Retrieve the first document class authorized for publication by the specified member.- Parameters:
member
- the member for which to perform the verificationworkspace
- the workspace in which to perform the verification- Returns:
- a FileDocument type class (or null if no class has been found)
- Since:
- jcms-10.0.0
-
getFirstDocumentClassAuthorized
public static java.lang.Class<? extends FileDocument> getFirstDocumentClassAuthorized(Member member, Workspace workspace, java.lang.String contentType)
Retrieve the first document class authorized for publication by the specified member and workspace, and the most relevant regarding specified contentType.- Parameters:
member
- the member for which to perform the verificationworkspace
- the workspace in which to perform the verificationcontentType
- the contentType of the document to create- Returns:
- a FileDocument type class (or null if no class has been found)
- Since:
- jcms-10.0.0
-
getFirstDocumentClassAuthorized
public static java.lang.Class<? extends FileDocument> getFirstDocumentClassAuthorized(Member member, Workspace workspace, java.lang.String contentType, java.util.Map<java.lang.String,?> contextMap)
Retrieve the first document class authorized for publication by the specified member and workspace, and the most relevant regarding specified contentType.- Parameters:
member
- the member for which to perform the verificationworkspace
- the workspace in which to perform the verificationcontentType
- the contentType of the document to createcontextMap
- an optional context map providing information on publish request context- Returns:
- a FileDocument type class (or null if no class has been found)
- Since:
- jcms-10.0.6 / JCMS-8882
-
getFieldValue
public java.lang.Object getFieldValue(java.lang.String fieldName, java.lang.String lang, boolean useDefault) throws java.lang.NoSuchFieldException
Gets theObject
value of the given field name for thisFileDocument
.- Overrides:
getFieldValue
in classPublication
- Parameters:
fieldName
- the field name from which to retrieve the field value.lang
- the language (ISO-639 code) in which to retrieve the field value (used only for multilingual fields).useDefault
- whether to use the publication main language if the field value is not available in the requested language (used only for multilingual fields).- Returns:
- the
Object
field value - Throws:
java.lang.NoSuchFieldException
- if the field was not found in the givenPublication
.
-
setFieldValue
public void setFieldValue(java.lang.String fieldName, java.lang.Object value, java.lang.String lang) throws java.lang.NoSuchFieldException
Sets the value of the givenObject
field name for the currentData
.
If the field is multilingual, the given language will be used.
Do not retrieveCategory
fields, see #getCategoryFieldValue(String, Member).- Overrides:
setFieldValue
in classPublication
- Parameters:
fieldName
- the field name from which to retrieve the field value.value
- whether to use the publication main language if the field value is not available in the requested language (used only for multilingual fields).lang
- the language (ISO-639 code) in which to retrieve the field value (used only for multilingual fields).- Throws:
java.lang.NoSuchFieldException
- if the field was not found in the givenData
.- Since:
- jcms-7.0.0
-
getAbstract
public java.lang.String getAbstract()
Description copied from class:Publication
Returns the abstract of this publication in the channel's main language.- Overrides:
getAbstract
in classPublication
- Returns:
- the abstract of this publication in the channel's main language.
-
getAbstract
public java.lang.String getAbstract(java.lang.String lang, boolean useDefault)
Retrieve the value of this FileDocument's abstract field (description) in the specified language.- Overrides:
getAbstract
in classPublication
- Parameters:
lang
- the language (ISO 639: 2-letter codes) in which to retrieve the field value.useDefault
- whether to use the publication main language if the field value is not available in the requested language.- Returns:
- the abstract of this publication.
-
getDataImage
public java.lang.String getDataImage()
Description copied from class:Publication
Returns a data image of this publication based on the image contains in its wiki or wysiwyg fields.- Overrides:
getDataImage
in classPublication
- Returns:
- a data image of this publication based on the image contains in its wiki or wysiwyg fields.
- See Also:
Data.getDataImage()
-
getDataImage
public java.lang.String getDataImage(java.lang.String lang, boolean useDefault)
Description copied from class:Data
Retrieves the image path of this data.This method can (should) be implemented by subclasses to provide an image/illustration of this Data.
Default behaviour is to return empty string.- Overrides:
getDataImage
in classData
- Parameters:
lang
- the user language (ISO-639 language code)useDefault
- should the default language be used if no value is found for the specified language- Returns:
- a path relative to the webapp root.
-
getAllWikiText
public java.lang.String getAllWikiText()
Retrieve a String containing all the wiki text available for this FileDocument.
Current implementation is to retrieve descrition values (with wiki text) in all languages available.- Overrides:
getAllWikiText
in classPublication
- Returns:
- a String which contains the concatenation of all the wiki fields.
-
getAllWysiwygText
public java.lang.String getAllWysiwygText()
Retrieve a String containing all the wiki text available for this FileDocument.
Current implementation is to retrieve descrition values (with JHTML) in all languages available.- Overrides:
getAllWysiwygText
in classPublication
- Returns:
- a String which contains the concatenation of all the wysiwyg fields.
- Since:
- jcms-5.5.0
-
importXml
public void importXml(org.jdom.Element elt, ImportOptions options)
Description copied from class:Data
Fill this data with the values contains in the JDOM element.- Overrides:
importXml
in classPublication
- Parameters:
elt
- the JDOM elementoptions
- the ImportOptions
-
importXmlFieldsWithReferences
protected void importXmlFieldsWithReferences(org.jdom.Element elt, ImportOptions options)
- Overrides:
importXmlFieldsWithReferences
in classData
-
getExportXmlDataValue
public java.lang.String getExportXmlDataValue()
Returns a string representation of this data used by exportXml().- Overrides:
getExportXmlDataValue
in classData
- Returns:
- a string representation of this data used by exportXml().
- Since:
- jcms-5.7.2
-
exportXmlField
public void exportXmlField(java.lang.StringBuffer sb, int indentLevel)
Description copied from class:Data
Fills the given StringBuffer with Xml export of fields of this data.- Overrides:
exportXmlField
in classPublication
- Parameters:
sb
- the StringBufferindentLevel
- the indent level
-
getSearchStrings
public java.lang.String[] getSearchStrings()
Retrieve an array of String containing all the text that may be searched.
Current implementation is to retrieve descrition values in all languages available.- Specified by:
getSearchStrings
in interfaceSearchable
- Overrides:
getSearchStrings
in classPublication
- Returns:
- an array of Strings which contains only one string which is the concatenation of all the searchable string of this publication.
- See Also:
Searchable.getSearchStrings()
-
clearInternalCache
public void clearInternalCache()
Clear internal cache of this FileDocument.You might need to invoke this method after modification to the file without update of the FileDocument (this is not recommended though).
- Since:
- jcms-5.7.5
-
isDefaultDetailView
public boolean isDefaultDetailView()
Returns true if this FileDocument must be viewed in detail by default.- Returns:
- true if this FileDocument must be viewed in detail by default.
- Since:
- jcms-7.0.0
-
getFile
public java.io.File getFile()
Returns the File object for the corresponding the filename- Returns:
- a File object, may return null for remote document or if invalid filename was specified
- Since:
- jcms-4.1
-
getSize
public long getSize()
Returns the size of the file encapsulated by this FileDocument.- Returns:
- the size of the file
- Since:
- jcms-5.0.0
-
getLastModified
public long getLastModified()
Returns the time that this filedocument was last modified.- Returns:
- the time that this filedocument was last modified.
- Since:
- jcms-5.7.2
-
getIcon
public java.lang.String getIcon()
- Returns:
- the icon src for this FileDocument
-
getDataIcon
public java.lang.String getDataIcon()
Description copied from class:Data
Returns source information for the icon associated to this Data, either a relative path or sprite classes name.If this method behavior has not been overriden by subclass, the default icon can be declared using property
types.{Type}.icon
, where{Type}
is the short class name of the type concerned.- Either by specifying a relative image path :
types.Article.icon: images/jalios/icon/abstract.gif
- or else by using a sprite icon :
types.Article.icon: ss_sprite ss_date
- Overrides:
getDataIcon
in classPublication
- Returns:
- a relative path (eg
images/jalios/icon/abstract.gif
) or sprite classes name (egss_sprite ss_date
). - See Also:
Data.getDataIconHtml(String)
- Either by specifying a relative image path :
-
getDataIconTitle
public java.lang.String getDataIconTitle(java.lang.String lang)
Description copied from class:Data
Returns the icon's tooltip.If this method behavior has not been overriden by subclass, the default alternative text can be declared using language property
types.{Type}.title
, where{Type}
is the short class name of the type concerned.- Overrides:
getDataIconTitle
in classPublication
- Parameters:
lang
- the user language.- Returns:
- the title Html attribute for the IMG Html tag
- See Also:
Data.getDataIconHtml(String)
-
getGenericContentType
public java.lang.String getGenericContentType()
Returns the generic content-type of this FileDocument (eg "video" if content-type contains "video/mpeg"). One exception, for all content-type starting with "application", we return the second part.- Returns:
- the generic content-type.
- Since:
- jcms-5.5.0
-
getWidth
public long getWidth()
Retrieve the width of the image represented by this filedoc.
Reserved to images files.- Returns:
- the width of the image or zero if it is not available.
-
getHeight
public long getHeight()
Retrieve the height of the image represented by this filedoc.
Reserved to images files.- Returns:
- the height of the image or zero if it is not available.
-
getDimensions
public java.lang.String getDimensions()
Returns the dimensions of the image in the following form: "{width}×{height}" (withouth quotes).
Reserved to images files.- Returns:
- the string with the dimensions of the image.
- Since:
- jcms-5.5.0
-
getDuration
public long getDuration()
Returns the duration of the audio (reserved for audio files)- Returns:
- the duration of this audio file in millisecond (return -1 if this FileDocument is not an audio file).
- Since:
- jcms-5.5.0
- See Also:
AudioUtil.getDuration(File)
-
hasDuration
public boolean hasDuration()
Returns true if this document has a duration (only for audio/video).- Returns:
- true if this document has a duration (only for audio/video).
- Since:
- jcms-10.0.0
-
isWebImage
public boolean isWebImage()
Returns true if this FileDocument contains an image displayable in a Web browser (i.e. GIF, JPEG or PNG)- Returns:
- true if it is a Web image
- Since:
- jcms-4.0
-
isImage
public boolean isImage()
Returns true if this FileDocument is an image.- Returns:
- true if it is a image
- Since:
- jcms-5.5.0
-
isAudio
public boolean isAudio()
Returns true if this FileDocument is an audio file.- Returns:
- true if it is an audio file
- Since:
- jcms-5.5.0
-
isVideo
public boolean isVideo()
Returns true if this FileDocument is a video file.- Returns:
- true if it is a video file
- Since:
- jcms-5.5.0
-
isText
public boolean isText()
Returns true if this FileDocument is a text file.- Returns:
- true if it is a text file
- Since:
- jcms-5.5.0
-
isFlash
public boolean isFlash()
Returns true if this FileDocument is a flash file.- Returns:
- true if it is a shockwave flash file
- Since:
- jcms-5.5.0
-
isMedia
public boolean isMedia()
Check if this FileDocument is a media file (ie : an image, audio, video or flash file)- Returns:
- true if it is a media, false otherwise
- Since:
- jcms-6.1
-
getMediaType
public java.lang.String getMediaType()
Retrieves the media type of this FileDocument as a String.Depending on the media type, returns :
- Returns:
- the media type as a string
-
hasTracks
public boolean hasTracks()
Check if this document has track attached to it.- Returns:
- true if there are some tracks, false otherwise
- Since:
- 10.0.6 / JCMS-8731
-
hasTrackKind
public boolean hasTrackKind(java.lang.String trackKind)
Check if this document has a kind of tracks attached to it.- Parameters:
trackKind
- the kind of tracks- Returns:
- true if there are some given kind of track, false otherwise
- Since:
- 10.0.8 / JCMS-10231
-
hasSubtitles
public boolean hasSubtitles()
Check if this document has subtitles attached to it.- Returns:
- true if there are some subtitles, false otherwise
- Since:
- 10.0.8 / JCMS-10231
-
canUploadTracks
public static boolean canUploadTracks(FileDocument doc, Member member)
Check if this document should allow member to add tracks to it.Document must be local, member must be able to work on it, and media tracks must be authorized.
- Parameters:
doc
- document to test if it allows media tracksmember
- member to test if he has rights to work on document- Returns:
- true if there are some tracks, false otherwise
- Since:
- 10.0.6 / JCMS-8730
- See Also:
MediaTracksHandler.isMediaTrackAuthorized(FileDocument)
-
getTracksMap
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getTracksMap()
Return a map containg all media tracks grouped by track kind.Key of first level map is the kind of track (e.g. "subtitles", "captions", "descriptions, "chapters", "metatada") For the second level map : key is the language of the corresponding track, value is its (relative to the webapp root).
- Returns:
- a Map instance (never return null)
- Since:
- 10.0.6 / JCMS-8731
-
performBeforeWrite
protected void performBeforeWrite(int op, Member mbr, java.util.Map context)
Description copied from class:Data
Called to perform some action before the write.- Overrides:
performBeforeWrite
in classPublication
- Parameters:
op
- the operation (OP_CREATE, OP_UPDATE, ...)mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)
-
isIndexed
public boolean isIndexed()
- Returns:
- true if this FileDocument has been indexed with Lucene
- Since:
- jcms-4.0.1
-
getIndexedDate
@Deprecated public java.util.Date getIndexedDate()
Deprecated.- Returns:
- the date this file has been indexed
- Since:
- jcms-4.0.1
-
getFileIndexingDate
public java.util.Date getFileIndexingDate()
- Returns:
- the date the file has been indexed
- Since:
- jcms-6.0.1
-
getTypeInfo
public java.lang.String getTypeInfo(java.lang.String lang)
Returns the information bound to the type this FileDocument- Parameters:
lang
- the user language- Returns:
- an information String
- Since:
- jcms-4.0
-
getWeakReferrerSet
public java.util.Set<Publication> getWeakReferrerSet()
Description copied from class:Publication
Returns the set of weak referrers.Included in results:
- JStore Publication instance that references this Publication through a weak a wiki or wysiwyg field.
Excluded from results (non exhaustive list):
- DBData.
This method is NOT supported on DBData, it will only return results when invoked on JStore objects.
DO NOT alter the returned set, clone prior modification.
See online documentation on data links and referrers : https://community.jalios.com/doc/referrer
- Overrides:
getWeakReferrerSet
in classPublication
- Returns:
- the set of weak referrers.
- See Also:
Publication.getDocumentLinkSet()
,Publication.getLinkDataSet(Class)
-
getFileReferrerSet
public <T extends Data> java.util.Set<T> getFileReferrerSet(java.lang.Class<T> clazz)
Returns all the data referring the file of this FileDocument (except this FileDocument itself).- Type Parameters:
T
- A data class- Parameters:
clazz
- the class for filter with. Returns all the data referring the file of this FileDocument (except this FileDocument itself).- Returns:
- all the data referring the file of this FileDocument (except this FileDocument itself).
- Since:
- jcms-7.1.0
-
getMetaData
public java.lang.String getMetaData(java.lang.String tag)
Returns the value bound to the given metadata- Parameters:
tag
- the name of the metadata to get- Returns:
- the value of the metadata (may be null)
- Since:
- jcms-4.0
-
getMetaDataMap
public java.util.Map<java.lang.String,java.lang.String> getMetaDataMap()
Returns the map of metadata- Returns:
- the map of metadata (may be null)
- Since:
- jcms-4.0
-
canCreateCopy
public boolean canCreateCopy(Member mbr, boolean isWorkCopy)
This method override canCreateCopy() and returns true for workCopy and false otherwise (2 FileDocuments cannot target the same file)- Overrides:
canCreateCopy
in classPublication
- Parameters:
mbr
- the member to be checkedisWorkCopy
- true if this is a workCopy- Returns:
- true if a given member can create a copy of this publication
- Since:
- jcms-5.6.0
- See Also:
Publication.canCreateCopy(com.jalios.jcms.Member,boolean)
-
initCopy
public void initCopy(Member newAuthor)
Description copied from class:Publication
Initialize this publication once it has been cloned for a copy (eg by duplicate.jsp)- Overrides:
initCopy
in classPublication
- Parameters:
newAuthor
- the author of this publication
-
discardCopy
public void discardCopy(Publication copy)
Description copied from class:Publication
This method is called when the creation of copy or a work copy of this publication has failed. It is intended to perform cleaning operations.- Overrides:
discardCopy
in classPublication
- Parameters:
copy
- the copy which has been discarded.
-
canBeUploadedBy
public boolean canBeUploadedBy(Member mbr)
Returns true a new version of the file can be uploaded for this document by the given member.- Parameters:
mbr
- the member- Returns:
- true a new version of the file can be uploaded for this document by the given member.
- Since:
- jcms-9.0.0
-
setAbstract
public void setAbstract(java.lang.String lang, java.lang.String value)
Description copied from class:Publication
Convenient method to set the value of the Abstract field in any language (default site language or any other).
depending on the specified language.- Overrides:
setAbstract
in classPublication
- Parameters:
lang
- the language (ISO 639 code) in which to set the valuevalue
- the value to set.
-
getDescription
public java.lang.String getDescription(java.lang.String lang)
-
getDescription
public java.lang.String getDescription(java.lang.String lang, boolean useDefault)
-
getDescription
public java.lang.String getDescription()
-
setDescription
public void setDescription(java.lang.String v)
-
getDescriptionML
public java.util.HashMap<java.lang.String,java.lang.String> getDescriptionML()
-
setDescriptionML
public void setDescriptionML(java.util.HashMap<java.lang.String,java.lang.String> v)
-
setDescription
public void setDescription(java.lang.String lang, java.lang.String value)
Convenient method to set the value of the Description field in any language (default site language or any other).
This method will set the proper field value (setDescription(String)
orsetDescriptionML(HashMap)
) depending on the specified language.- Parameters:
lang
- the language (ISO 639 code) in which to set the valuevalue
- the value to set.- Since:
- jcms-7.0.0
-
getFilename
public java.lang.String getFilename()
Retrieve the path relative to the webapp of the file pointed by this FileDocument.
Example:upload/docs/image/jpg/welcome.gif
It should not start with a slash ("/").- Returns:
- a relative file path.
-
setFilename
public void setFilename(java.lang.String v)
-
getOriginalFilename
public java.lang.String getOriginalFilename()
-
setOriginalFilename
public void setOriginalFilename(java.lang.String v)
-
getRemoteUri
public java.lang.String getRemoteUri()
-
setRemoteUri
public void setRemoteUri(java.lang.String v)
-
isRemote
public boolean isRemote()
Returns true if this document is a Remote Document.- Returns:
- true if this document is a Remote Document.
- Since:
- jcms-10.0.0
-
isLocalFile
public boolean isLocalFile()
Returns true if this document is a local (on this site) Document.- Returns:
- true if this document is a local (on this site) Document.
- Since:
- jcms-10.0.0
-
getDownloadName
public java.lang.String getDownloadName(java.lang.String lang)
Returns the (file) name to use to download this document.- Parameters:
lang
- the language to be used to download this document.- Returns:
- the (file) name to use to download this document.
- Since:
- jcms-10.0.0
-
getDownloadName
public java.lang.String getDownloadName(java.lang.String lang, boolean addVersion)
Returns the (file) name to use to download this document.- Parameters:
lang
- the language to be used to download this document.addVersion
- if true, append the version number in the name.- Returns:
- the (file) name to use to download this document.
- Since:
- jcms-10.0.0
-
getDownloadUrl
public java.lang.String getDownloadUrl()
Returns the download URL for this document.- Returns:
- the download URL for this document.
- Since:
- jcms-10.0.0
-
getAbsDownloadUrl
public java.lang.String getAbsDownloadUrl()
Returns the absolute download URL for this document.- Returns:
- the absolute download URL for this document.
- Since:
- jcms-10.0.0
-
getDownloadUrl
public java.lang.String getDownloadUrl(boolean relative)
Returns the download URL for this document.- Parameters:
relative
- if true returns a relative URL otherwise return an absolute URL.- Returns:
- the download URL for this document.
- Since:
- jcms-10.0.0
-
getDownloadUrl
public java.lang.String getDownloadUrl(boolean relative, boolean encodeForHTMLAttribute)
Returns the download URL for this document.- Parameters:
relative
- if true returns a relative URL otherwise return an absolute URL.encodeForHTMLAttribute
- if true returns a value encoded for use in HTML attribute, otherwise return a raw value.- Returns:
- the download URL for this document.
- Since:
- jcms-10.0.2 - JCMS-7057
-
getRemotePreviewUrl
public java.lang.String getRemotePreviewUrl()
Returns the preview URL for Remote Document.- Returns:
- the preview URL for Remote Document.
- Since:
- jcms-10.0.0
-
getRemoteThumbnailUrl
public java.lang.String getRemoteThumbnailUrl()
Returns the thumbnail URL for Remote Document.- Returns:
- the thumbnail URL for Remote Document.
- Since:
- jcms-10.0.0
-
previewRemoteWithMedia
public boolean previewRemoteWithMedia()
Returns true if this RemoteDocument can be previewed as a media.- Returns:
- true if this RemoteDocument can be previewed as a media.
- Since:
- jcms-10.0.0
-
previewRemoteWithIFrame
public boolean previewRemoteWithIFrame()
Returns true if this RemoteDocument can ben previewed with an iFrame.- Returns:
- true if this RemoteDocument can ben previewed with an iFrame.
- Since:
- jcms-10.0.0
-
getContentType
public java.lang.String getContentType()
-
setContentType
public void setContentType(java.lang.String v)
-
getUploadDate
public java.util.Date getUploadDate()
Returns the date of the last upload.- Returns:
- the date of the last upload.
- Since:
- jcms-5.7.0
-
setUploadDate
public void setUploadDate(java.util.Date date)
Set the date of the last upload.- Parameters:
date
- the date.- Since:
- jcms-5.7.0
-
getPdfUploadDate
public java.util.Date getPdfUploadDate()
Returns the date at which the Associated PDF file was uploaded (if uploaded by user).- Returns:
- the date of the Associated PDF file upload, return null if associated PDF file was never uploaded by user.
- Since:
- jcms-8.0.0
-
setPdfUploadDate
public void setPdfUploadDate(java.util.Date date)
Set the date at which the Associated PDF file was uploaded (if uploaded by user).- Parameters:
date
- the Date of the Associated PDF file upload (null to indicated PDF was not uploaded by user)- Since:
- jcms-8.0.0
-
hasStrongLock
@Deprecated public boolean hasStrongLock()
Deprecated.Returns true if this FileDocument has a strong lock.- Returns:
- true if this FileDocument has a strong lock.
- Since:
- jcms-5.7.0
-
getLockedDocumentSet
public static java.util.Set<FileDocument> getLockedDocumentSet(Workspace ws, Member mbr)
Returns the set of FileDocument which have a strong lock. This set is filtered according the given workspace and the given member- Parameters:
ws
- the workspacembr
- the member who performs this request (to check read rights)- Returns:
- the set of FileDocument which have a strong lock
- Since:
- jcms-5.7.0
-
getAssociatedPDF
public java.io.File getAssociatedPDF()
Returns the pdf associated with a FileDocument. Itself, if it is a PDF. null if filename is null.- Returns:
- the associated PDF
- Since:
- jcms-5.7.3
-
deleteAssociatedPDF
public boolean deleteAssociatedPDF()
Delete the associated PDF to the current file.- Returns:
- true if a file as been deleted.
- Since:
- JCMS-5.7.3
-
isGeneratedPDF
public static boolean isGeneratedPDF(java.lang.String filename)
Returns true if the given filename is a PDF file generated with JCMS Universal.- Parameters:
filename
- the filename to be checked- Returns:
- true if the given filename is a PDF file generated with JCMS Universal.
- Since:
- jcms-5.7.0
-
getOriginalDocumentFromPDF
public static java.lang.String getOriginalDocumentFromPDF(java.lang.String pdfFilename)
Returns the filename of the original document bound to the given PDF filename otherwise returns null.- Parameters:
pdfFilename
- the filename of a PDF file generated with JCMS Universal- Returns:
- the filename of the original document bound to the given PDF filename otherwise returns null.
- Since:
- jcms-5.7.0
-
getAssociatedFileSet
public java.util.Set<java.io.File> getAssociatedFileSet()
Retrieve a Set of File associated to this FileDocument.Implementation note : In order to always return a Set of file up to date, the file system is read and files are filtered each time the method is invoked.
Use this method wisely if you need high performance.- Returns:
- a new Set of File, never return null
- Since:
- jcms-7.0.0
- See Also:
FileDocument.AssociatedFileFilter
-
deleteAssociatedFiles
public java.util.Set<java.io.File> deleteAssociatedFiles()
Delete all the File associated to this FileDocument.It includes thumbnails, generated pdf or any other associated file as defined by properties
file-document.associated-files.*
.The File referenced by this FileDocument is NOT deleted.
- Returns:
- a new Set containing all the File that were deleted, never return null
- Since:
- jcms-7.0.0
- See Also:
FileDocument.AssociatedFileFilter
-
getGenericThumbnail
public java.lang.String getGenericThumbnail()
Returns a generic thumbnail for this FileDocument. As defined by propertiesfile-document.thumb.{generic-content-type}
.If no property was defined for the content type of this FileDocument, the thumbnail specified in property
file-document.thumb.unknown
is used.- Overrides:
getGenericThumbnail
in classPublication
- Returns:
- a thumbnail path relative to the webapp root, eg
images/jalios/icons/media/word.gif
- Since:
- jcms-5.5.0
-
deleteThumbnails
public boolean deleteThumbnails()
Delete every thumbnail of this FileDocument if there are any.- Returns:
- true if some thumbnail were deleted, false if there was no thumbnail to delete.
- See Also:
deleteThumbnails(File)
-
deleteThumbnails
public static boolean deleteThumbnails(java.io.File originalFile)
Delete every thumbnail associated to this FileDocument if there are any. Uses the pattern- Parameters:
originalFile
- the original file used to produce thumbnails- Returns:
- true if some thumbnail were deleted, false if there was no thumbnail to delete.
-
getThumbnailFilename
public static java.lang.String getThumbnailFilename(java.lang.String originalFilename, int maxWidth, int maxHeight)
Returns the file name of the thumbnail to create given an original filename
Uses the following format for the new filename:
th-{maxWidth}x{maxHeight}-{originalFilename}.{ext}
where{ext}
is the file extension of the default thumbnail image format as specified with propertytag.thumbnail.format
- Parameters:
originalFilename
- the filename to convert, must not be null or emptymaxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.- Returns:
- a String representing the thumbnail filename.
-
getThumbnailFilename
public static java.lang.String getThumbnailFilename(java.lang.String originalFilename, int maxWidth, int maxHeight, boolean square)
Returns the file name of the thumbnail to create given an original filename
Uses the following format for the new filename:
th-{maxWidth}x{maxHeight}-{originalFilename}.{ext}
where{ext}
is the file extension of the default thumbnail image format as specified with propertytag.thumbnail.format
- Parameters:
originalFilename
- the filename to convert, must not be null or emptymaxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.square
- set to true to indicate image is cropped into a square- Returns:
- a String representing the thumbnail filename.
- Since:
- jcms-9.0
-
getThumbnailFilename
public static java.lang.String getThumbnailFilename(java.lang.String originalFilename, int maxWidth, int maxHeight, boolean square, java.lang.String extension)
Returns the file name of the thumbnail to create given an original filename
Uses the following format for the new filename:
th-{maxWidth}x{maxHeight}-{originalFilename}.{ext}
where{ext}
is the file extension of the default thumbnail image format as specified with propertytag.thumbnail.format
- Parameters:
originalFilename
- the filename to convert, must not be null or emptymaxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.square
- set to true to indicate image is cropped into a squareextension
- the extension of the thumbnail format being create/generated/manipulated. eg"jpg"
- Returns:
- a String representing the thumbnail filename.
- Since:
- jcms-10.0.1 JCMS-4762
-
getThumbnailFile
public static java.io.File getThumbnailFile(java.io.File file, int maxWidth, int maxHeight)
Gets the File to use for a thumbnail of the given image file, using given dimensions.
The new File is created in the same directory as the given File.- Parameters:
file
- the file from which to get and create the associated thumbnail File, cannot be null.maxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.- Returns:
- a File representing the thumbnail filename.
- See Also:
getThumbnailFilename(String, int, int)
-
getThumbnailFile
public static java.io.File getThumbnailFile(java.io.File file, int maxWidth, int maxHeight, boolean square)
Gets the File to use for a thumbnail of the given image file, using given dimensions.
The new File is created in the same directory as the given File.- Parameters:
file
- the file from which to get and create the associated thumbnail File, cannot be null.maxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.square
- set to true to indicate image is cropped into a square- Returns:
- a File representing the thumbnail filename.
- Since:
- jcms-9.0
- See Also:
getThumbnailFilename(String, int, int, boolean)
-
getThumbnailFile
public static java.io.File getThumbnailFile(java.io.File file, int maxWidth, int maxHeight, boolean square, java.lang.String extension)
Gets the File to use for a thumbnail of the given image file, using given dimensions.
The new File is created in the same directory as the given File.- Parameters:
file
- the file from which to get and create the associated thumbnail File, cannot be null.maxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.square
- set to true to indicate image is cropped into a squareextension
- the extension of the thumbnail format being create/generated/manipulated. eg"jpg"
- Returns:
- a File representing the thumbnail filename.
- Since:
- jcms-10.0.1 JCMS-4762
- See Also:
getThumbnailFilename(String, int, int, boolean)
-
getFileFromThumbnail
public static java.io.File getFileFromThumbnail(java.io.File thumbnailFile)
Retrieve the original File associated with the given thumbnail File. Match the format specified ingetThumbnailFile(File, int, int)
.- Parameters:
thumbnailFile
- a File representing the thumbnail.- Returns:
- the original File of the given thumbnail or null if the original File does not exist.
-
getThumbnail
public java.lang.String getThumbnail(int width, int height)
Returns the thumbnail of this document with the given width and height. If this thumbnail does not exist, it is created.- Parameters:
width
- the thumbnail's widthheight
- the thumbnail's height- Returns:
- the thumbnail of this document with the given width and height. If this thumbnail does not exist, it is created.
- Since:
- jcms-9.0.0
-
isThumbnail
public static boolean isThumbnail(java.io.File file)
Returns true if the given file is a thumbnail.- Parameters:
file
- the file to be checked- Returns:
- true if the given file is a thumbnail.
- Since:
- jcms-5.7.0
-
supportsThumbnail
public boolean supportsThumbnail()
Returns true if a thumbnail can be generated for this document.- Returns:
- true if a thumbnail can be generated for this document.
- Since:
- jcms-5.7.0
- See Also:
ThumbnailPolicyManager.supportsThumbnail(FileDocument, boolean)
-
getDefaultWorkflow
public static Workflow getDefaultWorkflow()
Returns the Default Workflow associated with FileDocument- Returns:
- Workflow the default workflow for FileDocuments
-
getFileDocumentFromFile
public static FileDocument getFileDocumentFromFile(java.io.File file)
Retrieves the first FileDocument bound to the given File.- Parameters:
file
- the File of the FileDocument to be retrieved.- Returns:
- an existing FileDocument or null if was not found.
- See Also:
getFileDocumentFromFilename(String)
-
getFileDocumentFromFilename
public static FileDocument getFileDocumentFromFilename(java.lang.String filename)
Retrieves the first FileDocument bound to the given filename.- Parameters:
filename
- the filename (relative path such as"upload/docs/image/gif/welcome.gif"
) of the FileDocument to be retrieved.- Returns:
- an existing FileDocument or null if was not found.
- Since:
- jcms-5.5.0
- See Also:
getFileDocumentFromFile(File)
-
isGenericContentType
public static boolean isGenericContentType(java.lang.String contentType)
-
getDefaultContentType
public static java.lang.String getDefaultContentType()
-
getRealContentType
public static java.lang.String getRealContentType(java.lang.String contentType, java.lang.String extension)
This method retrieve the real content type from a given one. If the content type is a generic content type then try to use extension.- Parameters:
contentType
- the file content typeextension
- the file extension- Returns:
- String the computed content type
- Since:
- jcms-5.5.0
-
getAccessibilityInformation
public java.lang.String getAccessibilityInformation(java.util.Locale locale, boolean htmlDisplay)
Returns a formatted string displaying accessibility information.- on the format of the current file;
- on the size of the current file;
- on the language of the current file.
- Parameters:
locale
- the current LocalehtmlDisplay
- if true, uses an html format, with detailed abbreviation, otherwise, use only plain text- Returns:
- a formatted String of informations on the file
-
getNewDocumentFilename
public static java.lang.String getNewDocumentFilename(java.lang.String fileName)
Retrieves the relative path (==filename) to use for creation of a new FileDocument for the given file's name.
E.g : given file name"Présentation finale.ps"
, can return a path such as"upload/docs/application/postscript/2006/06/presentation-finale.ps"
- Parameters:
fileName
- the original name of the file to be added.- Returns:
- the path of the new file to create, relative to the webapp.
- Throws:
java.lang.IllegalArgumentException
- if the fileName argument is null.- Since:
- jcms-5.7.0
-
getNewDocumentDirectoryAndName
public static java.lang.String[] getNewDocumentDirectoryAndName(java.lang.String fileName, java.lang.String contentType)
Retrieves the file's name and the relative path of the directory to use for creation of a new FileDocument for the given file's name.
E.g : given file name"Présentation finale.ps"
, can return a path such as"upload/docs/application/postscript/2006/06/presentation-finale.ps"
- Parameters:
fileName
- the original name of the file to be added. Must not be null.contentType
- the content type of the file or null if not available.- Returns:
- a array of two strings, the first cell containing the relative directory path, the second one the new filename
- Throws:
java.lang.IllegalArgumentException
- if the fileName argument is null.- Since:
- jcms-5.7.0
-
getNewDocumentDirectoryAndName
public static java.lang.String[] getNewDocumentDirectoryAndName(java.lang.String fileName, java.lang.String contentType, java.util.Set<java.lang.String> authorizedExtensions)
Retrieves the file's name and the relative path of the directory to use for creation of a new FileDocument for the given file's name.
E.g : given file name"Présentation finale.ps"
, can return a path such as"upload/docs/application/postscript/2006/06/presentation-finale.ps"
- Parameters:
fileName
- the original name of the file to be added. Must not be null.contentType
- the content type of the file or null if not available.authorizedExtensions
- a Set of lower case extension explicitely authorized, bypassing the default sanitization process. set to null or empty to apply default sanitization.- Returns:
- a array of two strings, the first cell containing the relative directory path, the second one the new filename
- Throws:
java.lang.IllegalArgumentException
- if the fileName argument is null.- Since:
- jcms-10.0.6 / JCMS-8317
-
getExtension
public static java.lang.String getExtension(java.lang.String filename)
This method return the lowercase extension of a given file name it return string after last '.' of the filename.
ie. FileName.Ext -> ext
The following sanitization process is applied : if the extension computed byIOUtil.getExtension(String)
is declared in a propertyfile-document.invalid-extension.{ext}: {value}
,{value}
is returned. For example"txt"
is returned when uploading"jsp"
.- Parameters:
filename
- the file name- Returns:
- String the file extension
- See Also:
IOUtil.getExtension(String)
-
getExtension
public static java.lang.String getExtension(java.lang.String filename, java.util.Set<java.lang.String> authorizedExtensions)
This method return the lowercase extension of a given file name it return string after last '.' of the filename.
ie. FileName.Ext -> ext
The following sanitization process is applied unless the computed extension is declared in the authorizedExtension argument : if the extension computed byIOUtil.getExtension(String)
is declared in a propertyfile-document.invalid-extension.{ext}: {value}
,{value}
is returned. For example"txt"
is returned when uploading"jsp"
.- Parameters:
filename
- the file nameauthorizedExtensions
- a Set of lower case extension explicitely authorized, bypassing the default sanitization process. set to null or empty to apply default sanitization.- Returns:
- String the file extension
- Since:
- jcms-10.0.6 / JCMS-8317
-
getQualifiedName
public static java.lang.String getQualifiedName(java.lang.String filename)
This method return the name of a given file without the extension.It return string before last '.' of the filename (without the '.').
For example :assertEquals("file", FileDocument.getQualifiedName("file.ext")); assertEquals("file.", FileDocument.getQualifiedName("file.")); assertEquals("file", FileDocument.getQualifiedName("file")); assertEquals(".ext", FileDocument.getQualifiedName(".ext"));
Since JCMS-6190, the returned value is escaped using
JcmsUtil.escapeHtml(String)
for proper HTML output.
For example :File<Name.Ext
returnsFile<Name
- Parameters:
filename
- the file name- Returns:
- String the file name
-
getContentTypeComparator
public static <T extends FileDocument> java.util.Comparator<T> getContentTypeComparator()
- Type Parameters:
T
- subclass of FileDocument- Returns:
- a ContentType comparator
- Since:
- jcms-4.1
-
getSizeComparator
public static <T extends FileDocument> java.util.Comparator<T> getSizeComparator()
- Type Parameters:
T
- subclass of FileDocument- Returns:
- a Size comparator
- Since:
- jcms-4.1
-
getDimensionsComparator
public static <T extends FileDocument> java.util.Comparator<T> getDimensionsComparator()
- Type Parameters:
T
- subclass of FileDocument- Returns:
- a Dimensions comparator
- Since:
- jcms-5.5.0
-
getDurationComparator
public static <T extends FileDocument> java.util.Comparator<T> getDurationComparator()
- Type Parameters:
T
- subclass of FileDocument- Returns:
- a Duration comparator
- Since:
- jcms-5.5.0
-
getComparator
public static java.util.Comparator<FileDocument> getComparator(java.lang.String str, boolean reverse)
Deprecated.Retrieves a newComparator
given a name representing it. The returned comparator can be used to sort anyCollection
containingPublication
s.
You can specify any of the following value:"contentType"
:getContentTypeComparator()
"dimensions"
:getDimensionsComparator()
"duration"
:getDurationComparator()
"size"
:getSizeComparator()
And also any of the value available throughPublication.getComparator(String, boolean)
- Parameters:
str
- a string representing the comparatorreverse
- a boolean indicating whether the comparator should have its behavior reversed (true
) or unchanged (false
)- Returns:
- a new instance of
Comparator
. - See Also:
Publication.getComparator(String, boolean)
-
getHiddenSelector
public static FileDocument.HiddenSelector getHiddenSelector()
-
getMediaTypeSelector
public static FileDocument.MediaTypeSelector getMediaTypeSelector(java.lang.String mediaType)
-
unzipToFileDocuments
public long unzipToFileDocuments(java.io.FileFilter filter, Member opAuthor)
Unzip this FileDocument to n FileDocument.Newly created FileDocument will have same field value, as copied using
Publication.assignCommonPublicationFields(Publication)
As of current implementation, the unzip operation is performed only if the following conditions match :
- This FileDocument is a zip (content type is
"application/zip"
- File of this FileDocument exists.
Warning: it can be a time consumming operation, depending on the zip's size.
- Parameters:
filter
- an optional FileFilter to filter the files to be extracted and converted to FileDocument. This filter is also used on extracted directory.opAuthor
- the Member to used to perform the create operation- Returns:
- the number of FileDocument created, or if an error occured, a status code (value < 0) indicating the problem.
- Since:
- jcms-5.7.3
- This FileDocument is a zip (content type is
-
unzipToFileDocuments
public static long unzipToFileDocuments(java.io.File zipFile, java.io.FileFilter filter, FileDocument refFileDoc, Member opAuthor)
Unzip the specified File to n new FileDocument.Warning: it can be a time consumming operation, depending on the zip's size.
- Parameters:
zipFile
- the File to unzipfilter
- an optional FileFilter to filter the files to be extracted and converted to FileDocument. This filter is also used on extracted directory.refFileDoc
- optional FileDocument from which to retrieve fields value to be assigned to the newly created FileDocuments. SeePublication.assignCommonPublicationFields(Publication)
.opAuthor
- optional (but recommended) Member to used to perform the create operation- Returns:
- the number of FileDocument created, or if an error occured, a status code (value < 0) indicating the problem.
- Since:
- jcms-5.7.3
-
directoryToFileDocuments
public static long directoryToFileDocuments(java.io.File dir, java.io.FileFilter filter, FileDocument refFileDoc, Member opAuthor, java.util.Map<java.lang.String,? extends java.lang.Object> contextMap)
Create FileDocumens from all files in the specified directory (and its sub directory).Warning: it can be a time consumming operation.
- Parameters:
dir
- the Directory from which to retrieve Filesfilter
- an optional FileFilter to filter the files to be converted to FileDocument.refFileDoc
- optional FileDocument from which to retrieve fields value to be assigned to the newly created FileDocuments. SeePublication.assignCommonPublicationFields(Publication)
.opAuthor
- optional (but recommended) Member to used to perform the create operationcontextMap
- optional Map to be used during performCreate operation (may be null)- Returns:
- the number of FileDocument created, or if an error occured, a status code (value < 0) indicating the problem.
- Since:
- jcms-5.7.3
-
checkWrite
public ControllerStatus checkWrite(int op, Member mbr, boolean checkIntegrity, java.util.Map context)
In case of upload of a new document, and target doc class is Media (or a Media sub type), check that document is of valid type (image, audio, video, or flash).- Overrides:
checkWrite
in classPublication
- Parameters:
op
- the operation (OP_CREATE, OP_UPDATE, ...)mbr
- the member which requests the write operationcheckIntegrity
- if true, requires the constraints integrity to be checkedcontext
- a map which contains context parameters (may be null)- Returns:
- a ControllerStatus
- Since:
- jcms-10.0.8 JCMS-9851
- See Also:
isMedia()
-
checkIntegrity
public ControllerStatus checkIntegrity(java.util.Map context)
Description copied from class:Data
Checks whether or not data integrity constraints are respected.- Overrides:
checkIntegrity
in classData
- Parameters:
context
- a map which contains context parameters (may be null)- Returns:
- a ControllerStatus
-
checkDelete
public ControllerStatus checkDelete(Member mbr, java.util.Map context)
Description copied from class:Publication
Checks if the deletion can be performed- Overrides:
checkDelete
in classPublication
- Parameters:
mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)- Returns:
- a ControllerStatus
- Since:
- jcms-10.0.8 JCMS-2256
-
performUpdate
public void performUpdate(Member mbr, java.util.Map context)
Description copied from class:Publication
Performs data update- Overrides:
performUpdate
in classPublication
- Parameters:
mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)
-
performDelete
public void performDelete(Member mbr, java.util.Map context)
Description copied from class:Publication
Performs data deletion- Overrides:
performDelete
in classPublication
- Parameters:
mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)
-
performAfterWrite
protected void performAfterWrite(int op, Member mbr, java.util.Map context)
Description copied from class:Data
Called to perform some action after the write.- Overrides:
performAfterWrite
in classPublication
- Parameters:
op
- the operation (OP_CREATE, OP_UPDATE, ...)mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)
-
prepareMergeCopy
protected void prepareMergeCopy(Publication copy)
- Overrides:
prepareMergeCopy
in classPublication
-
generateUploadDate
public java.util.Date generateUploadDate()
Generates an upload date consistent with the environment (ie the RDBMS)- Returns:
- a consistent upload date.
- Since:
- jcms-10.0.0
-
getAllFilePath
public java.util.Set<java.lang.String> getAllFilePath()
Description copied from class:Publication
Gives the set of all relatives path to all kind (image, media) of files linked from the given publication.- Overrides:
getAllFilePath
in classPublication
- Returns:
- a not null set of all relative path to linked files.
-
computeSignature
public java.lang.String computeSignature(boolean includePublicationFields, boolean hash)
Description copied from class:Publication
Compute the signature of this publication.- Overrides:
computeSignature
in classPublication
- Parameters:
includePublicationFields
- if true add the common publication fields (author, pdate, categories, ...). Computed fields (cdate, mdate, udate, minorVersion) are skipped.hash
- if true hash (MD5) the signature otherwise return the complete string of the signature.- Returns:
- the signature of this publication.
-
mergeWith
public ControllerStatus mergeWith(FileDocument tgtDoc, Member loggedMember)
Merges this document with the given the document. The loggedMember must have the right to update the target document and to delete this document.- Parameters:
tgtDoc
- the document to merge withloggedMember
- the member.- Returns:
- the ControllerStatus of the first operation that has failed or the last that has succeed.
- Since:
- jcms-10.0.0
-
getDownloadTicket
public java.lang.String getDownloadTicket()
-
showDownload
public boolean showDownload(Member member)
Check if the download action should be proposed to the specified member.Important : this method is used to hide the download action in the user interface.
It is NOT a security control as it does NOT prevent the download.- Parameters:
member
- the member for which the download action is being verified- Returns:
- true if download action should be proposed, false otherwise
- Since:
- 10.0.8 / JCMS-10899
-
-