Class AppointmentImportService

java.lang.Object
fr.paris.lutece.plugins.appointment.modules.importer.service.AppointmentImportService

@ApplicationScoped public class AppointmentImportService extends Object
Validates an upload then persists its immutable source data for daemon processing.
  • Constructor Details

    • AppointmentImportService

      public AppointmentImportService()
  • Method Details

    • computeFileHash

      public static String computeFileHash(byte[] bytes)
      Computes the SHA-256 hex digest of the given bytes. Used to detect duplicate uploads before registering a new file.
      Parameters:
      bytes - the content
      Returns:
      the digest
    • register

      public AppointmentImportFile register(int nFormId, String strFileName, byte[] sourceFile, String strFileHash, String strAdminAccessCode, Locale locale)
      Reads and validates the workbook, then persists the file record and all appointment rows. If validation fails the file is stored with status VALIDATION_FAILED and no rows are created.
      Parameters:
      nFormId - the form
      strFileName - the name of the uploaded file
      sourceFile - the content of the file
      strFileHash - pre-computed SHA-256 hex digest of sourceFile
      strAdminAccessCode - the access code of the administrator who uploads the file
      locale - the locale of the messages
      Returns:
      the persisted AppointmentImportFile (check AppointmentImportFile.getStatus() to detect failures)