Class AppointmentImportService
java.lang.Object
fr.paris.lutece.plugins.appointment.modules.importer.service.AppointmentImportService
Validates an upload then persists its immutable source data for daemon processing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomputeFileHash(byte[] bytes) Computes the SHA-256 hex digest of the given bytes.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.
-
Constructor Details
-
AppointmentImportService
public AppointmentImportService()
-
-
Method Details
-
computeFileHash
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 statusVALIDATION_FAILEDand no rows are created.- Parameters:
nFormId- the formstrFileName- the name of the uploaded filesourceFile- the content of the filestrFileHash- pre-computed SHA-256 hex digest ofsourceFilestrAdminAccessCode- the access code of the administrator who uploads the filelocale- the locale of the messages- Returns:
- the persisted
AppointmentImportFile(checkAppointmentImportFile.getStatus()to detect failures)
-