|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.dataobjects.BaseDataObject
com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
com.jcorporate.expresso.core.dbobj.DBObject
com.jcorporate.expresso.core.dbobj.SecuredDBObject
com.jcorporate.expresso.services.dbobj.MimeTypes
This table provides for mapping between files and mime types. Here we try to put every mime type that we are aware of and provide the following services:
javax.activation.MimetypesFileTypeMap object so that it recognizes
all data stored in the MimeTypes table
| Nested Class Summary |
| Nested classes inherited from class com.jcorporate.expresso.core.dbobj.DBObject |
DBObject.FieldError, DBObject.FieldUpdate |
| Field Summary | |
static String |
FLD_DESCRIPTION
|
static String |
FLD_FILE_EXTENSIONS
|
static String |
FLD_MIMEICON
|
static String |
FLD_MIMENUMBER
Field Names for the MIMETYPES table |
static String |
FLD_MIMETYPE
|
| Fields inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject |
ADD, ALL_FUNCTIONS, CACHE_NAME, CACHE_TTY, DELETE, SEARCH, SYSTEM_ACCOUNT, SYSTEM_ACCOUNT_NAME, UPDATE |
| Fields inherited from class com.jcorporate.expresso.core.dbobj.DBObject |
ATTRIBUTE_ERROR, ATTRIBUTE_ERROR_MESSAGE, ATTRIBUTE_PAGE_LIMIT, BIG_DECIMAL_ZERO, EMAIL_MASK, EVENT_ADD, EVENT_DELETE, EVENT_UPDATE, FLOAT_MASK, INT_MASK, IS_CHECK_RELATIONAL_INTEGRITY, UPDATE_CHANGED_ONLY, WHERE_KEYWORD |
| Fields inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject |
anyFieldsDistinct, anyFieldsToRetrieve, appendCustomWhere, caseSensitiveQuery, customWhereClause, dbKey, distinctFields, localConnection, LONGBINARY_READ_DEFAULT_SIZE, maxRecords, myClassName, myUpdates, offsetRecord, recordSet, retrieveFields, sMetadataMap, sortKeys |
| Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
currentStatus, globalMask |
| Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject |
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED |
| Constructor Summary | |
MimeTypes()
|
|
MimeTypes(ControllerRequest request)
For using DBObjects within Controllers. |
|
MimeTypes(int uid)
|
|
| Method Summary | |
void |
add()
As per usual add, but it resets the fileMap so future calls to it will show the appropriate changes |
void |
clearFileMap()
|
void |
delete()
As per usual delete, but it resets the fileMap so future calls to it will show the appropriate changes |
int |
getExpectedDefaultPopulation()
Useful method for unit testing to make sure that everything got added during setup as expected. |
static javax.activation.MimetypesFileTypeMap |
getFileMap(String dataContext)
Use this function to get a javax.activation.MimetypesFileTypeMap object
that is intantiated with the data stored in the MimeTypes table rather
than the system default. |
String |
getIconURL()
Returns the icon URL associated with this MimeType object |
static MimeTypes |
getMimeType(String fileName,
String dataContext)
Give it a file name and a data context and we'll get the MimeType object associated with it. |
static MimeTypes |
getMimeTypeFromMimeId(int mimeNumber,
String dataContext)
Given a Expresso standard MimeTypes "MimeNumber" field and a data context and we'll get the MimeType object associated with it. |
Vector |
getValidValues(String fieldName)
Returns the valid values for any particular field |
Vector |
getValues()
Method to return a Vector of ValidValue Template method--not implemented in this superclass. |
void |
populateDefaultValues()
populateDefaultValues is called by the schema object to allow a table to populate itself with any desired values. |
protected void |
setupFields()
Table definition of the MimeTypes tables |
void |
update()
As per usual update, but it resets the fileMap so future calls to it will show the appropriate changes |
| Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject |
canRequesterAdd, canRequesterDelete, canRequesterRead, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, deleteAll, find, getRequestingUid, getString, getString, getString, getString, getString, getString, getSystemUid, instantiate, isAllowed, retrieve, search, searchAndRetrieveList, searchAndRetrieveList, setRequestingUid |
| Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
getGlobalMask, getStatus, isGlobalMasked, setFieldsWithDefaults, setGlobalMask, setStatus |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String FLD_MIMENUMBER
public static final String FLD_MIMETYPE
public static final String FLD_DESCRIPTION
public static final String FLD_MIMEICON
public static final String FLD_FILE_EXTENSIONS
| Constructor Detail |
public MimeTypes()
throws DBException
SecuredDBObject
public MimeTypes(int uid)
throws DBException
uid - The owning user id
public MimeTypes(ControllerRequest request)
throws DBException
request - - The controller request handed to you by the framework.| Method Detail |
public Vector getValues()
throws DBException
DBObject
getValues in interface LookupInterfacegetValues in class DBObjectDBException - If the values cannot be retrievedDBObject.getValidValues(java.lang.String)public int getExpectedDefaultPopulation()
public Vector getValidValues(String fieldName)
throws DBException
getValidValues in class DBObjectfieldName - the name of the field to retrieve
DBException - upon error
public static MimeTypes getMimeType(String fileName,
String dataContext)
throws DBException
DESIGN REQUEST
This method raises an exception if the MimeType is not
found. It should instead return a null, because
you cannot distinguished between a data base failure and db
failure.
fileName - A name to retrieve the mime type. Note that this will be compared
via lower case since thanks to Windows, you can have doc, DoC, DOC, dOC etc...
which EXTREMELY complicates the matching process.dataContext - the data context to get the underlying data from. May
be null for default context
DBException - if we can't find the appropriate object
DBException - if a data access error occurs or if MIME Type does not in�the databasegetMimeTypeFromMimeId(int, java.lang.String)
public static MimeTypes getMimeTypeFromMimeId(int mimeNumber,
String dataContext)
throws DBException
mimeNumber - the mime number id from the MimeTypes data objectdataContext - the data context to get the underlying data from. May
be null for default context
null if no matching mime type object exists in the
database.
DBException - if we can't find the appropriate object
DBException - if a data access error occurs.getMimeTypeFromMimeId(int, java.lang.String)public static javax.activation.MimetypesFileTypeMap getFileMap(String dataContext)
Use this function to get a javax.activation.MimetypesFileTypeMap object
that is intantiated with the data stored in the MimeTypes table rather
than the system default. Allows for centralized management of the system
mime types rather than dealing with scattered configuration files. If there
is an error reading the data, we simply instantiate a default MimetypesFileTypeMap
object and return that instead.
dataContext - the dbcontext to use or null if you want
to just use the default context.
MimetypesFileTypeMap
public void populateDefaultValues()
throws DBException
DBObjectThe base class implementation does nothing. Override this method in derived classes to achieve your custom behavior.
The calling routine, DBTool.populateTables(), will set dbName on each object, so you can get it from getDataContext(), and you can assume that the user for the population action is Admin.
populateDefaultValues in class DBObjectDBException - if an error occurs while populating the table.
This function populates the mimeType table with a wide variety of
basic MIME types.public String getIconURL()
protected void setupFields()
throws DBException
setupFields in class DBObjectDBException - If there is an error setting up the fields
as requested. For example, if a field allowing null is requested
as part of the key
public void add()
throws DBException
add in interface DataObjectadd in class SecuredDBObjectDBException - If the user is not permitted to add
or if the add fails
public void update()
throws DBException
update in interface DataObjectupdate in class SecuredDBObjectDBException - if update is not allowed for the current user
public void delete()
throws DBException
delete in interface DataObjectdelete in class SecuredDBObjectDBException - if delete is not allowed for the current userpublic void clearFileMap()
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||