com.jalios.jcms
Class FileDocument

java.lang.Object
  extended by com.jalios.jstore.BasicStorable
      extended by com.jalios.jcms.Data
          extended by com.jalios.jcms.Publication
              extended by com.jalios.jcms.Content
                  extended by com.jalios.jcms.FileDocument
All Implemented Interfaces:
EditableData, JcmsConstants, ImportConstants, MashupConstants, Searchable, Storable, JaliosConstants, TreeNode, Cloneable, Comparable<BasicStorable>

public class FileDocument
extends Content

Version:
$Revision: 24606 $

Nested Class Summary
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 FileDocument
static 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.
static class FileDocument.StrongLockSelector
          DataSelector selecting only FileDocument having a strong lock (isStrongLocked()).
 
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.PstatusComparator<T extends Publication>, Publication.PstatusSelector, Publication.RatingComparator<T extends Publication>, Publication.ReaderComparator<T extends Publication>, Publication.ReadRightSelector, Publication.ReviewCountComparator<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.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>
 
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
protected  String contentType
           
protected static Workflow DEFAULT_WORKFLOW
           
protected  String description
           
protected  HashMap<String,String> descriptionML
           
protected  String filename
           
static int HIDDEN_PSTATUS
           
static String OPENOFFICE_MIMETYPE
           
static String OPENXML_PRESENTATION_MIMETYPE
           
protected  String originalFilename
           
static String REVISION
           
protected  Date strongLockDate
           
protected  Member strongLockMember
           
static String THUMBNAIL_PREFIX
           
protected  Date uploadDate
           
 
Fields inherited from class com.jalios.jcms.Publication
adate, authorizedGroupSet, authorizedMemberSet, categories, categorySet, CTRL_TOPIC_ADVANCED, CTRL_TOPIC_CATEGORIES, CTRL_TOPIC_WORKFLOW, edate, friendlyURLSet, indexMgr, isTracked, mainInstance, mainLanguage, majorVersion, mergeDate, mergeId, minorVersion, pdate, pstatus, roleMap, sdate, templates, title, titleML, udate, updateGroupSet, updateMemberSet, wfExpressAlarmEntry, wfReminderAlarmEntry, workspace
 
Fields inherited from class com.jalios.jcms.Data
author, authorDBID, channel, DISPLAY_URL_EXTRA_INFO, extension, extraDataMap, extraDBDataMapToSaveOnOp, importMap, lockDate, lockMember, opAuthor, opDelegate
 
Fields inherited from class com.jalios.jstore.BasicStorable
cdate, ddate, id, 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.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
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CRYPT_MD5, CRYPT_UNDEFINED, CRYPT_UNIX, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
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
 
Constructor Summary
FileDocument()
           
FileDocument(FileDocument other)
           
 
Method Summary
 boolean canBeReadBy(Group group)
          Checks if a group can read this publication.
 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)
 boolean canRequestLock(Member mbr)
          Returns true if the given member can request the lock (by mail).
 ControllerStatus checkDelete(Member mbr, Map context)
          Checks if the deletion can be performed
 ControllerStatus checkIntegrity()
          Checks whether or not data integrity constraints are respected.
 boolean checkStrongLockMember(Member mbr)
          Returns true if the given member has locked this FileDocument or if this document is not locked.
 void clearInternalCache()
          Clear internal cache of 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(File originalFile)
          Delete every thumbnail associated to this FileDocument if there are any.
static long directoryToFileDocuments(File dir, FileFilter filter, FileDocument refFileDoc, Member opAuthor, Map<String,? extends Object> contextMap)
          Create FileDocumens from all files in the specified directory (and its sub directory).
 void exportXmlField(StringBuffer sb, int indentLevel)
          Fills the given StringBuffer with Xml export of fields of this data.
 String getAbstract()
          Returns the abstract of this publication in the channel's main language.
 String getAbstract(String lang, boolean useDefault)
          Retrieve the value of this FileDocument's abstract field (description) in the specified language.
 String getAccessibilityInformation(Locale locale, boolean htmlDisplay)
          Returns a formatted string displaying accesibility information.
 Set<String> getAllFilePath()
          Gives the set of all relatives path to all kind (image, media, file) of files linked from the given publication.
 String getAllWikiText()
          Retrieve a String containing all the wiki text available for this FileDocument.
 File getAssociatedPDF()
          Returns the pdf associated with a FileDocument.
