Class AttachmentPersisterBuilder

  • All Implemented Interfaces:
    AutoCloseable

    public class AttachmentPersisterBuilder
    extends Object
    implements AutoCloseable
    Builder for persisting attachments of a Vorgang an returning that form record.
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • AttachmentPersisterBuilder

        public AttachmentPersisterBuilder​(IFormRequestContext requestCtx,
                                          FormPersistRequest requestData,
                                          Vorgang vorgang,
                                          IXForm xform)
                                   throws IOException
        Creates a new attachment persister for a given form submission.
        Parameters:
        requestCtx - The current request context that was used to submit the form.
        requestData - The request data with the uploads map that will be sent via the API.
        vorgang - The form record that was edited or newly created as a result of the submission.
        xform - The form that was submitted-
        Throws:
        IOException - When the temp dir for files could not be created.
    • Method Detail

      • createAttachmentPreProcessData

        public de.xima.fc.form.persist.AttachmentPreprocessData createAttachmentPreProcessData()
        Returns:
        The upload meta data map and the initial attachment data.
      • createPersistData

        public AttachmentPersistBuildData createPersistData()
                                                     throws ContextBuilderException
        Reads the submitted uploads and prepares them. Pass the returned value to build() to persist the uploads. While build() requires a persisted form record, this method can be used before the form record was persisted, i.e. the formRecord passed to the constructor may be null. This is useful, e.g., when you want to reject a form submission without persisting the data.
        Returns:
        The data with the attachments to be created / updated and the attachments that need to be deleted.
        Throws:
        ContextBuilderException - When the uploads could not be processed.