private HistoryItem defaultActivityDTOAssembler(ActEntry actEntry) { //When the display name is not set use the GBST list to get a localized if (actEntry.Template.DisplayName == null) { var actEntryNameElement = _listCache.GetGbstListElements("Activity Name", false).FirstOrDefault(e => e.Rank == actEntry.Template.Code); string displayName; if (actEntryNameElement == null) { _logger.LogWarn("No entry was found in GBST 'Activity Name' for code {0} (by rank). Using code value as a display name so there is something to show.", actEntry.Template.Code); displayName = Convert.ToString(actEntry.Template.Code); } else { displayName = actEntryNameElement.Title; } actEntry.Template.DisplayName = StringToken.FromKeyString("HISTORY_ACTIVITY_NAME_{0}".ToFormat(actEntry.Template.Code), displayName); } return(new HistoryItem { DatabaseIdentifier = actEntry.ActEntryRecord.DatabaseIdentifier(), Id = actEntry.Id, Type = actEntry.Type, Title = actEntry.Template.DisplayName, Who = actEntry.Who, ImpersonatedBy = actEntry.ImpersonatedBy, When = actEntry.When, Detail = actEntry.AdditionalInfo }); }
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 defaultActivityDTOAssembler(ActEntry actEntry) { return(new HistoryItem { Id = _workflowObject.Id, Type = actEntry.Type, Title = actEntry.Template.DisplayName, Who = actEntry.Who, When = actEntry.When, Detail = actEntry.AdditionalInfo }); }
private HistoryItem createActivityDTOFromMapper(ActEntry actEntry, IDictionary <ActEntryTemplate, ClarifyGeneric> templateRelatedGenerics) { var dto = defaultActivityDTOAssembler(actEntry); var actEntryTemplate = actEntry.Template; updateActivityDto(actEntry, dto, templateRelatedGenerics); if (isActivityDTOEditorPresent(actEntry)) { actEntryTemplate.ActivityDTOEditor(dto); } actEntryTemplate.HTMLizer(dto); return(dto); }
private void updateActivityDto(ActEntry actEntry, HistoryItem dto, IDictionary <ActEntryTemplate, ClarifyGeneric> templateRelatedGenerics) { if (!isActivityDTOUpdaterPresent(actEntry)) { return; } var actEntryTemplate = actEntry.Template; var relatedRow = actEntry.ActEntryRecord; if (templateRelatedGenerics.ContainsKey(actEntryTemplate)) { var relatedRows = actEntry.ActEntryRecord.RelatedRows(templateRelatedGenerics[actEntryTemplate]); relatedRow = relatedRows.Length > 0 ? relatedRows[0] : null; } if (relatedRow != null) { actEntryTemplate.ActivityDTOUpdater(relatedRow, dto); } }
private static bool isActivityDTOEditorPresent(ActEntry actEntry) { return(actEntry.Template.ActivityDTOEditor != null); }