package com.alexanderlogistics.zoho; import java.util.List; import java.util.logging.Logger; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.imixs.archive.core.SnapshotService; import org.imixs.workflow.FileData; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.SignalAdapter; import org.imixs.workflow.engine.WorkflowService; import org.imixs.workflow.exceptions.AdapterException; import org.imixs.workflow.exceptions.PluginException; import com.alexanderlogistics.InvoicePlugin; import jakarta.inject.Inject; /** * This adapter exports the invoice data to zoho * * @version 1.0 * @author rsoika */ public class ZohoExportAdapter implements SignalAdapter { public static final String CONFIG_ERROR = "CONFIG_ERROR"; public static final String ENV_ZOHO_EXPORT_MAX_ATTACHMENT_SIZE = "zoho.export.maxattachmentsize"; private static Logger logger = Logger.getLogger(ZohoExportAdapter.class.getName()); @Inject ZohoAPIService zohoAPIService; @Inject WorkflowService workflowService; @Inject SnapshotService snapshotService; @Inject @ConfigProperty(name = ENV_ZOHO_EXPORT_MAX_ATTACHMENT_SIZE, defaultValue = "10485760") long maxAttachmentSize; /** * This method calls the zoho api * * @throws PluginException */ @Override public ItemCollection execute(ItemCollection document, ItemCollection event) throws AdapterException, PluginException { logger.info("......starting export..."); // read the cargosoft export options ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "zoho", document, false); zohoAPIService.exportInvoice(document); return document; } /** * This method lookups the origin snapshot data and add the content of the $file * to the export document *
* Change 14.10.2021 - Wir senden maximal 5MB and Daten, da die Cargosoft
* Schnittstelle größere Datensätze mit großen Dateianhängen einfach verschluckt
* ohne eine Fehlermeldugn zu liefern.
*
*
* @param document
* @return
*/
@SuppressWarnings("unchecked")
private ItemCollection loadFileDataFromSnapshot(ItemCollection document) {
ItemCollection origin = null;
ItemCollection result = (ItemCollection) document.clone();
// find the origin document
List