private bool updateActivityDto(ActEntry actEntry, HistoryItem dto, ActEntryTemplate template, IDictionary <ActEntryTemplate, ClarifyGeneric> templateRelatedGenerics) { if (!isActivityDTOUpdaterPresent(template)) { return(false); } var relatedRow = actEntry.ActEntryRecord; var relatedGenericKey = actEntry.Template; dto.IsVerbose = relatedGenericKey.IsVerbose; if (templateRelatedGenerics.ContainsKey(relatedGenericKey)) { var relatedRows = actEntry.ActEntryRecord.RelatedRows(templateRelatedGenerics[relatedGenericKey]); //when a row related to the act entry was retrieved give that row to the updater. relatedRow = relatedRows.Length > 0 ? relatedRows[0] : null; if (relatedRow == null) { _logger.LogDebug("Activity updater for code {0} against object {1}-{2} did not work because no related row for relation {3} was found." .ToFormat(template.Code, dto.Type, dto.Id, template.RelatedGenericRelationName)); return(false); } } if (relatedRow != null) { template.ActivityDTOUpdater(relatedRow, dto, template); return(true); } return(false); }
private HistoryItem createActivityDTOFromMapper(ActEntry actEntry, IDictionary <ActEntryTemplate, ClarifyGeneric> templateRelatedGenerics) { var dto = defaultActivityDTOAssembler(actEntry); var template = new ActEntryTemplate(actEntry.Template); updateActivityDto(actEntry, dto, template, templateRelatedGenerics); if (isActivityDTOEditorPresent(template)) { template.ActivityDTOEditor(dto); } template.HTMLizer(dto); return(dto); }
private ActEntryTemplate findTemplateByActCode(int code, IDictionary <int, ActEntryTemplate> templatesByCode) { if (templatesByCode.ContainsKey(code)) { return(templatesByCode[code]); } _logger.LogDebug("No template found for act_code {0}. Using default act entry template.", code); //create a copy of the default template with the code and display name set correctly. var template = new ActEntryTemplate(templatesByCode[ActEntryTemplatePolicyConfiguration.DefaultActEntryTemplateMagicCode]) { Code = code, }; return(template); }
private static bool isActivityDTOEditorPresent(ActEntryTemplate template) { return(template.ActivityDTOEditor != null); }