static Comparator<FileDocument> getComparator(String str, boolean reverse)
          Retrieves a new Comparator given a name representing it.
 String getContentType()
           
static
<T extends FileDocument>
Comparator<T>
getContentTypeComparator()
           
 String getDataImage()
          Retrieves the image path of this data in the channel's main language.
 String getDataImage(String lang, boolean useDefault)
          Retrieves the image path of this data.
static String getDefaultContentType()
           
static Workflow getDefaultWorkflow()
          Returns the Default Workflow associated with FileDocument
 String getDescription()
           
 String getDescription(String lang)
           
 String getDescription(String lang, boolean useDefault)
           
 HashMap<String,String> getDescriptionML()
           
 String getDimensions()
          Returns the dimensions of the image in the following form: "{width}×{height}" (withouth quotes).
static
<T extends FileDocument>
Comparator<T>
getDimensionsComparator()
           
 long getDuration()
          Returns the duration of the audio (reserved for audio files)
static
<T extends FileDocument>
Comparator<T>
getDurationComparator()
           
 String getExportXmlDataValue()
          Returns a string representation of this data used by exportXml().
static String getExtension(String filename)
          This method return the lowercase extension of a given file name it return string after last '.' of the filename.
 Object getFieldValue(String fieldName, String lang, boolean useDefault)
          Gets the Object value of the given field name for this FileDocument.
 File getFile()
          Returns the File object for the corresponding the filename
static FileDocument getFileDocumentFromFile(File file)
          Retrieves the first FileDocument bound to the given File.
static FileDocument getFileDocumentFromFilename(String filename)
          Retrieves the first FileDocument bound to the given filename.
static File getFileFromThumbnail(File thumbnailFile)
          Retrieve the original File associated with the given thumbnail File.
 Date getFileIndexingDate()
           
 String getFilename()
          Retrieve the path relative to the webapp of the file pointed by this FileDocument.
 String getGenericContentType()
          Returns the generic content-type of this FileDocument (eg "video" if content-type contains "video/mpeg").
 String getGenericThumbnail()
          Returns a generic thumbnail for this FileDocument (defined in properties file-document.thumb.*)
 long getHeight()
          Retrieve the height of the image represented by this filedoc.
static FileDocument.HiddenSelector getHiddenSelector()
           
 String getIcon()
          Returns the icon bound to the type of this FileDocument
 Date getIndexedDate()
          Deprecated. see getFileIndexingDate()
static FileDocument getInstance(String filename)
          Constructs a FileDocument from an existing file.
static FileDocument getInstance(String filename, Member author, Workspace ws)
          Constructs a FileDocument from an existing file.
static FileDocument getInstance(String filename, String title, String description, Category[] categories)
          Constructs a FileDocument from an existing file.
