Class FileData
- All Implemented Interfaces:
Displayable,StringFiller,ContentType,Detail,HasId,HasParents,HasStreamData
- Direct Known Subclasses:
Document,MemoAttachment,VirtualFileData
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcirculate(Transaction transaction) static voidstatic FileDatacreate(String path, StreamData streamData, Transaction transaction) static FileDatagetCirculation(Id personId) getCirculation(Person person) getFile()getName()Retrieves the name associated with the implementing entity.Retrieves an instance ofStreamData.static voidbooleanisAudio()booleanisDetailOf(Class<? extends StoredObject> masterClass) Check if the given class is a "master" for this class.booleanisEmpty()booleanisImage()booleanisLink()booleanisPDF()booleanisVideo()voidlinkTo(Transaction transaction, StoredObject object, String attribute) voidlinkTo(Transaction transaction, String link) voidreplaceWith(Transaction transaction, FileData file) Replace this version with another version.restore(Transaction transaction) Restore the previous version of this.voidsaveInFolder(Transaction transaction, String folderPath) final voidvoidsetFile(StreamData file) voidsetFile(BigDecimal idValue) voidtoString()String representation of the instance.voidunlinkFrom(Transaction transaction, FileFolder folder) voidvalidate()The system invokes this method internally whenever the object gets saved to the DB (that means, while doing transactions).voidThe system will invoke this whenever the object is saved to the DB.voidvalidateParentDetach(StoredObject parent, int linkType) Do validation when this gets detached from a parent object.static booleanCheck the given name is a valida file name or not.voidMethods inherited from class com.storedobject.core.StoredObject
addLink, addLink, addLink, addLink, addLink, addLink, addLink, addLink, checkCurrency, checkCurrency, checkForDuplicate, checkForDuplicate, checkTimeZone, checkTransaction, clearObjectLinks, contemporary, copy, copy, count, count, count, count, count, count, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, create, created, delete, delete, delete, deleted, directUpdate, equals, exists, exists, exists, exists, exists, existsFileData, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsMaster, existsMaster, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, family, family, family, family, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAttachment, getAttachmentId, getChildren, getContemporaryOf, getDeleted, getDeleted, getExistsCondition, getExistsCondition, getFileData, getFileData, getHistorical, getId, getKeyIndex, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getNotExistsCondition, getNotExistsCondition, getParent, getParent, getParent, getParentId, getParentId, getParentId, getRelated, getRelated, getTransaction, getTransactionId, getTransactionIP, getUnique, getUniqueCondition, hashCode, inserted, isModified, isVirtual, list, list, list, list, list, list, list, list, list, list, list, list, list, listDeletedIds, listFileData, listFileData, listHistory, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listTree, listTree, listTree, listTree, listViaQuery, listViaQuery, load, load, load, load, loadAttributesFrom, loaded, loading, makeNew, makeVirtual, migrate, moduleName, nextVersion, objectLink, objectLink, objectLink, objectLinks, objectLinks, old, person, previousVersion, previousVersion, query, query, query, query, query, query, query, query, query, query, query, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, reload, reload, reloaded, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeReverseLinks, removeReverseLinks, save, save, save, save, save, save, save, save, save, save, save, save, save, save, save, saved, saving, setMaster, setRawValue, setTransaction, stringify, tableName, timestamp, toCode, toDisplay, transacting, undelete, undelete, undeleted, updated, user, userId, validateChildAttach, validateChildDetach, validateChildUpdate, validateDelete, validateInsert, validateParentAttach, validateParentUpdate, validateUndelete, validateUpdate, valueEqualsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.storedobject.core.ContentType
getLink, getMimeType, isHTML, isMedia, isTextMethods inherited from interface com.storedobject.core.Detail
copyValuesFrom, getId, getUniqueId, getUniqueValueMethods inherited from interface com.storedobject.core.HasStreamData
getFileName
-
Constructor Details
-
FileData
public FileData() -
FileData
-
FileData
-
FileData
-
-
Method Details
-
columns
-
indices
-
setName
-
getName
Description copied from interface:HasStreamDataRetrieves the name associated with the implementing entity.- Specified by:
getNamein interfaceHasStreamData- Returns:
- a
Stringrepresenting the name, ornullif no name is available.
-
setFile
-
setFile
-
setFile
-
getFileId
-
getFile
-
getStreamData
Description copied from interface:HasStreamDataRetrieves an instance ofStreamData.- Specified by:
getStreamDatain interfaceHasStreamData- Returns:
- a
StreamDataobject, representing the stream data associated with the implementing entity.
-
isEmpty
public boolean isEmpty() -
validateData
Description copied from class:StoredObjectThe system will invoke this whenever the object is saved to the DB. It will be invoked in all cases while creating new objects and updating/deleting/undeleting existing objects. If any exception is raised by this method, the process of saving to the DB will be abandoned.
Note: This method is mainly used to validate the data of all attributes of the object, and it may be used by others for validating the object. For example, front-end data-entry systems can use this method for validating the object.
- Overrides:
validateDatain classStoredObject- Parameters:
tm- Current transaction manager.- Throws:
Exception- If data is invalid.
-
validName
Check the given name is a valida file name or not.- Parameters:
name- Name to check.- Returns:
- True/false.
-
restore
Restore the previous version of this.- Parameters:
transaction- Transaction.- Returns:
- Previous version of this file.
- Throws:
Exception- Raises if transaction fails or if no previous version exists..
-
getPreviousVersion
-
replaceWith
Replace this version with another version.- Parameters:
transaction- Transaction.file- New version of the document.- Throws:
Exception- Raises if transaction fails.
-
unlinkFrom
- Throws:
Exception
-
validateParentDetach
Description copied from class:StoredObjectDo validation when this gets detached from a parent object.Note: This method will be invoked only if this class implements
HasParents.- Overrides:
validateParentDetachin classStoredObject- Parameters:
parent- Parent to validate.linkType- Link type.- Throws:
Exception- By raising an exception from this method, the current transaction can be abandoned.
-
validate
Description copied from class:StoredObjectThe system invokes this method internally whenever the object gets saved to the DB (that means, while doing transactions). It will be invoked in all cases (while creating new objects and updating/deleting/undeleting existing objects). If this method raises any exceptions, the process of saving to the DB will be abandoned.
This method is not usually used for validating data (For that purpose,
StoredObject.validateData(TransactionManager)is recommended). It is mainly used for validating the state of the object. Methods such asStoredObject.created(),StoredObject.updated(),StoredObject.deleted(),StoredObject.undeleted()etc. are used to check the specific states, but overridden methods may check for other "application-specific"/"business-specific" states.This method is invoked only after one of the other operation-specific validate-methods is invoked depending on the save operation -
StoredObject.validateInsert(),StoredObject.validateUpdate(),StoredObject.validateDelete(),StoredObject.validateUndelete().Note: When overridden "super" should be called, otherwise, a "design error" will occur.
- Overrides:
validatein classStoredObject- Throws:
Exception- By raising an exception from this method, the current transaction can be abandoned.
-
isDetailOf
Description copied from interface:DetailCheck if the given class is a "master" for this class. (Must return a consistent value).- Specified by:
isDetailOfin interfaceDetail- Parameters:
masterClass- Class to check.- Returns:
- True if it is a "master" to this detail class. Otherwise, false.
-
toString
Description copied from class:StoredObjectString representation of the instance. Mostly used for logging purposes.- Overrides:
toStringin classStoredObject- Returns:
- String representation of the instance.
-
isLink
public boolean isLink()- Specified by:
isLinkin interfaceContentType
-
getContentType
- Specified by:
getContentTypein interfaceContentType- Specified by:
getContentTypein interfaceHasStreamData
-
getFileExtension
-
isImage
public boolean isImage()- Specified by:
isImagein interfaceContentType
-
isVideo
public boolean isVideo()- Specified by:
isVideoin interfaceContentType
-
isAudio
public boolean isAudio()- Specified by:
isAudioin interfaceContentType
-
isPDF
public boolean isPDF()- Specified by:
isPDFin interfaceContentType
-
saveInFolder
- Throws:
Exception
-
get
-
create
public static FileData create(String path, StreamData streamData, Transaction transaction) throws Exception - Throws:
Exception
-
circulate
- Throws:
Exception
-
getFolder
-
getRootFolder
-
getCirculation
-
getCirculation
-
getReadStamp
-
getExpiryDate
-
getReadBefore
-
getReadBeforeTime
-
getDetails
-
view
-
linkTo
- Throws:
Exception
-
linkTo
- Throws:
Exception
-