Export - Data types
What are export data types? Why do I need export data types? How can I add a new data type?
This article applies to the Heiler Product Manager in versions 7.0 and above.
Export data types
Note: You can find a list of existing standard export data types.
Where do I encounter export data types?
(Main) Data type of data providers
Sub-data types of data providers
Data types for data provider parameters resp. export post step parameters
Data types for variables
qualify data fields
configure data type filters
specify export parameter values
Which kind of export data types exist?
Data types representing a repository root entity
Data types representing a repository sub-entity
Data types representing several repository sub-entities
Data types representing a repository enumeration
Special data types
How can I use a data type programmatically?
... as data type of a data provider parameter
ValueDescriptor updateAssortmentParameter =
new
ValueDescriptor()
{
// ...
@Override
public
DataType getDataType()
{
return
DataTypeFactory.getInstance()
.getDataType( DataTypeBoolean.IDENTIFIER );
}
// ...
};
... as main data type of a data provider
public
class
StructureDataProvider
extends
ReportListModelQueryDataProviderBaseImpl
{
// ...
@Override
public
DataType getDataType()
{
return
DataTypeFactory.getInstance()
.getDataType( DataTypeStructure.IDENTIFIER );
}
// ...
}
... as sub-data type of a data provider
public
class
StructureDataProvider
extends
ReportListModelQueryDataProviderBaseImpl
{
// ...
@Override
public
List getSubDataTypes()
{
List subDataTypes =
new
ArrayList();
// ...
DataTypeUtils.addSubDatatype( subDataTypes, DataTypeStructureAttributes.IDENTIFIER );
// ...
return
subDataTypes;
}
// ...
}
Customizing possibilities
Repository
Provide a new data type representing a repository enumeration
If there's a (new) repository enumeration you want to provide as export variable data type you just have to add a new enum param with the "useForExportDatatype" key and the "true" value:
Now you can use the new data type:
Provide a new data type representing a repository sub-entity
If there's a (new) repository sub-entity you want to export as it is, you only have to set the export purpose of this sub-entity to "1".
Now there's a new sub-data type, the data of this entity are ready to be exported:
Special export sub data types
File attachments of items, products, structure groups
Many export data sources provide a sub data type for file attachments. All these sub data types provide the same list of data fields, and use the same algorithm to retrieve data to be exported.
Available fields
The file attachments data types provide all fields...
that are enabled for export (export purpose is not 0)
that are fields of MediaAsset, MediaAssetLang, MediaAssetDocument, MediaAssetDocumentAttributes repository entities. These fields don't have to be qualified.
Data type filter
You can use all logical keys of the MediaAsset sub entities as data type filters: language, quality, type.
These data types provide an additional filter "Mandatory fields", that can prevent output of inconsistent data rows.
Load and prepare data
The following algorithm is used to create the file attachments list model:
Determine the list of media assets to be exported
The data providers list of items, products, or structure groups is used to get the mapped media assets. The resulting report of media assets is used by the next steps.
Get a listmodel for each of the sub entities
The requested data fields are splitted by its entities, a listmodel is retrieved for each sub entity:
MediaAssetDocumentAttributes - if any fields are requested for this entity
MediaAssetDocument - always
MediaAssetLang - if any fields are requested for this entity
MediaAsset - always
Merge the list models
The listmodels are merged in this order and with this rules:
MediaAssetDocument and MediaAssetDocumentAttributes: merge by MediaAssetDocumentId with MediaAssetDocument as master, result: MediaAssetDocument
MediaAssetDocument and MediaAssetLang: full merge by MediaAssetId and LanguageId, result: MediaAssetDocument
MediaAsset and MediaAssetDocument: left outer merge by MediaAssetId with MediaAsset as master
Post-prepare the listmodel
Last step is to validate and sort the listmodel.
Support of "language independent" document language
Often media asset documents are not language dependent. That's why the file attachment sub data types support a substitute language for documents, see substitute language.
The merge algorithm of MediaAssetDocument and MediaAssetLang listmodels determines matching entries by MediaAssetId and LanguageId. If no suitable MediaAssetDocument entry is found for a MediaAssetLang entry, an entry with same MediaAssetId and LanguageId = "substitute language" is used instead. That means the media asset document entry of the substitute language is assigned to a media asset description if there's no document with description's language.
Examples
The following export template is used for all examples:
Example 1: Consistent data
There're descriptions and documents for german and english language.
Example 2: No documents
There're descriptions, but no documents.
Example 3: No descriptions
There're documents but no media asset descriptions.