4.5 KiB
4.5 KiB
GestorePDF System Documentation
Overview
GestorePDF is a multi-threaded PDF generation system composed of two main components:
- GestorePDF (v4.0.0.0) - Main executable project
- GestorePDF.Logic (v2016.207.1342.27) - Core business logic library
Architecture
Component Structure
-
GestorePDF (Main Application)
- Entry point for the PDF management system
- Contains ThreadManager for process initialization
-
GestorePDF.Logic (Business Logic)
- Core processing engine
- Handles PDF generation workflow
- Manages thread queuing and execution
- Implements error handling and logging
Key Components
ThreadManager (GestorePDF)
- Main entry point class
- Initializes the PDF processing system
- Starts the processing logic
MasterThread (GestorePDF.Logic)
- Manages work queue using
ConcurrentQueue<DataThread>
- Processes data threads sequentially
- Creates GestoreThread instances for PDF generation
- Implements thread-safe processing
GestoreThread (GestorePDF.Logic)
- Core PDF generation worker
- Handles both "DIAGNOSI" and "MONITORAGGIO" report types
- Features:
- PDF generation via PDFGenerator
- Error logging and database status updates
- Configurable PDF storage options
- Document status management
- Exception handling and error reporting
Worker (GestorePDF.Logic)
- Task-based processing unit
- Manages processing context via PipelineContext
- Handles network (Rete) and fiscal code (CodiceFiscale) data
Process Flow
- ThreadManager initializes the system
- MasterThread manages the work queue
- GestoreThread performs PDF generation:
- Processes DIAGNOSI reports
- Processes MONITORAGGIO reports
- Updates document status
- Handles error conditions
Integration Points
- Database: SQL Server (DBProvider.SqlServerStampeC6)
- Logging: NLog system
- PDF Generation: PDFGenerator component
- Utilities: ContrattoSei.Utilities
Configuration
- PDF storage options controlled via "SavePDFtoDISK" setting
- Supports multiple storage modes:
- File system storage
- Database storage
- Configurable target folders
Error Handling
- Comprehensive exception handling
- Error logging to database
- Document status recovery
- Fault customer tracking
Performance Considerations
- Thread-safe queue implementation
- Sequential processing of data threads
- Configurable processing delays
- Status monitoring and recovery mechanisms
Template System
The system uses TemplateGenerator.xml
as a configuration file that defines the structure and content of generated PDF reports:
-
Section Definitions
- Contains detailed definitions of all possible sections (e.g., AreediBisogno, AssetClass, etc.)
- Each section defines:
- Title
- Body content
- Detailed descriptions and explanations
-
Report Templates
- Defines two main report types:
- "MONITORAGGIO"
- "DIAGNOSI"
- Defines two main report types:
-
Client Customization
- Differentiates templates by:
- Contract type: "OLD" vs "PRIVATE"
- Client type: "NONPROFFESIONAL" vs "PROFFESIONAL"
- Differentiates templates by:
-
Page Layout
- Specifies sections per page
- Defines section order
- Includes various components (AreediBisogno, AssetClass, etc.)
Data Sources
-
SQL Server Database (DBProvider.SqlServerStampeC6):
- Key Stored Procedures:
c6martPeriodico.UpdateStatoReport
- report status updates[C6MartPeriodico].[GESTIONE_INSERT_CUSTOMER_ERROR]
- error handlingtest.GESTIONE_PDF_PREPARE_TEST_SAMPLE
- data preparation[C6Mart].[UT_INSERT_ERROR]
- error loggingSP_GESTIONE_UPDATE_ELABORAZIONE_PDF
- processing updates
- Key Stored Procedures:
-
DataThread Structure: Contains core report generation data:
- CodiceFiscale
- Rete
- TipoContratto
- ReportsType
- TipoReport ("DIAGNOSI" or "MONITORAGGIO")
- NomeFileReport
-
Data Access Layer:
- Uses
DataAccessLayer
for database access DataAccessDE
for specific database operations
- Uses
-
Configuration:
- Uses
ConfigurationManager.AppSettings
for parameters:- "SavePDFtoDISK"
- "SavePDFtoDISK_Folder"
- "SP_GESTIONE_UPDATE_ELABORAZIONE_PDF"
- Uses
Data Flow
- System receives PDF generation request via
DataThread
- Retrieves necessary data from database using stored procedures
- Applies data to template defined in TemplateGenerator.xml
- Generates final PDF using PDFGenerator component
Future Enhancements
- Support for additional report types
- Enhanced error handling and logging
- Improved performance optimization
- Expanded integration points