static FileDocument getInstance(String filename, String title, 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 Set<FileDocument> getLockedDocumentSet(Workspace ws, Member mbr)
          Returns the set of FileDocument which have a strong lock.
 org.apache.lucene.document.Document getLuceneDocument()
          Return the Lucene Document bound to this FileDocument.
 String getMediaType()
          Retrieves the media type of this FileDocument as a String.
static FileDocument.MediaTypeSelector getMediaTypeSelector(String mediaType)
           
 String getMetaData(String tag)
          Returns the value bound to the given metadata
 Map<String,String> getMetaDataMap()
          Returns the map of metadata
static String[] getNewDocumentDirectoryAndName(String fileName, 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.
static String getNewDocumentFilename(String fileName)
          Retrieves the relative path (==filename) to use for creation of a new FileDocument for the given file's name.
static String getOriginalDocumentFromPDF(String pdfFilename)
          Returns the filename of the original document bound to the given PDF filename otherwise returns null.
 String getOriginalFilename()
           
static String getQualifiedName(String filename)
          This method return the name of a given file without the extension.
static String getRealContentType(String contentType, String extension)
          This method retrieve the real content type from a given one.
 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>
Comparator<T>
getSizeComparator()
           
 Date getStrongLockDate()
          Returns the date of the strong lock.
 String getStrongLockInfo(Locale locale)
          Returns a string which explains who has the lock (return "" if this document has no strong lock)
 Member getStrongLockMember()
          Returns the member who has strongly locked this FileDocument.
static DataSelector getStrongLockSelector()
          Retrieves a new instance of DataSelector based on the strong lock status of the file document.
static File getThumbnailFile(File file, int maxWidth, int maxHeight)
          Gets the File to use for a thumbnail of the given image file, using given dimensions.
static String getThumbnailFilename(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}.jpg
 String getTypeInfo(String lang)
          Returns the information bound to the type this FileDocument
 Date getUploadDate()
          Returns the date of the last upload.
 long getWidth()
          Retrieve the width of the image represented by this filedoc.
 boolean hasStrongLock()
          Deprecated. see isStrongLocked()
 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)
           
 boolean internalCanBeReadBy(Member member, boolean searchInGroups)
           
 boolean isAudio()
          Returns true if this FileDocument is an audio file.
 boolean isFlash()
          Returns true if this FileDocument is a flash file.
static boolean isGeneratedPDF(String filename)
          Returns true if the given filename is a PDF file generated with JCMS Universal.
static boolean isGenericContentType(String contentType)
           
 boolean isImage()
          Returns true if this FileDocument is an image.
 boolean isIndexed()
           
 boolean isMedia()
          Check if this FileDocument is a media file (ie : an image, audio, video or flash file)
 boolean isStrongLocked()
          Returns true if this FileDocument has a strong lock.
 boolean isText()
          Returns true if this FileDocument is a text file.
static boolean isThumbnail(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.
 void performDelete(Member mbr, Map context)
          Performs data deletion
 void performUpdate(Member mbr, Map context)
          Performs data update
 void putStrongLock(Member mbr)
          Put (and save) a strong lock on this FileDocument.
 void releaseStrongLock()
          Releases the strong lock, without checking the member.
 void releaseStrongLock(Member mbr)
          Release the lock on this FileDocument
 void setContentType(String v)
           
 void setDescription(String v)
           
 void setDescriptionML(HashMap<String,String> v)
           
 void setFilename(String v)
           
 void setOriginalFilename(String v)
           
 void setStrongLockDate(Date date)
          Set the strong lock date.
 void setStrongLockMember(Member mbr)
          Set the member who has strongly locked this FileDocument.
 void setUploadDate(Date date)
          Set the date of the last upload.
 boolean supportsThumbnail()
          Returns true if a thumbnail can be generated for this document.
static long unzipToFileDocuments(File zipFile, FileFilter filter, FileDocument refFileDoc, Member opAuthor)
          Unzip the specified File to n new FileDocument.
 long unzipToFileDocuments(FileFilter filter, Member opAuthor)
          Unzip this FileDocument to n FileDocument.
 
Methods inherited from class com.jalios.jcms.Publication
addAuthorizedGroup, addAuthorizedMember, addCategory, addWeakReferrer, addWFExpressAlarm, addWFReminderAlarm, assignCommonPublicationFields, assignRole, assignRole, canBeArchived, canBeArchived, canBeEditedFieldByField, canBeReadBy, canBeReadBy, canCreateCopy, canCreateWorkCopy, canMergeWorkCopy, checkCreate, checkLang, checkMember, checkMerge, checkStateChange, checkTemplateEntry, checkUpdate, checkWrite, clearTransientIndex, computeSignature, containsCategory, createCopy, createWFNote, createWorkCopy, getAbstract, getAbstractML, getAccessCount, getAdate, getAdateComparator, getAdateSelector, getAllWysiwygText, getAudiencedRightsString, getAudienceRightComparator, getAudienceRightSelector, getAuthorizedGroupSet, getAuthorizedMemberSet, getAuthorizedSelector, getCanWorkOnSelector, getCategories, getCategories, getCategorySet, getComparator, getComparator, getCSVHeader, getDataName, getDate, getDate, getDateSelector, getDdateComparator, getDefaultTemplateUsage, getDescendantCategorySet, getDescendantCategorySet, getDescendantCategorySet, getDisplayTemplateFile, getDocumentLinkSet, getEdate, getEdateComparator, getEdateSelector, getEstimatedReminderCount, getExternalLinkSet, getFieldInMainLanguage, getFirstDescendantCategory, getFirstDescendantCategory, getFirstDescendantCategory, getFriendlyURLSet, getGlobalRating, getImportConflictCopy, getImportVersion, getIndexingDate, getLinkDataSet, getMainInstance, getMainLanguage, getMajorVersion, getMemberSetAssignedToRole, getMergeDate, getMergeId, getMinorVersion, getNextWFStateSet, getPdate, getPdateComparator, getPdateSelector, getPstatus, getPstatusAlarmEntry, getPstatusComparator, getPstatusSelector, getPstatusSelector, getQueryTemplateFile, getRatingComparator, getReaderComparator, getReaderCount, getReaderTrackerList, getReadRightSelector, getReadRightsString, getReview, getReviewCount, getReviewCountComparator, getReviewList, getReviewList, getRightComparator, getRoleMap, getSdate, getSdateComparator, getSdateSelector, getTemplate, getTemplateEntry, getTemplateEntry, getTemplateEntrySet, getTemplatePath, getTemplatePath, getTemplates, getTitle, getTitle, getTitle, getTitleComparator, getTitleComparator, getTitleML, getTrackedSelector, getTreeChildren, getTreeParent, getTreeRoot, getTypeComparator, getTypeLabel, getUdate, getUdateComparator, getUdateSelector, getUpdateGroupSet, getUpdateMemberSet, getVersionString, getVisibleStateSelector, getWeakReferrerSet, getWFNoteList, getWFState, getWFStateLabel, getWorkCopySet, getWorkflow, getWorkspace, getWorkspaceAuthorSelector, getWorkspaceComparator, getWorkspaceId, getWorkspaceSelector, getWSTypeEntry, getWSTypeEntry, hasAlreadyVoted, hasAnyReadRights, hasBeenReadBy, hasCategory, hasImportConflict, hasNoReadRights, hasReview, hasWeakReferrers, importConvertToLocal, importMarkAsMerged, importOverrideAndUpdate, init, initCopy, isAudienced, isDefaultTemplate, isImportConflictCopy, isInRole, isInVisibleState, isPublic, isRoleAssigned, isTracked, isTreeLeaf, isTreeNode, isUserContent, isUserContentType, isWorkCopy, majorUpdate, performCreate, performMerge, performMerge, prepareMergeCopy, putPstatusAlarmEntry, removeAllDescendants, removeAllReaderTracker, removeAuthorizedGroup, removeAuthorizedMember, removeCategory, removeDataSet, removeImportMetadata, removePstatusAlarmEntry, removeWeakReferrer, removeWFExpressAlarm, removeWFReminderAlarm, resolveTypeTemplateEntry, setAdate, setAuthorizedGroupSet, setAuthorizedMemberSet, setCategories, setCategorySet, setCdate, setEdate, setFriendlyURLSet, setImportConflictCopy, setImportVersion, setMainInstance, setMainLanguage, setMajorVersion, setMergeDate, setMergeId, setPdate, setPstatus, setRoleMap, setRoleMemberSetMap, setSdate, setTemplate, setTemplates, setTitle, setTitle, setTitleML, setTracked, setUdate, setUpdateGroupSet, setUpdateMemberSet, setWorkspace, setWorkspaceId, toCSV, toFullString, toString, trackReader, unassignMember, unassignRole, updatePstatus, updateTemplate
 
Methods inherited from class com.jalios.jcms.Data
checkCreate, checkDelete, checkIntegrity, checkLock, checkUpdate, clone, computeDBIDArray, exportXml, exportXml, exportXml, exportXml, exportXmlRelated, exportXmlRelated, fillExportXmlFieldAttributes, getAllReferrerSet, getAllReferrerSet, getAllTypeFieldEntry, getAuthor, getAuthor, getAuthorComparator, getAuthorDBID, getAuthorId, getAuthorSelector, getBooleanFieldValue, getCaddyComparator, getCategoryFieldValue, getCdateSelector, getDataImage, getDataNameComparator, getDeletableSelector, getDisplayUrl, getDoubleFieldValue, getExtension, getExtraData, getExtraDataMap, getExtraDBData, getExtraDBDataMap, getExtraInfo, getExtraInfoMap, getFieldStatusMap, getFieldValue, getFieldValue, getFieldValue, getImportAuthor, getImportBatch, getImportDate, getImportDisplayUrl, getImportId, getImportMap, getImportMdate, getImportSelector, getImportSignature, getImportSource, getImportSourceUrl, getImportUrl, getIntFieldValue, getIntFieldValue, getLinkCount, getLinkIndexedDataSet, getLinkIndexedDataSet, getLockDate, getLockMember, getLongFieldValue, getMdateSelector, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getOpAuthor, getOpAuthorComparator, getOpDelegate, getRowId, getTypeEntry, getTypeFieldsEntries, getUpdateInstance, hashCode, importXmlFiles, importXmlReferences, isImported, isImportUpdated, isInDatabase, isLocked, isPersisted, lock, markNewImport, mergeHybridLink, performAfterWrite, performBeforeWrite, performCreate, performDelete, performUpdate, removeExtraData, removeExtraDBData, removeExtraInfo, setAuthor, setAuthorDBID, setAuthorId, setExtension, setExtraData, setExtraDataMap, setExtraDBData, setExtraDBDataMap, setExtraInfo, setImportAuthor, setImportBatch, setImportDate, setImportDisplayUrl, setImportId, setImportMap, setImportMdate, setImportSignature, setImportSource, setImportSourceUrl, setImportUpdated, setMdate, setOpAuthor, setOpDelegate, setRowId, unlock, unlock, unmarkNewImport, 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, isStored, resolveAtt, resolveVal, setAttributes, setDdate, setId, setStore, toXml
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

HIDDEN_PSTATUS

public static final int HIDDEN_PSTATUS
See Also:
Constant Field Values

THUMBNAIL_PREFIX

public static final String THUMBNAIL_PREFIX
See Also:
Constant Field Values

DEFAULT_WORKFLOW

protected static Workflow DEFAULT_WORKFLOW

OPENXML_PRESENTATION_MIMETYPE

public static final String OPENXML_PRESENTATION_MIMETYPE
See Also:
Constant Field Values

OPENOFFICE_MIMETYPE

public static final String OPENOFFICE_MIMETYPE
See Also:
Constant Field Values

description

protected String description

descriptionML

protected HashMap<String,String> descriptionML

filename

protected String filename

originalFilename

protected String originalFilename

contentType

protected String contentType

strongLockMember

protected Member strongLockMember

strongLockDate

protected Date strongLockDate

uploadDate

protected Date uploadDate
Constructor Detail

FileDocument

public FileDocument()

FileDocument

public FileDocument(FileDocument other)
Method Detail

getInstance

public static FileDocument getInstance(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(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 path
author - the author of the document or null
ws - 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(String filename,
                                       String title,
                                       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 path
title - 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(String filename,
                                       String title,
                                       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 path
title - 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 null
ws - 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

getFieldValue

public Object getFieldValue(String fieldName,
                            String lang,
                            boolean useDefault)
                     throws NoSuchFieldException
Gets the Object value of the given field name for this FileDocument.

Overrides:
getFieldValue in class Publication
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:
NoSuchFieldException - if the field was not found in the given Publication.

getAbstract

public String getAbstract()
Description copied from class: Publication
Returns the abstract of this publication in the channel's main language.

Overrides:
getAbstract in class Publication
Returns:
the abstract of this publication in the channel's main language.

getAbstract

public String getAbstract(String lang,
                          boolean useDefault)
Retrieve the value of this FileDocument's abstract field (description) in the specified language.

Overrides:
getAbstract in class Publication
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 String getDataImage()
Description copied from class: Data
Retrieves the image path of this data in the channel's main language.

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 class Data
Returns:
a path relative to the webapp root.

getDataImage

public String getDataImage(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 class Data
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 String getAllWikiText()
Retrieve a String containing all the wiki text available for this FileDocument.
Current implementation is to retrieve descrition values in all languages available.

Overrides:
getAllWikiText in class Publication
Returns:
a String which contains the concatenation of all the wiki fields.

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 class Publication
Parameters:
elt - the JDOM element
options - the ImportOptions

importXmlFieldsWithReferences

protected void importXmlFieldsWithReferences(org.jdom.Element elt,
                                             ImportOptions options)
Overrides:
importXmlFieldsWithReferences in class Data

getExportXmlDataValue

public String getExportXmlDataValue()
Returns a string representation of this data used by exportXml().

Overrides:
getExportXmlDataValue in class Data
Returns:
a string representation of this data used by exportXml().
Since:
jcms-5.7.2

exportXmlField

public void exportXmlField(StringBuffer sb,
                           int indentLevel)
Description copied from class: Data
Fills the given StringBuffer with Xml export of fields of this data.

Overrides:
exportXmlField in class Publication
Parameters:
sb - the StringBuffer
indentLevel - the indent level

getSearchStrings

public 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 interface Searchable
Overrides:
getSearchStrings in class Publication
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

getFile

public File getFile()
Returns the File object for the corresponding the filename

Returns:
a File object
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 String getIcon()
Returns the icon bound to the type of this FileDocument

Returns:
the relative URL of the icon
Since:
jcms-4.0

getGenericContentType

public 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 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)

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 String getMediaType()
Retrieves the media type of this FileDocument as a String.

Returns:
the media type as a string

isIndexed

public boolean isIndexed()
Returns:
true if this FileDocument has been indexed with Lucene
Since:
jcms-4.0.1

getIndexedDate

public Date getIndexedDate()
Deprecated. see getFileIndexingDate()

Returns:
the date this file has been indexed
Since:
jcms-4.0.1

getFileIndexingDate

public Date getFileIndexingDate()
Returns:
the date the file has been indexed
Since:
jcms-6.0.1

getLuceneDocument

public org.apache.lucene.document.Document getLuceneDocument()
Return the Lucene Document bound to this FileDocument.

Returns:
a Lucene Document
Since:
jcms-4.0.1

getTypeInfo

public String getTypeInfo(String lang)
Returns the information bound to the type this FileDocument

Parameters:
lang - the user language
Returns:
an information String
Since:
jcms-4.0

getMetaData

public String getMetaData(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 Map<String,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 class Publication
Parameters:
mbr - the member to be checked
isWorkCopy - 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)

internalCanBeReadBy

public boolean internalCanBeReadBy(Member member,
                                   boolean searchInGroups)

canBeReadBy

public boolean canBeReadBy(Group group)
Description copied from class: Publication
Checks if a group can read this publication.

Overrides:
canBeReadBy in class Publication
Parameters:
group - the group to check
Returns:
true if the group can read this publication

getDescription

public String getDescription(String lang)

getDescription

public String getDescription(String lang,
                             boolean useDefault)

getDescription

public String getDescription()

setDescription

public void setDescription(String v)

getDescriptionML

public HashMap<String,String> getDescriptionML()

setDescriptionML

public void setDescriptionML(HashMap<String,String> v)

getFilename

public 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(String v)

getOriginalFilename

public String getOriginalFilename()

setOriginalFilename

public void setOriginalFilename(String v)

getContentType

public String getContentType()

setContentType

public void setContentType(String v)

getStrongLockMember

public Member getStrongLockMember()
Returns the member who has strongly locked this FileDocument.

Returns:
the member who has strongly locked this FileDocument.
Since:
jcms-5.7.0

setStrongLockMember

public void setStrongLockMember(Member mbr)
Set the member who has strongly locked this FileDocument.

Parameters:
mbr - the member
Since:
jcms-5.7.0

getStrongLockDate

public Date getStrongLockDate()
Returns the date of the strong lock.

Returns:
the date of the strong lock.
Since:
jcms-5.7.0

setStrongLockDate

public void setStrongLockDate(Date date)
Set the strong lock date.

Parameters:
date - the date.
Since:
jcms-5.7.0

getUploadDate

public 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(Date date)
Set the date of the last upload.

Parameters:
date - the date.
Since:
jcms-5.7.0

isStrongLocked

public boolean isStrongLocked()
Returns true if this FileDocument has a strong lock.

Returns:
true if this FileDocument has a strong lock.
Since:
jcms-6.0.0

hasStrongLock

@Deprecated
public boolean hasStrongLock()
Deprecated. see isStrongLocked()

Returns true if this FileDocument has a strong lock.

Returns:
true if this FileDocument has a strong lock.
Since:
jcms-5.7.0

putStrongLock

public void putStrongLock(Member mbr)
Put (and save) a strong lock on this FileDocument.

Parameters:
mbr - the member who puts the strong lock.
Since:
jcms-5.7.0

releaseStrongLock

public void releaseStrongLock(Member mbr)
Release the lock on this FileDocument

Parameters:
mbr - the member who releases the lock (only the member who has locked and the admin can release the lock).
Since:
jcms-5.7.0

releaseStrongLock

public void releaseStrongLock()
Releases the strong lock, without checking the member.

Since:
jcms-5.7.0

checkStrongLockMember

public boolean checkStrongLockMember(Member mbr)
Returns true if the given member has locked this FileDocument or if this document is not locked.

Parameters:
mbr - the member
Returns:
true if the given member has locked this FileDocument or if this document is not locked.
Since:
jcms-5.7.0

getStrongLockInfo

public String getStrongLockInfo(Locale locale)
Returns a string which explains who has the lock (return "" if this document has no strong lock)

Parameters:
locale - the locale
Returns:
a string which explains who has the lock.
Since:
jcms-5.7.0

canRequestLock

public boolean canRequestLock(Member mbr)
Returns true if the given member can request the lock (by mail).

Parameters:
mbr - the member who request the lock
Returns:
true if the given member can request the lock (by mail).
Since:
jcms-5.7.0

getLockedDocumentSet

public static 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 workspace
mbr - 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 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(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 String getOriginalDocumentFromPDF(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

getGenericThumbnail

public String getGenericThumbnail()
Returns a generic thumbnail for this FileDocument (defined in properties file-document.thumb.*)

Returns:
a generic thumbnail
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(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 String getThumbnailFilename(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}.jpg

Parameters:
originalFilename - the filename to convert, must not be null or empty
maxWidth - 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.

getThumbnailFile

public static File getThumbnailFile(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)

getFileFromThumbnail

public static File getFileFromThumbnail(File thumbnailFile)
Retrieve the original File associated with the given thumbnail File. Match the format specified in getThumbnailFile(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.

isThumbnail

public static boolean isThumbnail(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:
PolicyManager.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(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(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(String contentType)

getDefaultContentType

public static String getDefaultContentType()

getRealContentType

public static String getRealContentType(String contentType,
                                        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 type
extension - the file extension
Returns:
String the computed content type
Since:
jcms-5.5.0

getAccessibilityInformation

public String getAccessibilityInformation(Locale locale,
                                          boolean htmlDisplay)
Returns a formatted string displaying accesibility information. May be used to generate accessible link to file : télécharger le rapport statistique (format PDF, 400ko)

Parameters:
locale - the current Locale
htmlDisplay - 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 String getNewDocumentFilename(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:
IllegalArgumentException - if the fileName argument is null.
Since:
jcms-5.7.0

getNewDocumentDirectoryAndName

public static String[] getNewDocumentDirectoryAndName(String fileName,
                                                      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:
IllegalArgumentException - if the fileName argument is null.
Since:
jcms-5.7.0

getExtension

public static String getExtension(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

Returns "txt" if the extension computed by IOUtil.getExtension(String) is "jsp".

Parameters:
filename - the file name
Returns:
String the file extension
See Also:
IOUtil.getExtension(String)

getQualifiedName

public static String getQualifiedName(String filename)
This method return the name of a given file without the extension. it return string before last '.' of the filename. ie. FileName.Ext -> FileName

Parameters:
filename - the file name
Returns:
String the file name

getContentTypeComparator

public static <T extends FileDocument> Comparator<T> getContentTypeComparator()
Type Parameters:
T -
Returns:
a ContentType comparator
Since:
jcms-4.1

getSizeComparator

public static <T extends FileDocument> Comparator<T> getSizeComparator()
Type Parameters:
T -
Returns:
a Size comparator
Since:
jcms-4.1

getDimensionsComparator

public static <T extends FileDocument> Comparator<T> getDimensionsComparator()
Type Parameters:
T - subclass of FileDocument
Returns:
a Dimensions comparator
Since:
jcms-5.5.0

getDurationComparator

public static <T extends FileDocument> Comparator<T> getDurationComparator()
Type Parameters:
T - subclass of FileDocument
Returns:
a Duration comparator
Since:
jcms-5.5.0

getComparator

public static Comparator<FileDocument> getComparator(String str,
                                                     boolean reverse)
Retrieves a new Comparator given a name representing it. The returned comparator can be used to sort any Collection containing Publications.

You can specify any of the following value:
  • "contentType": getContentTypeComparator()
  • "dimensions": getDimensionsComparator()
  • "duration": getDurationComparator()
  • "size": getSizeComparator()

  • And also any of the value available through Publication.getComparator(String, boolean)

    Parameters:
    str - a string representing the comparator
    reverse - 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(String mediaType)

    unzipToFileDocuments

    public long unzipToFileDocuments(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 :

    Warning: it can be a time consumming operation, depending on the zip's size.

    Parameters:
    filter - an optionnal 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

    unzipToFileDocuments

    public static long unzipToFileDocuments(File zipFile,
                                            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 unzip
    filter - an optionnal FileFilter to filter the files to be extracted and converted to FileDocument. This filter is also used on extracted directory.
    refFileDoc - optionnal FileDocument from which to retrieve fields value to be assigned to the newly created FileDocuments. See Publication.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(File dir,
                                                FileFilter filter,
                                                FileDocument refFileDoc,
                                                Member opAuthor,
                                                Map<String,? extends 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 Files
    filter - an optionnal FileFilter to filter the files to be converted to FileDocument.
    refFileDoc - optionnal FileDocument from which to retrieve fields value to be assigned to the newly created FileDocuments. See Publication.assignCommonPublicationFields(Publication).
    opAuthor - optional (but recommended) Member to used to perform the create operation
    contextMap - 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

    checkIntegrity

    public ControllerStatus checkIntegrity()
    Description copied from class: Publication
    Checks whether or not data integrity constraints are respected.

    Overrides:
    checkIntegrity in class Publication
    Returns:
    a ControllerStatus

    checkDelete

    public ControllerStatus checkDelete(Member mbr,
                                        Map context)
    Checks if the deletion can be performed

    Overrides:
    checkDelete in class Publication
    Parameters:
    mbr - the member which requests the write operation
    context - a map which contains context parameters (may be null)
    Returns:
    a ControllerStatus
    Since:
    jcms-5.0.0

    performUpdate

    public void performUpdate(Member mbr,
                              Map context)
    Description copied from class: Publication
    Performs data update

    Overrides:
    performUpdate in class Publication
    Parameters:
    mbr - the member which requests the write operation
    context - a map which contains context parameters (may be null)

    performDelete

    public void performDelete(Member mbr,
                              Map context)
    Description copied from class: Publication
    Performs data deletion

    Overrides:
    performDelete in class Publication
    Parameters:
    mbr - the member which requests the write operation
    context - a map which contains context parameters (may be null)

    getStrongLockSelector

    public static DataSelector getStrongLockSelector()
    Retrieves a new instance of DataSelector based on the strong lock status of the file document.

    Returns:
    a new instance of FileDocument.StrongLockSelector

    getAllFilePath

    public Set<String> getAllFilePath()
    Description copied from class: Publication
    Gives the set of all relatives path to all kind (image, media, file) of files linked from the given publication.

    Overrides:
    getAllFilePath in class Publication
    Returns:
    a not null set of all relative path to linked files.


    Copyright © 2001-2007 Jalios SA. All Rights Reserved.