|
Project Wonder 5.0 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objecter.attachment.processors.ERAttachmentProcessor<T>
T - the type of ERAttachment that this processor processespublic abstract class ERAttachmentProcessor<T extends ERAttachment>
ERAttachmentProcessors provide the implementation of the communication with the attachment storage method, including import, URL generation, and stream generation.
ERAttachmentProcessors also provide support for path template variables. Read the er.attachment package.html for more information.
| Properties | |
er.attachment.maxSize | the maximum size of an uploaded attachment |
er.attachment.[configurationName].maxSize | the maximum size of an uploaded attachment |
er.attachment.[configurationName].storageType | er.attachment.[configurationName].storageType |
er.attachment.storageType | er.attachment.storageType |
er.attachment.[configurationName].proxyAsAttachment | er.attachment.[configurationName].proxyAsAttachment |
er.attachment.proxyAsAttachment | er.attachment.proxyAsAttachment |
| Nested Class Summary | |
|---|---|
static class |
ERAttachmentProcessor.ERXAttachmentExceedsLengthException
ERXAttachmentExceedsLengthException thrown when an attachment exceeds the maximum attachment size. |
| Field Summary | |
|---|---|
static Logger |
log
|
| Constructor Summary | |
|---|---|
ERAttachmentProcessor()
|
|
| Method Summary | ||
|---|---|---|
protected static String |
_parsePathTemplate(ERAttachment attachment,
String templatePath,
String recommendedFileName)
Parses a path template with ${ext}, ${fileName}, ${hash}, and ${pk} variables in it. |
|
abstract T |
_process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFileName,
String mimeType,
String configurationName,
String ownerID,
boolean pendingDelete)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
static void |
addAttachmentProcessorForType(ERAttachmentProcessor<?> processor,
String storageType)
Adds a new attachment processor for the given storage type. |
|
abstract InputStream |
attachmentInputStream(T attachment)
Returns an InputStream to the data of the given attachment. |
|
void |
attachmentInserted(T attachment)
Called after an attachment has been inserted (from didInsert). |
|
abstract String |
attachmentUrl(T attachment,
WORequest request,
WOContext context)
Returns a URL to the attachment's data. |
|
IERAttachmentProcessorDelegate |
delegate()
Returns the attachment processor delegate for this processor. |
|
abstract void |
deleteAttachment(T attachment)
Deletes the attachment from the data store. |
|
T |
process(EOEditingContext editingContext,
ERPendingAttachment pendingAttachment)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(EOEditingContext editingContext,
File uploadedFile)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath,
String mimeType)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath,
String mimeType,
int width,
int height,
String configurationName,
String ownerID)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath,
String mimeType,
String configurationName,
String ownerID)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
static
|
processorForConfigurationName(String configurationName)
Returns the processor that corresponds to the given configuration name ("s3", "db", "file", etc). |
|
static
|
processorForType(String storageType)
Returns the processor that corresponds to the given storage type ("s3", "db", "file", etc). |
|
static
|
processorForType(T attachment)
Returns the processor that corresponds to the given attachment. |
|
static NSMutableDictionary<String,ERAttachmentProcessor<?>> |
processors()
Returns all of the processors mapped by storageType. |
|
protected String |
proxiedUrl(T attachment,
WOContext context)
Returns a URL to the given attachment that routes via the ERAttachmentRequestHandler. |
|
boolean |
proxyAsAttachment(T attachment)
Returns whether or not the proxy request handler should return this as an attachment with a Content-Disposition. |
|
void |
setDelegate(IERAttachmentProcessorDelegate delegate)
Sets the attachment processor delegate for this processor. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Logger log
| Constructor Detail |
|---|
public ERAttachmentProcessor()
| Method Detail |
|---|
public static NSMutableDictionary<String,ERAttachmentProcessor<?>> processors()
public static <T extends ERAttachment> ERAttachmentProcessor<T> processorForType(T attachment)
T - the attachment typeattachment - the attachment to lookup a processor for
public static <T extends ERAttachment> ERAttachmentProcessor<T> processorForType(String storageType)
storageType - the type of processor to lookup
public static <T extends ERAttachment> ERAttachmentProcessor<T> processorForConfigurationName(String configurationName)
configurationName - the configuration name to use to lookup the default storage type
public static void addAttachmentProcessorForType(ERAttachmentProcessor<?> processor,
String storageType)
processor - the processorstorageType - the storage type that corresponds to the processor
protected static String _parsePathTemplate(ERAttachment attachment,
String templatePath,
String recommendedFileName)
attachment - the attachment being processedtemplatePath - the template path definitionrecommendedFileName - the original file name recommended by the uploading userpublic void setDelegate(IERAttachmentProcessorDelegate delegate)
delegate - the attachment processor delegate for this processorpublic IERAttachmentProcessorDelegate delegate()
protected String proxiedUrl(T attachment,
WOContext context)
attachment - the attachment to proxycontext - the context
public T process(EOEditingContext editingContext,
File uploadedFile)
throws IOException
editingContext - the EOEditingContext to create the ERAttachment inuploadedFile - the file to attach (which will NOT be deleted at the end)
IOException - if the processing fails
public T process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath)
throws IOException
editingContext - the EOEditingContext to create the ERAttachment inuploadedFile - the uploaded temporary file (which will be deleted at the end)recommendedFilePath - the filename recommended by the user during import
IOException - if the processing fails
public T process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath,
String mimeType)
throws IOException
editingContext - the EOEditingContext to create the ERAttachment inuploadedFile - the uploaded temporary file (which will be deleted at the end)recommendedFilePath - the filename recommended by the user during importmimeType - the mimeType to use (null = guess based on file extension)
IOException - if the processing fails
public T process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath,
String mimeType,
String configurationName,
String ownerID)
throws IOException
editingContext - the EOEditingContext to create the ERAttachment inuploadedFile - the uploaded temporary file (which will be deleted at the end)recommendedFilePath - the filename recommended by the user during importmimeType - the mimeType to use (null = guess based on file extension)configurationName - the name of the configuration settings to use for this processor (see top level docs)ownerID - an arbitrary string that represents the ID of the "owner" of this thumbnail (Person.primaryKey, for instance)
IOException - if the processing fails
public T process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFilePath,
String mimeType,
int width,
int height,
String configurationName,
String ownerID)
throws IOException
editingContext - the EOEditingContext to create the ERAttachment inuploadedFile - the uploaded temporary file (which will be deleted at the end)recommendedFilePath - the filename recommended by the user during importmimeType - the mimeType to use (null = guess based on file extension)configurationName - the name of the configuration settings to use for this processor (see top level docs)ownerID - an arbitrary string that represents the ID of the "owner" of this thumbnail (Person.primaryKey, for instance)width - the desired width of the attachmentheight - the desired height of the attachment
IOException - if the processing fails
public T process(EOEditingContext editingContext,
ERPendingAttachment pendingAttachment)
throws IOException
editingContext - the EOEditingContext to create the ERAttachment inpendingAttachment - the ERPendingAttachment that encapsulates the import information
IOException - if the processing failspublic void attachmentInserted(T attachment)
attachment - the inserted attachmentpublic boolean proxyAsAttachment(T attachment)
public abstract T _process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFileName,
String mimeType,
String configurationName,
String ownerID,
boolean pendingDelete)
throws IOException
editingContext - the EOEditingContext to create the ERAttachment inuploadedFile - the uploaded temporary file (which will be deleted at the end)recommendedFileName - the filename recommended by the user during importmimeType - the mimeType to use (null = guess based on file extension)configurationName - the name of the configuration settings to use for this processor (see top level docs)ownerID - an arbitrary string that represents the ID of the "owner" of this thumbnail (Person.primaryKey, for instance)pendingDelete - if true, the uploadedFile will be deleted after import; if false, it will be left alone
IOException - if the processing fails
public abstract InputStream attachmentInputStream(T attachment)
throws IOException
attachment - the attachment to retrieve the data for
IOException - if the stream cannot be created
public abstract String attachmentUrl(T attachment,
WORequest request,
WOContext context)
attachment - the attachment to generate a URL forrequest - the current requestcontext - the current context
public abstract void deleteAttachment(T attachment)
throws IOException
attachment - the attachment to delete
IOException - if the delete fails
|
Last updated: Wed, Mar 10, 2010 02:08 AM EST | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||