public class CSPAttachmentsProvider extends CSPBaseProvider implements IRefreshable, IAttachmentsProvider
COMMProxy.Session
instance and a content idModifier and Type | Field and Description |
---|---|
static String |
CSP_TMP_DIR |
fRetrievalModule, fSession
fExpireWithPageFlow
DATA_BINDING_CLIENTS, EMPTY_RESOURCES, OUTCOME_ERROR, OUTCOME_OK, resourcesProviders
Constructor and Description |
---|
CSPAttachmentsProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addAttachment(org.apache.commons.fileupload.FileItem fileItem,
String fileEncoding)
Add Attachment
|
protected void |
checkState()
Check if a RetrievalModule has been properly inited.If not it most probably means a session is not set.
|
String |
createHttpUrl(String smiPath) |
String |
getContentId()
Returns the content id whose children will be listed
|
String |
getDateAsString(Date date) |
String |
getDownloadProtocol()
Returns the download protocol that will be used when download link is created.
|
boolean |
getHasAttachments()
Returns whether the attachment provider has any attachments
|
int |
getHttpPort()
Returns the download port that will be used when download link is created.
|
boolean |
getNeedRefresh()
Returns
true when IRefreshable.isAutoRefresh() is on and the result properties need to be refreshed from
the data source by executing IRefreshable.refresh() method. |
Date |
getStringAsDate(String str) |
boolean |
isAddAttachmentsAvailable()
Returns whether attachments can be added
|
boolean |
isAutoRefresh()
Returns
true if the provider is currenlty in auto-refresh mode |
boolean |
isPermanentDelete() |
List<IAttachmentItem> |
listAttachments()
Returns a list of the current attachments
|
void |
refresh()
(Re)loads data from the data source.
|
void |
removeAttachment(String attachmentID)
Remove Attachment
|
void |
setAutoRefresh(boolean autorefresh)
Sets auto refresh mode on.
|
void |
setContentId(String contentId)
Sets the content id whose children will be listed.
|
void |
setDownloadProtocol(String downloadProtocol)
Sets the download protocol that will be used when download link is created
|
void |
setHttpPort(int httpPort)
Sets the download port that will be used when download link is created
|
void |
setNeedRefresh(boolean needRefresh)
Tells the provider that the input parameters have changed and the output results need to be refreshed the next time any
output property is requested via
IContentProvider.getValue(Object) . |
void |
setPermanentDelete(boolean permanentDelete) |
boolean |
supportsAutoRefresh()
Returns true if this content provider supports auto refresh feature.
|
void |
updateAttachment(String attachmentID,
org.apache.commons.fileupload.FileItem fileItem,
String fileEncoding)
Update an Attachment
|
static void |
uploadFileSMI(biz.i2z.client.proxy.COMMProxy.Session session,
org.apache.commons.fileupload.FileItem sourceFile) |
getSession, release, setSession
getExpireWithPageFlow, setExpireWithPageFlow, valueBound, valueUnbound
createMethodBinding, createMethodExpression, createValueBinding, createValueExpression, createValueExpression, error, error, error, error, error, getBean, getFacesContext, getLocale, getResourceInputStream, getResources, getResourcesProvider, getRootCause, getStackTrace, getTreeAttribute, isUserInRole, log, log, log, putTreeAttribute, resetDataBindingClients, resolveDataBinding, resolveDataBinding, resolveExpression, setValue
public static final String CSP_TMP_DIR
public boolean getNeedRefresh()
IRefreshable
Returns true
when IRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from
the data source by executing IRefreshable.refresh()
method.
Implementations may return an accurate value from this method if they can track the changes to the input parameter
properties or they may require the clients to call IRefreshable.setNeedRefresh(boolean)
explicitely.
getNeedRefresh
in interface IRefreshable
true
when the output properties are not up-to-date with the current input parameters, i.e. IRefreshable.refresh()
needs to be executed manually or automatically.public boolean isAutoRefresh()
IRefreshable
true
if the provider is currenlty in auto-refresh modeisAutoRefresh
in interface IRefreshable
public String getDownloadProtocol()
public void setDownloadProtocol(String downloadProtocol)
downloadProtocol
- to be used when download link is createdpublic int getHttpPort()
public void setHttpPort(int httpPort)
httpPort
- to be used when download link is createdpublic void refresh() throws ContentProviderException
IRefreshable
refresh
in interface IRefreshable
ContentProviderException
- if error loading data from the data sourcepublic void setAutoRefresh(boolean autorefresh) throws ContentProviderException
IRefreshable
Sets auto refresh mode on. When auto refresh mode is on, the provider calls IRefreshable.getNeedRefresh()
to determine whether the refresh needs to be done before returning any result properties. If it returns
true
, the provider calls IRefreshable.refresh()
method to updated the result properties.
setAutoRefresh
in interface IRefreshable
autorefresh
- true to turn it onContentProviderException
- if auto refresh mode is not supportedIRefreshable.supportsAutoRefresh()
,
IRefreshable.getNeedRefresh()
,
IRefreshable.setNeedRefresh(boolean)
public void setNeedRefresh(boolean needRefresh)
IRefreshable
IContentProvider.getValue(Object)
.setNeedRefresh
in interface IRefreshable
needRefresh
- true
if the input parameters have changedpublic boolean supportsAutoRefresh()
IRefreshable
supportsAutoRefresh
in interface IRefreshable
IRefreshable.setAutoRefresh(boolean)
public void setContentId(String contentId)
contentId
- Content id whose children will be listed. Mandatory.public String getContentId()
public static void uploadFileSMI(biz.i2z.client.proxy.COMMProxy.Session session, org.apache.commons.fileupload.FileItem sourceFile) throws Exception
Exception
protected void checkState()
CSPBaseProvider
checkState
in class CSPBaseProvider
public void setPermanentDelete(boolean permanentDelete)
public boolean isPermanentDelete()
public void addAttachment(org.apache.commons.fileupload.FileItem fileItem, String fileEncoding)
IAttachmentsProvider
addAttachment
in interface IAttachmentsProvider
fileItem
- the attachment contentfileEncoding
- the encoding of the attachment file (if known)public boolean getHasAttachments()
IAttachmentsProvider
getHasAttachments
in interface IAttachmentsProvider
public boolean isAddAttachmentsAvailable()
IAttachmentsProvider
isAddAttachmentsAvailable
in interface IAttachmentsProvider
public List<IAttachmentItem> listAttachments()
IAttachmentsProvider
listAttachments
in interface IAttachmentsProvider
public void removeAttachment(String attachmentID)
IAttachmentsProvider
removeAttachment
in interface IAttachmentsProvider
attachmentID
- the id of the attachment to removepublic void updateAttachment(String attachmentID, org.apache.commons.fileupload.FileItem fileItem, String fileEncoding)
IAttachmentsProvider
updateAttachment
in interface IAttachmentsProvider
attachmentID
- the id of the attachment to updatefileItem
- the new attachment contentfileEncoding
- the encoding of the attachment file (if known)