|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jstore.BasicStorable com.jalios.jcms.Data com.jalios.jcms.Publication com.jalios.jcms.Content com.jalios.jcms.FileDocument
public class FileDocument
Nested Class Summary | |
---|---|
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 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. |
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 | |
---|---|
protected String |
contentType
|
static String |
DEFAULT_DETAIL_VIEW_PROP
|
protected static Workflow |
DEFAULT_WORKFLOW
|
protected String |
description
|
protected HashMap<String,String> |
descriptionML
|
protected String |
filename
|
static int |
HIDDEN_PSTATUS
|
static boolean |
isDefaultDetailView
|
static String |
OPENOFFICE_MIMETYPE
|
static String |
OPENXML_PRESENTATION_MIMETYPE
|
protected String |
originalFilename
|
static String |
REVISION
|
static String |
THUMBNAIL_PREFIX
|
static String |
THUMBNAIL_REGEXP
|
protected Date |
uploadDate
|
Fields inherited from class com.jalios.jcms.Data |
---|
author, authorDBID, channel, DISPLAY_URL_EXTRA_INFO, extension, extraDataMap, extraDBDataMapToSaveOnOp, importMap, 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.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) |
|
ControllerStatus |
checkIntegrity()
Checks whether or not data integrity constraints are respected. |
|
void |
clearInternalCache()
Clear internal cache of this FileDocument. |
|
String |
computeSignature(boolean includePublicationFields,
boolean hash)
Compute the signature of this publication. |
|
Set<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(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. |
|
Set<File> |
getAssociatedFileSet()
Retrieve a Set of File associated to this FileDocument. |
|
File |
getAssociatedPDF()
Returns the pdf associated with a FileDocument. |
|
static Comparator<FileDocument> |
getComparator(String str,
boolean reverse)
Deprecated. use ComparatorManager |
|
String |
getContentType()
|
|
static
|
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
|
getDimensionsComparator()
|
|
long |
getDuration()
Returns the duration of the audio (reserved for audio files) |
|
static
|
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. ie. |
|
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. Example: upload/docs/image/jpg/welcome.gif
It should not start with a slash ("/"). |
|
|
getFileReferrerSet(Class<T> clazz)
Returns all the data referring the file of this FileDocument (except this FileDocument itself). |
|
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 as defined by properties file-document.thumb.{generic-content-type} . |
|
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(Class<? extends FileDocument> clazz,
String filename,
String title,
String description,
Category[] categories,
Member author,
Workspace ws)
Constructs a FileDocument from an existing file for the given class. |
|
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. 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 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" |
|
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
|
getSizeComparator()
|
|
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. |
|
Set<Publication> |
getWeakReferrerSet()
Returns the set of weak referrers. |
|
long |
getWidth()
Retrieve the width of the image represented by this filedoc. |
|
boolean |
hasStrongLock()
Deprecated. see Data.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)
|
|
protected boolean |
internalCanBeReadBy(Member member,
boolean searchInGroups,
RightInfo rightInfo)
|
|
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(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 |
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. |
|
protected void |
performAfterWrite(int op,
Member mbr,
Map context)
Called to perform some action after the write. |
|
void |
performDelete(Member mbr,
Map context)
Performs data deletion |
|
void |
performUpdate(Member mbr,
Map context)
Performs data update |
|
void |
setContentType(String v)
|
|
void |
setDescription(String v)
|
|
void |
setDescription(String 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) or setDescriptionML(HashMap) )
depending on the specified language. |
|
void |
setDescriptionML(HashMap<String,String> v)
|
|
void |
setFieldValue(String fieldName,
Object value,
String lang)
Sets the value of the given Object field name for the current Data . |
|
void |
setFilename(String v)
|
|
void |
setOriginalFilename(String v)
|
|
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.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 |
---|
public static final String REVISION
public static final int HIDDEN_PSTATUS
public static final String THUMBNAIL_PREFIX
public static final String THUMBNAIL_REGEXP
protected static Workflow DEFAULT_WORKFLOW
public static final String OPENXML_PRESENTATION_MIMETYPE
public static final String OPENOFFICE_MIMETYPE
public static final String DEFAULT_DETAIL_VIEW_PROP
public static final boolean isDefaultDetailView
protected String description
protected HashMap<String,String> descriptionML
protected String filename
protected String originalFilename
protected String contentType
protected Date uploadDate
Constructor Detail |
---|
public FileDocument()
public FileDocument(FileDocument other)
Method Detail |
---|
public static FileDocument getInstance(String filename)
filename
- the filename. It must be relative to the context path
public static FileDocument getInstance(String filename, Member author, Workspace ws)
filename
- the filename. It must be relative to the context pathauthor
- the author of the document or nullws
- the workspace of the publication
public static FileDocument getInstance(String filename, String title, String description, Category[] categories)
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)
public static FileDocument getInstance(String filename, String title, String description, Category[] categories, Member author, Workspace ws)
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
public static FileDocument getInstance(Class<? extends FileDocument> clazz, String filename, String title, String description, Category[] categories, Member author, Workspace ws)
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
public Object getFieldValue(String fieldName, String lang, boolean useDefault) throws NoSuchFieldException
Object
value of the given field name for this FileDocument
.
getFieldValue
in class Publication
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).
Object
field value
NoSuchFieldException
- if the field was not found in the given Publication
.public void setFieldValue(String fieldName, Object value, String lang) throws NoSuchFieldException
Object
field name for the current Data
. Category
fields, see #getCategoryFieldValue(String, Member).
setFieldValue
in class Publication
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).
NoSuchFieldException
- if the field was not found in the given Data
.public String getAbstract()
Publication
getAbstract
in class Publication
public String getAbstract(String lang, boolean useDefault)
getAbstract
in class Publication
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.
public String getDataImage()
Data
This method can (should) be implemented by subclasses to provide an image/illustration of this Data.
Default behaviour is to return empty string.
getDataImage
in class Data
public String getDataImage(String lang, boolean useDefault)
Data
This method can (should) be implemented by subclasses to provide an image/illustration of this Data.
Default behaviour is to return empty string.
getDataImage
in class Data
lang
- the user language (ISO-639 language code)useDefault
- should the default language be used if no value is found for the specified language
public String getAllWikiText()
getAllWikiText
in class Publication
public void importXml(org.jdom.Element elt, ImportOptions options)
Data
importXml
in class Publication
elt
- the JDOM elementoptions
- the ImportOptionsprotected void importXmlFieldsWithReferences(org.jdom.Element elt, ImportOptions options)
importXmlFieldsWithReferences
in class Data
public String getExportXmlDataValue()
getExportXmlDataValue
in class Data
public void exportXmlField(StringBuffer sb, int indentLevel)
Data
exportXmlField
in class Publication
sb
- the StringBufferindentLevel
- the indent levelpublic String[] getSearchStrings()
getSearchStrings
in interface Searchable
getSearchStrings
in class Publication
Searchable.getSearchStrings()
public void clearInternalCache()
You might need to invoke this method after modification to the file without update of the FileDocument (this is not recommended though).
public boolean isDefaultDetailView()
public File getFile()
public long getSize()
public long getLastModified()
public String getIcon()
public String getGenericContentType()
public long getWidth()
public long getHeight()
public String getDimensions()
public long getDuration()
AudioUtil.getDuration(File)
public boolean isWebImage()
public boolean isImage()
public boolean isAudio()
public boolean isVideo()
public boolean isText()
public boolean isFlash()
public boolean isMedia()
public String getMediaType()
isImage()
: "image"
isAudio()
: "audio"
isVideo()
: "video"
isFlash()
: "flash"
"other"
public boolean isIndexed()
@Deprecated public Date getIndexedDate()
getFileIndexingDate()
public Date getFileIndexingDate()
public org.apache.lucene.document.Document getLuceneDocument()
public String getTypeInfo(String lang)
lang
- the user language
public Set<Publication> getWeakReferrerSet()
Publication
getWeakReferrerSet
in class Publication
public <T extends Data> Set<T> getFileReferrerSet(Class<T> clazz)
clazz
- the class for filter with.
Returns all the data referring the file of this FileDocument (except this FileDocument itself).public String getMetaData(String tag)
tag
- the name of the metadata to get
public Map<String,String> getMetaDataMap()
public boolean canCreateCopy(Member mbr, boolean isWorkCopy)
canCreateCopy
in class Publication
mbr
- the member to be checkedisWorkCopy
- true if this is a workCopy
Publication.canCreateCopy(com.jalios.jcms.Member,boolean)
protected boolean internalCanBeReadBy(Member member, boolean searchInGroups, RightInfo rightInfo)
internalCanBeReadBy
in class Publication
public boolean canBeReadBy(Group group)
Publication
canBeReadBy
in class Publication
group
- the group to check
public String getDescription(String lang)
public String getDescription(String lang, boolean useDefault)
public String getDescription()
public void setDescription(String v)
public HashMap<String,String> getDescriptionML()
public void setDescriptionML(HashMap<String,String> v)
public void setDescription(String lang, String value)
setDescription(String)
or setDescriptionML(HashMap)
)
depending on the specified language.
lang
- the language (ISO 639 code) in which to set the valuevalue
- the value to set.public String getFilename()
upload/docs/image/jpg/welcome.gif
It should not start with a slash ("/").
public void setFilename(String v)
public String getOriginalFilename()
public void setOriginalFilename(String v)
public String getContentType()
public void setContentType(String v)
public Date getUploadDate()
public void setUploadDate(Date date)
date
- the date.@Deprecated public boolean hasStrongLock()
Data.isStrongLocked()
public static Set<FileDocument> getLockedDocumentSet(Workspace ws, Member mbr)
ws
- the workspacembr
- the member who performs this request (to check read rights)
public File getAssociatedPDF()
public boolean deleteAssociatedPDF()
public static boolean isGeneratedPDF(String filename)
filename
- the filename to be checked
public static String getOriginalDocumentFromPDF(String pdfFilename)
pdfFilename
- the filename of a PDF file generated with JCMS Universal
public Set<File> getAssociatedFileSet()
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.
FileDocument.AssociatedFileFilter
public Set<File> deleteAssociatedFiles()
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.
FileDocument.AssociatedFileFilter
public String getGenericThumbnail()
file-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.
getGenericThumbnail
in class Data
images/jalios/icons/media/word.gif
public boolean deleteThumbnails()
deleteThumbnails(File)
public static boolean deleteThumbnails(File originalFile)
originalFile
- the original file used to produce thumbnails
public static String getThumbnailFilename(String originalFilename, int maxWidth, int maxHeight)
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.
public static File getThumbnailFile(File file, int maxWidth, int maxHeight)
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.
getThumbnailFilename(String, int, int)
public static File getFileFromThumbnail(File thumbnailFile)
getThumbnailFile(File, int, int)
.
thumbnailFile
- a File representing the thumbnail.
public static boolean isThumbnail(File file)
file
- the file to be checked
public boolean supportsThumbnail()
PolicyManager.supportsThumbnail(FileDocument, boolean)
public static Workflow getDefaultWorkflow()
public static FileDocument getFileDocumentFromFile(File file)
file
- the File of the FileDocument to be retrieved.
getFileDocumentFromFilename(String)
public static FileDocument getFileDocumentFromFilename(String filename)
filename
- the filename (relative path such as
"upload/docs/image/gif/welcome.gif"
) of the FileDocument to be retrieved.
getFileDocumentFromFile(File)
public static boolean isGenericContentType(String contentType)
public static String getDefaultContentType()
public static String getRealContentType(String contentType, String extension)
contentType
- the file content typeextension
- the file extension
public String getAccessibilityInformation(Locale locale, boolean htmlDisplay)
locale
- the current LocalehtmlDisplay
- if true, uses an html format, with detailed abbreviation, otherwise, use only plain text
public static String getNewDocumentFilename(String fileName)
"Présentation finale.ps"
, can return a path
such as "upload/docs/application/postscript/2006/06/presentation-finale.ps"
fileName
- the original name of the file to be added.
IllegalArgumentException
- if the fileName argument is null.public static String[] getNewDocumentDirectoryAndName(String fileName, String contentType)
"Présentation finale.ps"
, can return a path
such as "upload/docs/application/postscript/2006/06/presentation-finale.ps"
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.
IllegalArgumentException
- if the fileName argument is null.public static String getExtension(String filename)
IOUtil.getExtension(String)
is "jsp".
filename
- the file name
IOUtil.getExtension(String)
public static String getQualifiedName(String filename)
filename
- the file name
public static <T extends FileDocument> Comparator<T> getContentTypeComparator()
T
-
public static <T extends FileDocument> Comparator<T> getSizeComparator()
T
-
public static <T extends FileDocument> Comparator<T> getDimensionsComparator()
T
- subclass of FileDocument
public static <T extends FileDocument> Comparator<T> getDurationComparator()
T
- subclass of FileDocument
public static Comparator<FileDocument> getComparator(String str, boolean reverse)
ComparatorManager
Comparator
given a name representing
it. The returned comparator can be used to sort any
Collection
containing Publication
s.
getContentTypeComparator()
getDimensionsComparator()
getDurationComparator()
getSizeComparator()
Publication.getComparator(String, boolean)
str
- a string representing the comparatorreverse
- a boolean indicating whether the comparator should have
its behavior reversed (true) or unchanged (false)
Comparator
.Publication.getComparator(String, boolean)
public static FileDocument.HiddenSelector getHiddenSelector()
public static FileDocument.MediaTypeSelector getMediaTypeSelector(String mediaType)
public long unzipToFileDocuments(FileFilter filter, Member opAuthor)
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 :
"application/zip"
Warning: it can be a time consumming operation, depending on the zip's size.
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
public static long unzipToFileDocuments(File zipFile, FileFilter filter, FileDocument refFileDoc, Member opAuthor)
Warning: it can be a time consumming operation, depending on the zip's size.
zipFile
- the File to unzipfilter
- 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
public static long directoryToFileDocuments(File dir, FileFilter filter, FileDocument refFileDoc, Member opAuthor, Map<String,? extends Object> contextMap)
Warning: it can be a time consumming operation.
dir
- the Directory from which to retrieve Filesfilter
- 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 operationcontextMap
- optional Map to be used during performCreate operation (may be null)
public ControllerStatus checkIntegrity()
Publication
checkIntegrity
in class Publication
public void performUpdate(Member mbr, Map context)
Publication
performUpdate
in class Publication
mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)public void performDelete(Member mbr, Map context)
Publication
performDelete
in class Publication
mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)protected void performAfterWrite(int op, Member mbr, Map context)
Data
performAfterWrite
in class Publication
op
- the operation (OP_CREATE, OP_UPDATE, ...)mbr
- the member which requests the write operationcontext
- a map which contains context parameters (may be null)public Set<String> getAllFilePath()
Publication
getAllFilePath
in class Publication
public String computeSignature(boolean includePublicationFields, boolean hash)
Publication
computeSignature
in class Publication
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |