Export - File attachments
What information can be exported?
What settings can be configured?
What steps are part of the multi media export?
Define maximum zip file size
Globally
If many file attachments are to be exported, the created zip archive could be very large. That's why it's possible to configure the maximum file size globally:
plugin_customization.ini: define maximum zip file size globally
# Defines the maximum size of zip file
for
export. If there are too many media asset images to export, then several zip files may be
# exported, but each zip file can not be over
this
threshold.
# Default is
2147483648
. ( =
2
^
31
=
2
gigabyte)
com.heiler.ppm.mediaasset.server/export.maxZipFileSize =
2147483648
Export template specific
Sometimes, the global maximum zip file size definition is not sufficient. The integration of various web shops may require more configuration options.
Since PIM 7.0.05.14 and 7.1.01.00, you can use a new programmatical way to set the maximum zip file size for a single export template.
Implement a custom export function that can set the maximum zip file size to the mime export context:
Custom export function to set maximum zip file size
public
class
SetZipFileSizeFunction
extends
FunctionBaseImpl
{
public
SetZipFileSizeFunction()
{
super
(
"SetZipFileSize"
);
// TODO set function description
}
@Override
public
int
getMinParameterCount()
{
return
1
;
}
@Override
public
int
getMaxParameterCount()
{
return
1
;
}
@Override
public
Object execute( Object[] parameters, Map context )
throws
CoreException
{
if
( parameters !=
null
&& parameters.length ==
1
&& context !=
null
)
{
// TODO handle ConversionException
Long maxFileSizeToSet = ConvertUtils.getInstance()
.convert( parameters[
0
], Long.
class
);
// TODO check context: not null, mimeExportInfo not null
MimeExportInfo mimeExportInfo = ( MimeExportInfo ) context.get( MimeExportInfo.MIME_EXPORT_INFO );
mimeExportInfo.setOptionMaxZipFileSize( maxFileSizeToSet );
// no output
return
StringUtils.EMPTY;
}
String message = StringUtils.replace( Messages.getString(
"function.error.wrongparams"
),
"{functionname}"
,
//$NON-NLS-1$ //$NON-NLS-2$
this
.name );
IStatus status =
new
StatusExt( Categories.SYSTEM, IStatus.ERROR, ExportCorePlugin.PLUGIN_ID,
ExportErrorCodes.ERR_EXPORT_FCT_WRONG_PARAM_COUNT, message,
null
);
throw
new
CoreException( status );
}
}
Call the custom export function once in an export template:
Export template: call custom function once
{?SetZipFileSize
"52428800"
} {!
50
MB =
52428800
Bytes}