public TemplateCommandService( IAdministrationUnitOfWork administrationUnitOfWork, IMetadataUnitOfWork metadataUnitOfWork, ILog log, IServiceAuthorizationPolicy authorizationPolicy, IServiceIdentityProvider identityProvider) : base(log, authorizationPolicy, identityProvider) { _administrationUnitOfWork = CheckDependency(administrationUnitOfWork, "administrationUnitOfWork"); _metadataUnitOfWork = CheckDependency(metadataUnitOfWork, "metadataUnitOfWork"); }
public WorkflowNotificationService( IReportsUnitOfWork reportsUoW, IAdministrationUnitOfWork adminUoW, IEmailAttachmentGenerator emailAttachmentGenerator, ILog log, IServiceAuthorizationPolicy authorizationPolicy, IServiceIdentityProvider identityProvider) // TODO: Inject ReportPDFGenerator : base(adminUoW, log, authorizationPolicy, identityProvider) { _reportsUoW = CheckDependency(reportsUoW, "reportsUoW"); _emailAttachmentGenerator = CheckDependency(emailAttachmentGenerator, "emailAttachmentGenerator"); }
/// <summary> /// Install the "TriTech Default" Templates into the Agency /// </summary> private static void UpdateTriTechDefaultTemplatesInAgency(Domain.Administration.Aggregates.Agency.Agency agency, IAdministrationUnitOfWork admin, IMetadataUnitOfWork meta) { Log.Info("Processing TriTech Default Templates for {0}", agency.Jurisdiction.Ori); // Create a Template Manager Service Instance var templateManager = new TemplateManagementService(admin, meta); // Create or Update the TriTech Default Template for all Modules. foreach (var dataEntryContract in meta.GetAllDataEntryContracts()) { // Get the "TriTech Default" Template Name var defaultTemplateName = DataEntryContractInspector.GetContractNameForModule(dataEntryContract.ModuleType); // Find or Create the Default Template var triTechDefaultTemplate = agency.GetTemplate(dataEntryContract.ModuleType, defaultTemplateName); if (triTechDefaultTemplate == null) { Log.Info("Installing {0}", defaultTemplateName); // Create the TriTech Default Template. triTechDefaultTemplate = agency.CreateTemplate(dataEntryContract.Id, dataEntryContract.ModuleType, defaultTemplateName); // Set the Template Workflow [Until the Concept of a "Default" workflow is defined this is the best we can do.] triTechDefaultTemplate.SetWorkflow(agency.Workflows.First()); // Assign all roles to the Template agency.Roles.ForEach(x => triTechDefaultTemplate.AssignRole(x)); } else { Log.Info("Updating {0} ", defaultTemplateName); } // Reset the Template Layout templateManager.ResetTemplateLayout(triTechDefaultTemplate); // Load the Template Layout from the Metadata templateManager.LoadFromMeta(triTechDefaultTemplate, dataEntryContract); } }
public TemplateLayoutService(IAdministrationUnitOfWork admin, IMetadataUnitOfWork meta) { _admin = admin; _meta = meta; _log = LogProvider.Get <TemplateLayoutService>(); }
public TemplateProvider(IAdministrationUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }
/// <summary> /// Create a New Template Management Service /// </summary> /// <param name="adminUnitOfWork">The Unit of work to track changes against.</param> /// <param name="metaUnitOfWork">Used to access metadata</param> public TemplateManagementService(IAdministrationUnitOfWork adminUnitOfWork, IMetadataUnitOfWork metaUnitOfWork) { _adminUnitOfWork = adminUnitOfWork; _metaUnitOfWork = metaUnitOfWork; }
public ApplicationServiceIdentityProvider(IAdministrationUnitOfWork administrationUnitOfWork) { _administrationUnitOfWork = administrationUnitOfWork; }
private static void InstallOrUpdateTemplatesInAgency(Domain.Administration.Aggregates.Agency.Agency agency, string implementation, IAdministrationUnitOfWork admin, IMetadataUnitOfWork meta) { Log.Info("Processing {0} templates for {1}", implementation, agency.Jurisdiction.Ori); // Template Manager Service Instance var templateManager = new TemplateManagementService(admin, meta); var templateLayoutService = new TemplateLayoutService(admin, meta); // Load All the Metadata var dataEntryContracts = meta.GetAllDataEntryContracts(); // Load All the Template Layouts var templateLayouts = LoadTemplateLayoutsFromFolder(TemplateFolder); // Setup the Default Templates for Each DataEntryContract defined in the Metadata foreach (var contract in dataEntryContracts) { // Find any layouts defined for the Implementation var impTemplateLayouts = templateLayouts.Where(t => t.ModuleType == contract.ModuleType && t.Implementation == implementation).ToList(); // If none are defined use the "Generic" templates if (impTemplateLayouts.Count == 0) { impTemplateLayouts = templateLayouts.Where(t => t.ModuleType == contract.ModuleType && t.Implementation == StateImplementations.Generic).ToList(); } // Setup the Templates in the Agency foreach (var templateLayout in impTemplateLayouts) { // Find or Create the Template var agencyTemplate = agency.GetTemplate(templateLayout.ModuleType, templateLayout.Name); if (agencyTemplate == null) { Log.Info("Installing {0}", templateLayout.Name); agencyTemplate = agency.CreateTemplate(contract.Id, contract.ModuleType, templateLayout.Name); // TODO: This assumes the First Workflow is the Correct Workflow agencyTemplate.SetWorkflow(agency.Workflows.First()); // Make the Template Active agencyTemplate.MakeActive(); // Assign all roles to the Template agency.Roles.ForEach(x => agencyTemplate.AssignRole(x)); // Determine if the template should be set as the Agency Default var templateIsDefault = templateLayout.IsDefault || // Template is Explicitly Marked as a Default. impTemplateLayouts.Count == 1; // There is only one template being installed for this contract. // Set the template as the Agency Default if (templateIsDefault) { agency.SetDefaultTemplate(agencyTemplate); } } else { Log.Info("Updating {0}", templateLayout.Name); // Reset the Template templateManager.ResetTemplateLayout(agencyTemplate); } // Load the Template Layout Information templateLayoutService.LoadLayout(templateLayout, agencyTemplate); } } }
public IdentityContextProvider(IAdministrationUnitOfWork administrationUnitOfWork) { _administrationUnitOfWork = administrationUnitOfWork; }