PacketManager¶
PacketManager is the entry point for OP-DOM-19: given a policy's candidate output documents, it excludes documents that must not be packeted for related child policies, groups the remainder by policy/document-date/release-date (and, for leftovers, additionally by policy-period effective date), and runs every configured PacketDefinition against each group via PacketGenerator to produce the final packeted and unpacketed document list (DOM-BR-200, DOM-BR-201).
Purpose¶
- Excludes specific document types (
312R,412R,AUDIT,312IR) from packeting when they belong to a child policy in a non-"WRAP"relationship, before any grouping happens (DOM-BR-200). - Groups the remaining documents and attempts to build a packet for each group against every packet definition, first without regard to policy period, then a second pass (grouped additionally by policy-period effective date) for documents left unpacketed after the first pass (DOM-BR-201).
- Retrieves the single
PacketDefinitionmatching a given packet ID and uses it to select, from a candidate document list, exactly the documents that belong with a given primary document — the read-only counterpart to full packet creation.
Context¶
- Namespace:
SAIF.Domain.Tasks.Documents.Packets - Assembly/package:
SAIF.Domain(packaged inSAIF.SAIFCode.Core) - Marked with a source-code comment about moving this class to a service, indicating this static class is considered a candidate for relocation into a service layer*.
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| CreatePackets | public static IEnumerable<PolicyDocument> CreatePackets(IEnumerable<PolicyOutputDocument> docs, IPolicyOutputDocumentRepository policyOutputDocumentRepository, IUnitOfWork unitOfWork) |
Excludes ineligible child-policy documents, groups the remainder, runs every packet definition against each group in two passes (by date, then by policy period for leftovers), and returns both the resulting packets and any documents that were never packeted, mapped to PolicyDocument contracts (DOM-BR-200, DOM-BR-201). |
| GetDocumentsForPacket | public static IEnumerable<PolicyDocument> GetDocumentsForPacket(IEnumerable<PolicyOutputDocument> docs, string packetId, IUnitOfWork unitOfWork, PolicyOutputDocument primaryDocument) |
Loads the packet definition for packetId and returns the subset of docs that a PacketGenerator for that definition would include alongside primaryDocument, mapped to PolicyDocument contracts. |
| GetPacketDefinition | public static PacketDefinition GetPacketDefinition(string packetId, IUnitOfWork unitOfWork) |
Retrieves the single PacketDefinition identified by packetId. |
Behavioral notes¶
CreatePacketsruns a second grouping-and-generation pass, keyed additionally by policy-period effective date, only over documents left ungrouped after the first pass — so a document that already found a packet in the first pass is never reconsidered in the second*.- Documents that remain in
DocumentGroupsByPeriodafter the second pass (i.e., never matched any packet definition) are still returned byCreatePackets, individually mapped rather than dropped, so the method's result mixes actual packets with leftover unpacketed documents*.
Constraints and usage notes¶
CreatePacketsreturns an empty list immediately ifdocsis empty, without constructing aPacketRequestor loading any definitions.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Domain/SAIF.Domain/Tasks/Documents/Packets/PacketManager.csDomain/SAIF.Domain/Tasks/Documents/Packets/PacketRequest.csDomain/SAIF.Domain/Tasks/Documents/Packets/PacketGenerator.csDomain/SAIF.Domain/Tasks/Documents/Packets/PacketDefinition.cs