public class Exporter extends Object implements ImpExLogFilter.LocationProvider
ExportConfiguration config = new ExportConfiguration( impexscript, ImpExManager.getExportOnlyMode() ); <br> config.setDataExportTarget( datatarget ); <br> config.setMediasExportTarget( mediastarget ); <br> exporter = new Exporter( config ); <br> Export export = exporter.export(); <br>
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_ITEM_DUMP_RANGE |
static long |
LOG_INTERVAL
Duration between two logs.
|
| Constructor and Description |
|---|
Exporter(ExportConfiguration config) |
Exporter(ImpExMedia source,
EnumerationValue headerValidationMode) |
| Modifier and Type | Method and Description |
|---|---|
protected ImpExExportWriter |
createExportWriter() |
protected ImpExReader |
createImpExReader(CSVReader scriptReader,
DocumentIDRegistry docIDRegistry,
EnumerationValue headerValidationMode)
creates an (@see MyImpExReader) instance
|
Export |
export() |
void |
exportAllHeader() |
protected void |
exportInternal() |
void |
exportItems(Collection<Item> items)
Called via bean shell - exports items specified by given item list.
Example: |
void |
exportItems(String typecode)
Called via bean shell - exports all items of given type not including subtypes.
Example: |
void |
exportItems(String[] pklist)
Called via bean shell - exports items specified by given PK list.
Example: |
void |
exportItems(String typecode,
boolean inclSubTypes)
Called via bean shell - exports all items of given type.
Example: |
void |
exportItems(String typecode,
int count)
Called via bean shell - exports all items of given type not including subtypes with given range for flexible
search.
Example: |
void |
exportItems(String typecode,
int count,
boolean inclSubTypes)
Called via bean shell - exports all items of given type.
Example: |
void |
exportItems(String query,
Map values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
int start,
int count)
Deprecated.
|
void |
exportItemsFlexibleSearch(String query)
Called via bean shell - exports all items resulting from given flexible search.
Performs a call of |
void |
exportItemsFlexibleSearch(String query,
int count)
Called via bean shell - exports all items resulting from given flexible search.
Performs a call of |
void |
exportItemsFlexibleSearch(String query,
Map values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
int start,
int count)
Called via bean shell - exports all items resulting from given flexible search.
|
protected void |
exportUserRights() |
protected Collection<Item> |
getAllItems(String code,
int start,
int count,
boolean inclSubtypes)
A flexible search like
SELECT {Item.PK} FROM {code} ORDER BY will be executed, internally |
int |
getCurrentHeaderCount() |
String |
getCurrentLocation() |
ImpExExportWriter |
getExExportWriter()
Deprecated.
use
getImpExExportWriter() instead |
long |
getExportedItemsCount()
Gets the amount of exported items.
|
ImpExExportWriter |
getImpExExportWriter() |
HeaderDescriptor |
getNextHeader() |
Collection<String> |
getResultingFiles() |
boolean |
hasNextHeader() |
protected void |
logProcess()
Logs current state to the log4j system.
|
protected void |
runScriptBasedExport() |
void |
setLocale(Locale l)
Called via bean shell - sets the locale to use while import.
|
void |
setRelaxedMode(boolean isRelaxedMode)
Deprecated.
use
"#% impex.setValidationMode( ""import_relax"" );" or
"#% impex.setValidationMode( ImpExManager.getImportRelaxedMode() );" , instead |
void |
setTargetFile(String filename)
Called via bean shell - sets the name of the target file within zip for resulting data of next header.
|
void |
setTargetFile(String filename,
boolean writeHeader)
Called via bean shell - sets the name of the target file within zip for resulting data of next header.
|
void |
setTargetFile(String filename,
boolean writeHeader,
int linesToSkip,
int offset)
Called via bean shell - sets the name of the target file within zip for resulting data of next header.
|
void |
setValidationMode(String mode)
Called via bean shell - sets the validation mode to use.
|
public static final int DEFAULT_ITEM_DUMP_RANGE
public static final long LOG_INTERVAL
public Exporter(ExportConfiguration config) throws ImpExException
config - ImpExExceptionpublic Exporter(ImpExMedia source, EnumerationValue headerValidationMode) throws ImpExException
source - headerValidationMode - ImpExExceptionprotected void logProcess()
public long getExportedItemsCount()
public Export export() throws ImpExException
ImpExExceptionprotected void runScriptBasedExport()
throws FileNotFoundException,
JaloBusinessException
protected ImpExReader createImpExReader(CSVReader scriptReader, DocumentIDRegistry docIDRegistry, EnumerationValue headerValidationMode)
scriptReader - docIDRegistry - headerValidationMode - @Deprecated public ImpExExportWriter getExExportWriter()
getImpExExportWriter() insteadpublic ImpExExportWriter getImpExExportWriter()
protected ImpExExportWriter createExportWriter() throws ImpExException
ImpExExceptionpublic boolean hasNextHeader()
public HeaderDescriptor getNextHeader()
public int getCurrentHeaderCount()
protected void exportInternal()
throws ImpExException
ImpExExceptionpublic void exportAllHeader()
throws ImpExException
ImpExExceptionpublic Collection<String> getResultingFiles()
protected void exportUserRights()
throws ImpExException
ImpExExceptionprotected Collection<Item> getAllItems(String code, int start, int count, boolean inclSubtypes)
SELECT {Item.PK} FROM {code} ORDER BY will be executed, internallycode - typecodestart - the start number of the search range (@see
FlexibleSearch.search(String, List, List, boolean, boolean, boolean, int, int, String))count - the number of elements in this search range (@see
FlexibleSearch.search(String, List, List, boolean, boolean, boolean, int, int, String))inclSubtypes - including subtypes "SELECT {Item.PK} FROM {code} ORDER BY ..." or
"SELECT {Item.PK} FROM {code!} ORDER BY ..."public final void exportItems(String typecode) throws ImpExException
"#% impex.exportItems( ""CategoryProductRelation"" );"
typecode - type whose items will be exportedImpExExceptionpublic final void exportItems(String typecode, boolean inclSubTypes) throws ImpExException
"#% impex.exportItems( ""CategoryProductRelation"", false );"
typecode - type whose items will be exportedinclSubTypes - should subtypes of given type be considered too?ImpExExceptionpublic void exportItems(String typecode, int count) throws ImpExException
"#% impex.exportItems( ""CategoryProductRelation"", Exporter.DEFAULT_ITEM_DUMP_RANGE );"
typecode - type whose items will be exportedcount - range used for flexible searchImpExExceptionpublic void exportItems(String typecode, int count, boolean inclSubTypes) throws ImpExException
"#% impex.exportItems( ""CategoryProductRelation"", Exporter.DEFAULT_ITEM_DUMP_RANGE, false );"
typecode - type whose items will be exportedcount - range used for flexible searchinclSubTypes - should subtypes of given type be considered too?ImpExExceptionpublic void setTargetFile(String filename, boolean writeHeader) throws ImpExException
-1 regardless of what the column offset has been
set to. "#% impex.setTargetFile( ""CategoryProductRelation.csv"" , true );"
filename - name for target filewriteHeader - write header as comment to the target fileImpExExceptionpublic void setTargetFile(String filename, boolean writeHeader, int linesToSkip, int offset) throws ImpExException
"#% impex.setTargetFile( ""CategoryProductRelation.csv"" , true, 1, -1 );"
filename - name for target filewriteHeader - write header as comment to the target filelinesToSkip - sets the linesToSkip parameter at the related inludeExternalDataMedia call of
the generated import scriptoffset - sets the offset parameter at the related inludeExternalDataMedia call of the
generated import scriptImpExExceptionImpExReader.includeExternalDataMedia(String, String, int, int)public void setTargetFile(String filename) throws ImpExException
"#% impex.setTargetFile( ""CategoryProductRelation.csv"" );"
filename - name for target fileImpExException@Deprecated public void setRelaxedMode(boolean isRelaxedMode) throws ImpExException
"#% impex.setValidationMode( ""import_relax"" );" or
"#% impex.setValidationMode( ImpExManager.getImportRelaxedMode() );" , insteadImpExException@Deprecated public void exportItems(String query, Map values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, int start, int count) throws ImpExException
exportItemsFlexibleSearch(String, Map, List, boolean, boolean, int, int) insteadFlexibleSearch.search(String, Map, List, boolean, boolean, int, int)
#-----------------------------------------------------------
INSERT Product; PK; code[unique=true]; name[lang=de]
#-----------------------------------------------------------
"#% impex.exportItems( ""select {pk}from {Product}"", Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1 );"
ImpExExceptionpublic void exportItemsFlexibleSearch(String query, Map values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, int start, int count) throws ImpExException
FlexibleSearch.search(String, Map, List, boolean, boolean, int, int)
#-----------------------------------------------------------
INSERT Product; PK; code[unique=true]; name[lang=de]
#-----------------------------------------------------------
"#% impex.exportItemsFlexibleSearch( ""select {pk}from {Product}"", Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1 );"
ImpExExceptionpublic void exportItemsFlexibleSearch(String query) throws ImpExException
exportItemsFlexibleSearch(query, Collections.EMPTY_MAP, Collections.singletonList(Item.class), true, true, -1, -1);Example:
#-----------------------------------------------------------
INSERT Product; PK; code[unique=true]; name[lang=de]
#-----------------------------------------------------------
"#% impex.exportItemsFlexibleSearch( ""select {pk}from {Product}"" );"
query - used flexible search query used for gathering itemsImpExExceptionexportItemsFlexibleSearch(String, Map, List, boolean, boolean, int, int)public void exportItemsFlexibleSearch(String query, int count) throws ImpExException
exportItemsFlexibleSearch(query, Collections.EMPTY_MAP, Collections.singletonList(Item.class), true, true, -1, -1);Example:
#-----------------------------------------------------------
INSERT Product; PK; code[unique=true]; name[lang=de]
#-----------------------------------------------------------
"#% impex.exportItemsFlexibleSearch( ""select {pk}from {Product}"", 1000);"
query - used flexible search query used for gathering itemscount - range parameter used for flexible search callImpExExceptionexportItemsFlexibleSearch(String, Map, List, boolean, boolean, int, int)public void exportItems(String[] pklist) throws ImpExException
#-----------------------------------------------------------
INSERT Employee; PK; uid[unique=true];
#-----------------------------------------------------------
"#% impex.exportItems( new String[]{ ""1132326173852672"" } );"
pklist - list of PK's whose items will be exportedImpExExceptionpublic void exportItems(Collection<Item> items) throws ImpExException
#----------------------------------------------------------- INSERT Employee; PK; uid[unique=true]; #----------------------------------------------------------- "#% impex.exportItems( ProductManager.getInstance.getAllProducts() );"
items - collection of items which will be exportedImpExExceptionpublic void setValidationMode(String mode) throws ImpExException
"#% impex.setValidationMode( ""export_only"" );" "#% impex.setValidationMode(ImpExManager.getExportOnlyMode() );"
mode - new validation modeImpExExceptionpublic void setLocale(Locale l) throws ImpExException
"#% impex.setLocale( Locale.GERMANY );"
"#% impex.setLocale( new Locale(""de"",""de"" );"
l - new locale to useImpExExceptionpublic String getCurrentLocation()
getCurrentLocation in interface ImpExLogFilter.LocationProviderCopyright © 2017 SAP SE. All Rights Reserved.