public class VirtualObject extends SQLTenantAware implements StoredObject
Storage
.
Note that the externally visible methods are decalred by StoredObject
which is the public interface.
Modifier and Type | Field and Description |
---|---|
static sirius.db.mixing.Mapping |
BUCKET
Contains the bucket in which the object resides.
|
static sirius.db.mixing.Mapping |
FILE_EXTENSION
Contains the file extension used to determine the mime type.
|
static sirius.db.mixing.Mapping |
FILE_SIZE
Contains the size in bytes of this object.
|
static sirius.db.mixing.Mapping |
MD5
Contains the MD5 checksum of the stored data.
|
static sirius.db.mixing.Mapping |
OBJECT_KEY
Contains the unique object key of this object.
|
static sirius.db.mixing.Mapping |
PATH
Contains the virtual path of the object.
|
static sirius.db.mixing.Mapping |
PHYSICAL_KEY
Contains the physical key, which points to the actual contents of this object.
|
static sirius.db.mixing.Mapping |
REFERENCE
Contains a reference to another entity, if this object was specifically created for a reference.
|
static sirius.db.mixing.Mapping |
TEMPORARY
Marks this object as temporary.
|
TENANT
Constructor and Description |
---|
VirtualObject() |
Modifier and Type | Method and Description |
---|---|
protected void |
ensureUniquenessOfPath() |
protected void |
fillObjectKey() |
protected void |
fixPath() |
String |
getBucket() |
String |
getFileExtension() |
String |
getFilename()
Returns the filename of the object.
|
long |
getFileSize()
Returns the size of the object in bytes.
|
LocalDateTime |
getLastModified()
Returns the timestamp when the entity was last modified.
|
String |
getMd5() |
String |
getObjectKey()
Represents the unique id of the stored object.
|
String |
getPath()
Returns the path of the object.
|
String |
getPhysicalKey() |
String |
getReference()
Returns the reference to which this object belongs.
|
boolean |
isImage() |
boolean |
isTemporary() |
DownloadBuilder |
prepareURL()
Creates a builder to build a download URL for this object.
|
protected void |
removeObjectFromCaches() |
protected void |
removePhysicalObject() |
void |
setBucket(String bucket) |
void |
setFileExtension(String fileExtension) |
void |
setFileSize(long fileSize) |
void |
setMd5(String md5) |
void |
setObjectKey(String objectKey) |
void |
setPath(String path) |
void |
setPhysicalKey(String physicalKey) |
void |
setReference(String reference) |
void |
setTemporary(boolean temporary) |
String |
toString() |
getTenant, getTenantAsString, setCurrentTenant
getTrace, isAnyColumnChangedExceptNoJournal
equals, getFetchRow, getId, getMapper, hashCode, isNew, isUnique, setId
assertUnique, getDescriptor, getIdAsString, getTypeName, getUniqueName, getVersion, isAnyMappingChanged, isChanged, setVersion
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
assertSameTenant
public static final sirius.db.mixing.Mapping BUCKET
public static final sirius.db.mixing.Mapping OBJECT_KEY
public static final sirius.db.mixing.Mapping PHYSICAL_KEY
public static final sirius.db.mixing.Mapping FILE_SIZE
public static final sirius.db.mixing.Mapping MD5
public static final sirius.db.mixing.Mapping PATH
The length is shorten than a UNIX path (255 chars) to permit proper indexing in the database (the max key length in MySQL is typically 767 bytes).
public static final sirius.db.mixing.Mapping FILE_EXTENSION
public static final sirius.db.mixing.Mapping REFERENCE
When an object is uploaded / created for a reference, the field name and object name is placed here. This makes the object invisible in the UI and also automatically deletes it if the referencing object is deleted.
public static final sirius.db.mixing.Mapping TEMPORARY
If a new file is uploaded for a reference it is marked as temporary. If the referencing entity is saved and
confirms the object key, this flag is removed. Otherwise, if the file is uploaded but the entity is
never saved, the file will be eventually deleted by StorageCleanupLoop
.
protected void ensureUniquenessOfPath()
protected void fillObjectKey()
protected void fixPath()
public LocalDateTime getLastModified()
StoredObject
getLastModified
in interface StoredObject
protected void removePhysicalObject()
protected void removeObjectFromCaches()
public DownloadBuilder prepareURL()
StoredObject
prepareURL
in interface StoredObject
public String getFilename()
StoredObject
getFilename
in interface StoredObject
public boolean isImage()
public String getBucket()
public void setBucket(String bucket)
public String getObjectKey()
StoredObject
getObjectKey
in interface StoredObject
public void setObjectKey(String objectKey)
public String getPhysicalKey()
public void setPhysicalKey(String physicalKey)
public long getFileSize()
StoredObject
getFileSize
in interface StoredObject
public void setFileSize(long fileSize)
public String getPath()
StoredObject
getPath
in interface StoredObject
public void setPath(String path)
public String getFileExtension()
public void setFileExtension(String fileExtension)
public String getReference()
StoredObject
getReference
in interface StoredObject
sirius.db.mixing.Entity#getUniqueName()
or null if there is no referencepublic void setReference(String reference)
public String getMd5()
public void setMd5(String md5)
public boolean isTemporary()
public void setTemporary(boolean temporary)
Copyright © 2018. All rights reserved.