This section describes the Xcenter Attachment Export feature.
This Xcenter feature extracts files from the trn_trans_attachments table and places them in a configured location on the filesystem.
The retailer can access the exported files in the file system via REST webservice call.
Several functions are exporting data in the trn_trans_attachments table. As base we are providing a basic configuration for Germany TSE data as reference. The retailer can configure the export filename, export directory and separate configuration to trigger each attachment type export. These configuration will be maintained in xcenter-spring-bean.xml.
The property xst.fileresource.path.attachment
in the xcenter.properties file defines the directory location, which will be the root directory for all attachment export.
All configurations for attachment exports are carried out by using Spring beans.
An attachment type is configured by the class AttachmentExportConfig
for each attachment type and passed as a property to the class AttachmentExportDataTask
along with export URI and the organization id which are configured in xcenter.proprties file.
AttachmentExportDataTask
bean id is the value for the key "integrationConfigId"
to schedule the spring job.
Table F-1 AttachmentExportConfig Settings
Type | Position | Type | Meaning |
---|---|---|---|
Property |
attachmentType |
String |
The attachmentType value should map the ATTACHMENT_TYPE column value of the TRN_TRANS_ATTACHMENT table. |
Property |
fileName |
String |
The file name for the extracted attachment. The name can be generated using the transaction attributes, tokens which are enclosed within parenthesis i.e ${PosTransactionModelProperty} are replaced with values from PosTransactionModel object and other tokens are treated as a static value. For organization ID 1000 and store ID 703 and transaction sequence 1539 the following file name configuration will generate file name 1000-703-1-TSE_STORAGE_BYTES-1539.tar.gz |
Property |
extractDirectory |
String |
The attachment extract directory is relative to the path {xst.fileresource.path.attachment} configured in xcenter.properties file. |
Table F-2 AttachmentExportData Task Settings
Type | Position | Type | Meaning |
---|---|---|---|
Property |
organizationId |
String |
Organization id property {xcenter.org.id} configured in xcenter.properties file. |
Property |
attachmentConfig |
bean |
The value of this property should be the same as the bean name for the relevant AttachmentExportConfig |
Property |
exportUri |
String |
The export URI property {xst.fileresource.path.attachment} configured in xcenter.properties file. |
Table F-3 Trigger Settings
Type | Position | Type | Meaning |
---|---|---|---|
Property |
jobDetail |
String |
The value of this property should be the same as the bean name for the relevant AttachmentExportDataTask. |
Property |
cronExpression |
String |
Cron expression. By default Configured to run once every 24 hours at 06:00. |
Property |
timeZone |
String |
Time zone property. Timezones are set to UTC/GMT and cronExpressions are expected to represent that time. |
To enable the attachment export, add the configured JobDetailFactoryBean
to jobsList
and CronTriggerFactoryBean
to triggersList
as reference property list for relevant attachment type.
Export URI:
https://{hostname}:{port}/xcenter/rest/attachment
Example:
The following are configurations which need to be done for each attachment type to export it to filesystem in xcenter-spring-beans.xml. The configuration below is for Germany TSE export.
<bean id="tseAttachmentExportConfig" class="com.micros_retail.xcenter.fiscalization.attachment.AttachmentExportConfig"> <!-- The attachmentType value should maps to the ATTACHMENT_TYPE column value of the TRN_TRANS_ATTACHMENT table. --> <property name="attachmentType" value="TSE_STORAGE_BYTES" /> <!-- The file name for the extracted attachment. The name can be generated using the transaction attributes, tokens which are enclosed within parenthesis i.e ${PosTransactionModelProperty} are replaced with values from PosTransactionModel object and other tokens are treated as a static value. For organization ID 1000 and store ID 703 and transaction sequence 1539 the following file name configuration will generate file name 1000-703-1-TSE_STORAGE_BYTES-1539.tar.gz --> <property name="fileName" value="${organizationId}-${retailLocationId}-${workstationId}-${attachmentType}-${transactionSequence}-${TSE_FISCAL_NUMBER}.tar.gz" /> <!-- The attachment extract directory is relative to the path {xst.fileresource.path.attachment} configured in xcenter.properties --> <property name="extractDirectory" value="${organizationId}/${retailLocationId}/${workstationId}/${attachmentType}" /> </bean> <bean id="tseAttchmentExportDataTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="tseAttachmentExportDataJob" /> <!-- Configured to run once every 24 hours at 06:00. --> <property name="cronExpression" value="0 0 6 * * ?" /> <!-- Timezones are set to UTC/GMT and cronExpressions are expected to represent that time. --> <property name="timeZone" value="UTC" /> </bean> <bean id="tseAttachmentExportDataTask" class="com.micros_retail.xcenter.fiscalization.attachment.AttachmentExportDataTask"> <property name="organizationId" value="#{T(com.micros_retail.xcenter.bootstrap.XcenterProperties).getString('xcenter.org.id')}" /> <!-- The value of this property should be the same as the bean name for the relevant tseAttachmentExportConfig --> <property name="attachmentConfig" ref="tseAttachmentExportConfig" /> <property name="exportUri" value="#{T(com.micros_retail.xcenter.bootstrap.XcenterProperties).getString('xst.fileresource.path.attachment')}" /> </bean> <bean id="tseAttachmentExportDataJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="com.micros_retail.xcenter.integration.IntegrationJob" /> <property name="jobDataAsMap"> <map> <entry key="category" value="INTEGRATION" /> <!-- The value of this property should be the same as the bean name for the relevant tseAttachmentExportDataTask --> <entry key="integrationConfigId" value="tseAttachmentExportDataTask" /> </map> </property> <property name="durability" value="true" /> <property name="description" value="Export Transaction Attachment Data" /> </bean>