public IEnumerable<HistoryItem> Build(WorkflowObject workflowObject, Filter actEntryFilter) { var clarifyDataSet = _session.CreateDataSet(); var workflowObjectInfo = WorkflowObjectInfo.GetObjectInfo(workflowObject.Type); var workflowGeneric = clarifyDataSet.CreateGenericWithFields(workflowObjectInfo.ObjectName); workflowGeneric.AppendFilter(workflowObjectInfo.IDFieldName, StringOps.Equals, workflowObject.Id); var inverseActivityRelation = workflowObjectInfo.ActivityRelation; var activityRelation = _schemaCache.GetRelation("act_entry", inverseActivityRelation).InverseRelation; var actEntryGeneric = workflowGeneric.Traverse(activityRelation.Name); actEntryGeneric.AppendSort("entry_time", false); if (actEntryFilter != null) { actEntryGeneric.Filter.AddFilter(actEntryFilter); } var templateDictionary = _templatePolicyConfiguration.RenderPolicies(workflowObject); //query generic hierarchy and while using act entry templates transform the results into HistoryItems var assembler = _container.With(templateDictionary).With(workflowObject).GetInstance<HistoryItemAssembler>(); return assembler.Assemble(actEntryGeneric); }
public IEnumerable<HistoryItem> BuildHistory(HistoryRequest request) { if (!_historySettings.MergeCaseHistoryChildSubcases) { return _historyBuilder.Build(request); } _logger.LogDebug("Build merged history for case {0}", request.WorkflowObject.Id); var subcaseIds = GetSubcaseIds(request.WorkflowObject).ToArray(); var caseHistory = _historyBuilder.Build(request); if (!subcaseIds.Any()) { return caseHistory; } var subcaseWorkflowObject = new WorkflowObject {Type = WorkflowObject.Subcase, Id = subcaseIds.First(), IsChild = true}; var subcaseHistoryRequest = new HistoryRequest { HistoryItemLimit = request.HistoryItemLimit, WorkflowObject = subcaseWorkflowObject, Since = request.Since, ShowAllActivities = request.ShowAllActivities }; _logger.LogDebug("Build and merge subcase history for case {0} subcases: {1}", request.WorkflowObject.Id, subcaseIds.Join(",")); var subcaseHistories = _historyBuilder.Build(subcaseHistoryRequest, subcaseIds); var results = subcaseHistories.Concat(caseHistory); return results.OrderByDescending(r => r.When); }
protected override void DefineTemplate(WorkflowObject workflowObject) { //you can remove templates created by other policies ActEntry(3000).Remove(); //you can redefine existing policies ActEntry(900).DisplayName("Dys-patched") .EditActivityDTO(dto => { dto.Detail = "Dys-patched to the deep six. " + dto.Detail; }); }
private IDictionary<int, ActEntryTemplate> buildResultsFor(WorkflowObject workflowObject) { var results = new Dictionary<int, ActEntryTemplate>(); DefaultPolicy.RenderTemplate(workflowObject, results); Policies.Each(p => p.RenderTemplate(workflowObject, results)); return results; }
protected override void DefineTemplate(WorkflowObject workflowObject) { //child object histories are not a concern of this policy if (workflowObject.IsChild) return; //typical workflow object policies ActEntry(10500).DisplayName(HistoryBuilderTokens.ASSIGNED) .EditActivityDTO(dto => { dto.Detail = "{0} {1}".ToFormat(HistoryBuilderTokens.ASSIGNED, dto.Detail); }); ActEntry(100).DisplayName(HistoryBuilderTokens.ACCEPTED) .EditActivityDTO(dto => { dto.Detail = "{0} {1}".ToFormat(HistoryBuilderTokens.ACCEPTED, dto.Detail); }); ActEntry(200).DisplayName(HistoryBuilderTokens.CLOSED) .GetRelatedRecord("act_entry2close_case") .WithFields("summary") .UpdateActivityDTOWith((row, dto) => { dto.Detail = row["summary"].ToString(); }); ActEntry(400).DisplayName(HistoryBuilderTokens.COMMITMENT_CREATED); ActEntry(600).DisplayName(HistoryBuilderTokens.CREATED); ActEntry(900).DisplayName(HistoryBuilderTokens.DISPATCHED) .EditActivityDTO(dto => { dto.Detail = "{0} {1}".ToFormat(HistoryBuilderTokens.DISPATCHED, dto.Detail); }); //ActEntry(1600).DisplayName(HistoryBuilderTokens.COMMITMENT_MODIFED); ActEntry(2400).DisplayName(HistoryBuilderTokens.REOPENED) .EditActivityDTO(dto => { dto.Detail = "{0} {1}".ToFormat(HistoryBuilderTokens.REOPENED, dto.Detail); }); ActEntry(4100).DisplayName(HistoryBuilderTokens.YANKED); ActEntry(7200).DisplayName(HistoryBuilderTokens.SUBCASE_CREATED_ADMINISTRATIVE); //TODO add policy for attachment adds for: Seeker attachment downloads, url rewriting, plain ActEntry(8900).DisplayName(HistoryBuilderTokens.ATTACHMENT_ADDED); //.HtmlizeWith(item => { }).UpdateActivityDTOWith((row, item) => _attachmentPathHistoryItemUpdater.Update(row["addnl_info"].ToString(), item)); ActEntry(9100).DisplayName(HistoryBuilderTokens.ATTACHMENT_DELETED); ActEntry(9800).DisplayName(HistoryBuilderTokens.CONTACT_CHANGED); ActEntry(1400).DisplayName(HistoryBuilderTokens.SOLUTION_LINKED); ActEntry(4000).DisplayName(HistoryBuilderTokens.SOLUTION_UNLINKED); ActEntry(9200).DisplayName(HistoryBuilderTokens.INITIAL_RESPONSE); if (_historySettings.MergeCaseHistoryChildSubcases == false) { ActEntry(3000).DisplayName(HistoryBuilderTokens.SUBCASE_CREATED); ActEntry(3100).DisplayName(HistoryBuilderTokens.SUBCASE_CLOSED); ActEntry(4200).DisplayName(HistoryBuilderTokens.SUBCASE_REOPENED); ActEntry(7200).DisplayName(HistoryBuilderTokens.SUBCASE_CREATED_ADMINISTRATIVE); } this.TimeAndExpenseEdittedActEntry(); this.StatusChangedActEntry(); this.LogResearchActEntry(); this.PhoneLogActEntry(_schemaCache); this.NoteActEntry(_schemaCache); this.TimeAndExpenseLoggedActEntry(); this.TimeAndExpenseLoggedDeletedActEntry(); this.EmailOutActEntry(_schemaCache, _parser); this.EmailInActEntry(_schemaCache, _parser); this.ForwardActEntry(); this.RejectActEntry(); }
protected override void DefineTemplate(WorkflowObject workflowObject) { //you can remove templates created by other policies ActEntry(3000).Remove(); //edit existing template to make it only appear when requesting history with ShowAllActivities=true EditActEntry(300).IsVerbose(); //you can redefine existing policies ActEntry(900).DisplayName(HistoryBuilderTokens.DISPATCHED) .EditActivityDTO(dto => { dto.Detail = "Dys-patched to the deep six. " + dto.Detail; }); }
protected override void DefineTemplate(WorkflowObject workflowObject) { //child object histories are not a concern of this policy if (workflowObject.IsChild) return; //typical workflow object policies ActEntry(10500).DisplayName("Assigned") .EditActivityDTO(dto => { dto.Detail = "Assigned " + dto.Detail; }); ActEntry(100).DisplayName("Accepted") .EditActivityDTO(dto => { dto.Detail = "Accepted " + dto.Detail; }); ActEntry(200).DisplayName("Closed") .GetRelatedRecord("act_entry2close_case") .WithFields("summary") .UpdateActivityDTOWith((row, dto) => { dto.Detail = row["summary"].ToString(); }); ActEntry(400).DisplayName("Committment created"); ActEntry(600).DisplayName("Created"); ActEntry(900).DisplayName("Dispatched") .EditActivityDTO(dto => { dto.Detail = "Dispatched " + dto.Detail; }); ActEntry(1100).DisplayName("Forwarded"); ActEntry(1600).DisplayName("Committment modified"); ActEntry(2400).DisplayName("Reopened") .EditActivityDTO(dto => { dto.Detail = "Reopened " + dto.Detail; }); ActEntry(2600).DisplayName("Returned to sender"); ActEntry(4100).DisplayName("Yanked"); ActEntry(4200).DisplayName("Subcase reopened"); ActEntry(7200).DisplayName("Administrative subcase created"); //TODO add policy for attachment adds for: Seeker attachment downloads, url rewriting, plain ActEntry(8900).DisplayName("Attachment added"); //.HtmlizeWith(item => { }).UpdateActivityDTOWith((row, item) => _attachmentPathHistoryItemUpdater.Update(row["addnl_info"].ToString(), item)); ActEntry(9100).DisplayName("Attachment deleted"); ActEntry(9800).DisplayName("Contact changed"); ActEntry(1400).DisplayName("Linked to a solution"); ActEntry(4000).DisplayName("Unlinked from the solution"); ActEntry(9200).DisplayName("Initial response"); ActEntry(3000).DisplayName("Subcase created"); ActEntry(3100).DisplayName("Subcase closed"); this.TimeAndExpenseEdittedActEntry(); this.StatusChangedActEntry(); this.LogResearchActEntry(); this.PhoneLogActEntry(); this.NoteActEntry(); this.TimeAndExpenseLoggedActEntry(); this.TimeAndExpenseLoggedDeletedActEntry(); this.EmailOutActEntry(); this.EmailInActEntry(); }
private IEnumerable<string> GetSubcaseIds(WorkflowObject workflowObject) { var clarifyDataSet = _session.CreateDataSet(); var caseGeneric = clarifyDataSet.CreateGenericWithFields("case"); caseGeneric.AppendFilter("id_number", StringOps.Equals, workflowObject.Id); var subcaseGeneric = caseGeneric.TraverseWithFields("case2subcase", "id_number"); caseGeneric.Query(); return subcaseGeneric.Count > 0 ? subcaseGeneric.DataRows().Select(s => s.AsString("id_number")) : new string[0]; }
private IDictionary<int, ActEntryTemplate> buildTemplatesFor(WorkflowObject workflowObject) { var results = new Dictionary<int, ActEntryTemplate>(); //Setup default template to be used when act_entries with no template are found in the results //TODO allow better customization of how the default template is defined var defaultTemplate = _container.GetInstance<ActEntryTemplate>(); defaultTemplate.Code = DefaultActEntryTemplateMagicCode; results.Add(DefaultActEntryTemplateMagicCode, defaultTemplate); DefaultPolicy.RenderTemplate(workflowObject, results); Policies.Each(p => p.RenderTemplate(workflowObject, results)); return results; }
protected override void DefineTemplate(WorkflowObject workflowObject) { //kill subcase create and close for case objects when merging subcase history if (_settings.MergeCaseHistoryChildSubcases && workflowObject.Type == WorkflowObject.Case) { ActEntry(3000).Remove(); ActEntry(3100).Remove(); ActEntry(7200).Remove(); } //the rest of this policy is subcase specific if (workflowObject.Type != WorkflowObject.Subcase) return; //make subcase creation and close more detailed. ActEntry(3000).DisplayName(HistoryBuilderTokens.SUBCASE_CREATED) .GetRelatedRecord("act_entry2notes_log") .WithFields("description") .UpdateActivityDTOWith((record, dto) => { dto.Detail = record.AsString("description"); }); ActEntry(3100).DisplayName(HistoryBuilderTokens.SUBCASE_CLOSED) .GetRelatedRecord("act_entry2close_case") .WithFields("summary") .UpdateActivityDTOWith((record, dto) => { dto.Detail = record.AsString("summary"); }); //make admin subcase creation and close more detailed. ActEntry(7200).DisplayName(HistoryBuilderTokens.SUBCASE_CREATED_ADMINISTRATIVE) .GetRelatedRecord("act_entry2notes_log") .WithFields("description") .UpdateActivityDTOWith((record, dto) => { dto.Detail = record.AsString("description"); }); //templates specific to subcases which are child histories if (!workflowObject.IsChild) return; //for subcase histories which are a child of another history show limited details this.TimeAndExpenseEdittedActEntry(); this.StatusChangedActEntry(); this.LogResearchActEntry(); this.PhoneLogActEntry(_schemaCache); this.NoteActEntry(_schemaCache); this.TimeAndExpenseLoggedActEntry(); this.TimeAndExpenseLoggedDeletedActEntry(); this.EmailOutActEntry(_schemaCache, _parser); this.EmailInActEntry(_schemaCache, _parser); }
public IEnumerable<HistoryItem> BuildHistory(WorkflowObject workflowObject, Filter actEntryFilter) { if(!_historySettings.MergeCaseHistoryChildSubcases) { return _historyBuilder.Build(workflowObject, actEntryFilter); } var subcaseIds = GetSubcaseIds(workflowObject); var caseHistory = _historyBuilder.Build(workflowObject, actEntryFilter); var subcaseHistories = subcaseIds.Select(id => { var subcaseWorkflowObject = new WorkflowObject { Type = WorkflowObject.Subcase, Id = id, IsChild = true }; return _historyBuilder.Build(subcaseWorkflowObject, actEntryFilter); }); var results = subcaseHistories.SelectMany(result => result).Concat(caseHistory); return results.OrderByDescending(r => r.When); }
public void RenderTemplate(WorkflowObject workflowObject, IDictionary<int, ActEntryTemplate> actEntryTemplates) { ActEntryTemplatesByCode = actEntryTemplates; _currentActEntryTemplate = null; DefineTemplate(workflowObject); addCurrentActEntryTemplate(); }
private IEnumerable<HistoryItem> getHistoryItems(WorkflowObject workflowObject, Filter actEntryFilter) { var historyBuilderPolicy = _entityHistoryBuilders.First(policy => policy.Handles(workflowObject)); return historyBuilderPolicy.BuildHistory(workflowObject, actEntryFilter); }
protected override void DefineTemplate(WorkflowObject workflowObject) { //remove add attachments for merged history if (workflowObject.IsChild) { ActEntry(8900).Remove(); ActEntry(9100).Remove(); return; } //When the workflow object itself has a relation to doc_inst. //Attempt to match the attachment navigating from the act entry to the workflow object and from there down to the doc_path //we look for the attachment whose doc_path.path matches the act_entry_addln_info details. var objectInfo = WorkflowObjectInfo.GetObjectInfo(workflowObject.Type); var table = _schemaCache.Tables[objectInfo.ObjectName]; if (_settings.UseDovetailSDKCompatibileAttachmentFinder == false && table.Relationships.Cast <ISchemaRelation>().Any(r => r.TargetTable.Name == "doc_inst")) { //use the work object info to get the object's relation to actentry //unfortunately the object info doesn't have the relation from the workflow object to doc_inst. var docInstRelation = table.Relationships.Cast <ISchemaRelation>().First(r => r.TargetTable.Name == "doc_inst"); ActEntry(8900).DisplayName(HistoryBuilderTokens.ATTACHMENT_ADDED) .GetRelatedRecord(objectInfo.ActivityRelation, workflowGeneric => { var docInstGeneric = workflowGeneric.TraverseWithFields(docInstRelation.Name, "title"); docInstGeneric.TraverseWithFields("attach_info2doc_path", "path"); }) .UpdateActivityDTOWith((caseRow, item, template) => { var docInst = caseRow.RelatedRows(docInstRelation.Name).FirstOrDefault(d => { var docPath = d.RelatedRows("attach_info2doc_path").First(); return(item.Detail.Contains(docPath.AsString("path"))); }); if (docInst == null) { _logger.LogDebug( "Could not find an attachment whose additional info matches one of the attachment paths. The history item will contain the plain additional info."); return; } //cancel the htmlizer as we are emitting HTML template.HTMLizer = i => { }; var docInstDetail = new DocInstDetail { ObjId = docInst.DatabaseIdentifier(), Title = docInst.AsString("title"), Path = docInst.RelatedRows("attach_info2doc_path")[0].AsString("path"), Properties = new Dictionary <string, object>() }; _attachmentHistoryItemUpdater.Update(docInstDetail, item); item.Internal = string.Empty; }); return; } //Settings dictate or this workflow object does not support our fancy attachment history item updater so we use the old navigation via act_entry to doc_inst //The mechanism only works well when recent versions of Dovetail SDK to create attachments. ActEntry(8900).DisplayName(HistoryBuilderTokens.ATTACHMENT_ADDED) .GetRelatedRecord("act_entry2doc_inst") .WithFields("title") .UpdateActivityDTOWith((row, item, template) => { //cancel the htmlizer as we are emitting HTML template.HTMLizer = i => { }; var docInstDetail = new DocInstDetail { ObjId = row.DatabaseIdentifier(), Title = row.AsString("title").HtmlEncode(), Properties = new Dictionary <string, object>() }; _attachmentHistoryItemUpdater.Update(docInstDetail, item); item.Internal = string.Empty; }); }
public HistoryViewModel GetHistorySince(WorkflowObject workflowObject, DateTime sinceDate) { var filter = new FilterExpression().MoreThan("entry_time", sinceDate); return getHistoryWithConstraint(workflowObject, filter); }
public bool Handles(WorkflowObject workflowObject) { return workflowObject.Type == WorkflowObject.Case; }
protected void rmJNPAction_ItemClick(object sender, RadMenuEventArgs e) { RadMenu rmJNPAction = sender as RadMenu; long JNPID = Convert.ToInt64(rmJNPAction.Attributes["JNPID"]); enumNavigationMode currentNavigationMode = enumNavigationMode.None; WorkflowObject wo = new WorkflowObject(); wo.StaffingObjectTypeID = enumStaffingObjectType.JNP; wo.StaffingObjectID = JNPID; wo.UserID = CurrentUserID; base.CurrentJNPID = JNPID; try { //bool navigateToActiveDocument = false; switch (e.Item.Value) { case "View": this.CurrentJNPID = JNPID; //navigateToActiveDocument = true; currentNavigationMode = enumNavigationMode.View; GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); break; case "Edit": wo.ActionTypeID = enumActionType.CheckOut; WorkflowManager.CheckJNP(wo); this.CurrentJNPID = JNPID; //navigateToActiveDocument = true; currentNavigationMode = enumNavigationMode.Edit; GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); break; case "ContinueEdit": this.CurrentJNPID = JNPID; //navigateToActiveDocument = true; currentNavigationMode = enumNavigationMode.Edit; GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); break; case "FinishEdit": wo.ActionTypeID = enumActionType.CheckIn; WorkflowManager.CheckJNP(wo); break; case "UpdateHiringResult": //GoToLink("~/Package/UpdateHiringResult.aspx"); //CurrentJNPID = JNPID; //rmJNPAction.Attributes.Add("onClick", "javascript:ShowJNPUpdateHiringResultPopUp(" + JNPID.ToString() + "); return false;"); ShowUpdateHiringResultWindow(JNPID); break; case "CSN": //GoToLink("~/Package/CopyJNPFromExisting.aspx?CopyJNPID=" + JNPID.ToString()); if (JNPID > 0) { //Fixed JA issue 906 -Classifier 14's My Tracker missing packages that Classifier creates by copying from existing pacakges. //addjnpfrom existing jnp - newpackage.createdbyid is set based on current userid JNPackage NewPackage = new JNPackage(); JNPackage existingPackage = new JNPackage(JNPID); NewPackage.PayPlanID = existingPackage.PayPlanID; NewPackage.RegionID = existingPackage.RegionID; NewPackage.SeriesID = existingPackage.SeriesID; NewPackage.OrganizationCodeID = existingPackage.OrganizationCodeID; NewPackage.IsStandardJNP = existingPackage.IsStandardJNP; NewPackage.JNPTitle = existingPackage.JNPTitle; NewPackage.IsInterdisciplinary = existingPackage.IsInterdisciplinary; NewPackage.AdditionalSeriesID = existingPackage.AdditionalSeriesID; NewPackage.JNPTypeID = existingPackage.JNPTypeID; NewPackage.LowestAdvertisedGrade = existingPackage.LowestAdvertisedGrade; NewPackage.HighestAdvertisedGrade = existingPackage.HighestAdvertisedGrade; NewPackage.FullPDID = existingPackage.FullPDID; NewPackage.AdditionalPDID = existingPackage.AdditionalPDID; NewPackage.DutyLocation = existingPackage.DutyLocation; NewPackage.IsDEU = existingPackage.IsDEU; NewPackage.IsMP = existingPackage.IsMP; NewPackage.IsExceptedService = existingPackage.IsExceptedService; NewPackage.CreatedByID = base.CurrentUserID; NewPackage.JNPOptionTypeID = eJNPOptionType.CreateFromExisting; NewPackage.CopyFromJNPID = JNPID; NewPackage.AddBasedOnExistingJNP(); base.CurrentJNPID = NewPackage.JNPID; base.CurrentJAID = NewPackage.JAID; base.CurrentNavMode = enumNavigationMode.Edit; ReloadCurrentJNP(NewPackage.JNPID); GoToLink("~/JA/JAPositionInformation.aspx"); } break; default: break; } rgSearchResults.Rebind(); } catch (Exception ex) { ExceptionBase.HandleException(ex); } }
protected void jnpTrackerMenu_ItemClick(object sender, RadMenuEventArgs e) { RadMenu menu = (RadMenu)sender; long JNPID = long.Parse(menu.DataFieldID); enumNavigationMode currentNavigationMode = enumNavigationMode.None; WorkflowObject wo = new WorkflowObject(); wo.StaffingObjectTypeID = enumStaffingObjectType.JNP; wo.StaffingObjectID = JNPID; wo.UserID = CurrentUserID; base.CurrentJNPID = JNPID; try { //bool navigateToActiveDocument = false; switch (e.Item.Value) { case "View": CurrentJNPID = JNPID; //navigateToActiveDocument = true; currentNavigationMode = enumNavigationMode.View; GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); break; case "Edit": wo.ActionTypeID = enumActionType.CheckOut; WorkflowManager.CheckJNP(wo); CurrentJNPID = JNPID; //navigateToActiveDocument = true; currentNavigationMode = enumNavigationMode.Edit; GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); break; case "ContinueEdit": CurrentJNPID = JNPID; //navigateToActiveDocument = true; currentNavigationMode = enumNavigationMode.Edit; GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); break; case "FinishEdit": wo.ActionTypeID = enumActionType.CheckIn; WorkflowManager.CheckJNP(wo); break; default: break; } jnpTrackerGrid.Rebind(); //if (navigateToActiveDocument) //{ // if (base.CurrentJNPWS == enumJNPWorkflowStatus.Draft) // { // enumDocumentType activeDocumentType = TrackerItem.GetActiveDocumentType(JNPID); // switch (activeDocumentType) // { // // GoToLink method of UserControlBase provide screen mode as parameter // case enumDocumentType.JNP: // case enumDocumentType.JA: // GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); // break; // case enumDocumentType.CR: // GoToLink("~/CR/CategoryRating.aspx", currentNavigationMode); // break; // case enumDocumentType.JQ: // if ((base.HasHRGroupPermission) || (base.IsAdmin)) // { // GoToLink("~/JQ/Qualifications.aspx", currentNavigationMode); // } // else // { // GoToLink("~/JQ/JQKSA.aspx", currentNavigationMode); // } // break; // default: // throw new Exception(String.Format("Unexpected JNP Active Document Type: {0}", (int)activeDocumentType)); // } // } // else if (base.CurrentJNPWS == enumJNPWorkflowStatus.FinalReview) // { // GoToLink("~/JA/JAPositionInformation.aspx", currentNavigationMode); // } // // Issue # 77 - Modify CommonEnum.cs - Modify enumJNPWorkflowStatus as per the new workflow statuses // //else if (base.CurrentJNPWS == enumJNPWorkflowStatus.Approval) // //{ // // base.CurrentApprovalObjectType = enumStaffingObjectType.JNP; // // GoToLink("~/Approval/Approval.aspx", currentNavigationMode); // //} //} //else //{ // e.Item.Selected = false; // jnpTrackerGrid.Rebind(); //} } catch (Exception ex) { ExceptionBase.HandleException(ex); } }
public void verify_instructions() { VerifyInstructions.Assert(theScenario.Instructions, _ => { _.Verify <BeginModelMap>(__ => __.Name.ShouldEqual(WorkflowObject.KeyFor("case"))); _.Verify <BeginActEntry>(__ => { __.Code.ShouldEqual(3000); __.IsVerbose.ShouldBeFalse(); }); _.Is <EndActEntry>(); _.SkipDefaults(); _.Verify <BeginActEntry>(__ => { __.Code.ShouldEqual(3400); __.IsVerbose.ShouldBeFalse(); }); _.Get <BeginProperty>().Key.ShouldEqual("note"); _.Is <EndProperty>(); _.Get <BeginRelation>().RelationName.ShouldEqual("act_entry2email_log"); _.Get <BeginProperty>().Key.ShouldEqual("sender"); _.Is <EndProperty>(); _.Get <BeginProperty>().Key.ShouldEqual("recipient"); _.Is <EndProperty>(); _.Get <BeginProperty>().Key.ShouldEqual("body"); _.Is <EndProperty>(); _.Is <EndRelation>(); _.Is <EndActEntry>(); _.Verify <BeginActEntry>(__ => { __.Code.ShouldEqual(8900); __.IsVerbose.ShouldBeTrue(); }); _.Verify <BeginWhen>(__ => __.IsChild.ShouldBeFalse()); _.Get <BeginRelation>().RelationName.ShouldEqual("act_entry2doc_inst"); _.Get <BeginProperty>().Key.ShouldEqual("id"); _.Is <EndProperty>(); _.Get <BeginProperty>().Key.ShouldEqual("title"); _.Is <EndProperty>(); _.Is <EndRelation>(); _.Is <EndWhen>(); _.Verify <BeginWhen>(__ => __.IsChild.ShouldBeTrue()); _.Get <BeginProperty>().Key.ShouldEqual("childProperty"); _.Is <EndProperty>(); _.Is <EndWhen>(); _.Is <EndActEntry>(); _.Is <EndModelMap>(); }); }
protected override void DefineTemplate(WorkflowObject workflowObject) { //remove add attachments for merged history if (workflowObject.IsChild) { ActEntry(8900).Remove(); ActEntry(9100).Remove(); return; } //When the workflow object itself has a relation to doc_inst. //Attempt to match the attachment navigating from the act entry to the workflow object and from there down to the doc_path //we look for the attachment whose doc_path.path matches the act_entry_addln_info details. var objectInfo = WorkflowObjectInfo.GetObjectInfo(workflowObject.Type); var table = _schemaCache.Tables[objectInfo.ObjectName]; if (_settings.UseDovetailSDKCompatibileAttachmentFinder == false && table.Relationships.Cast<ISchemaRelation>().Any(r => r.TargetTable.Name == "doc_inst")) { //use the work object info to get the object's relation to actentry //unfortunately the object info doesn't have the relation from the workflow object to doc_inst. var docInstRelation = table.Relationships.Cast<ISchemaRelation>().First(r => r.TargetTable.Name == "doc_inst"); ActEntry(8900).DisplayName(HistoryBuilderTokens.ATTACHMENT_ADDED) .GetRelatedRecord(objectInfo.ActivityRelation, workflowGeneric => { var docInstGeneric = workflowGeneric.TraverseWithFields(docInstRelation.Name, "title"); docInstGeneric.TraverseWithFields("attach_info2doc_path", "path"); }) .UpdateActivityDTOWith((caseRow, item, template) => { var docInst = caseRow.RelatedRows(docInstRelation.Name).FirstOrDefault(d => { var docPath = d.RelatedRows("attach_info2doc_path").First(); return (item.Detail.Contains(docPath.AsString("path"))); }); if (docInst == null) { _logger.LogDebug("Could not find an attachment whose additional info matches one of the attachment paths. The history item will contain the plain additional info."); return; } //cancel the htmlizer as we are emitting HTML template.HTMLizer = i => { }; var docInstDetail = new DocInstDetail { ObjId = docInst.DatabaseIdentifier(), Title = docInst.AsString("title"), Path = docInst.RelatedRows("attach_info2doc_path")[0].AsString("path") }; _attachmentHistoryItemUpdater.Update(docInstDetail, item); item.Internal = string.Empty; }); return; } //Settings dictate or this workflow object does not support our fancy attachment history item updater so we use the old navigation via act_entry to doc_inst //The mechanism only works well when recent versions of Dovetail SDK to create attachments. ActEntry(8900).DisplayName(HistoryBuilderTokens.ATTACHMENT_ADDED) .GetRelatedRecord("act_entry2doc_inst") .WithFields("title") .UpdateActivityDTOWith((row, item, template) => { //cancel the htmlizer as we are emitting HTML template.HTMLizer = i => { }; var docInstDetail = new DocInstDetail { ObjId = row.DatabaseIdentifier(), Title = row.AsString("title").HtmlEncode() }; _attachmentHistoryItemUpdater.Update(docInstDetail, item); item.Internal = string.Empty; }); }
protected void btnSubmit_Click(object sender, EventArgs e) { bool isValid = true; //var wfStatus = WorkflowManager.GetJNPCurrentDocumentWorklfowStatus(CurrentJNPID); enumJNPWorkflowStatus wfStatus = base.CurrentJNPWS; if (wfStatus != enumJNPWorkflowStatus.Revise && int.Parse(radComboActions.SelectedValue) == (int)enumActionType.SendToReviseToHiringManager && !_confirmQuestionnaireReadiness) { radComboActions.Enabled = false; btnSubmit.Enabled = false; rwConfirmBeforeRevise.VisibleOnPageLoad = true; return; } if (int.Parse(radComboActions.SelectedValue) != (int)enumActionType.DeleteCategoryRating) { if (ScreenValidationEvent != null) { ScreenValidationEventArgs validationArgs = new ScreenValidationEventArgs(); ScreenValidationEvent(this, validationArgs); isValid = validationArgs.IsValid; } } if (isValid) { enumActionType actiontypeid = (enumActionType)(int.Parse(radComboActions.SelectedValue)); WorkflowObject wo = CurrentWorkflowObject; long parentobjectid = wo.ParentObjectID; string url = string.Empty; string validationErrors = string.Empty; bool blnhaserror = false; HasErrors = false; long checkid = -1; WorkflowObjectSavedEventArgs we; try { switch (actiontypeid) { case enumActionType.SendToReviewToHiringManager: case enumActionType.SendToReviewToHumanResources: validationErrors = WorkflowManager.GetStaffingObjetValidationErros(wo.StaffingObjectID, wo.StaffingObjectTypeID, ref blnhaserror, true); if (blnhaserror) { HasErrors = true; customValidator.ErrorMessage = validationErrors; Page.Validate(); } else { we = new WorkflowObjectSavedEventArgs(); if (WorkflowObjectSaved != null) { WorkflowObjectSaved(this, we); } if (!we.Cancel) { if (WorkflowManager.SetCurrentWorkflowStatus(wo, (int)enumJNPWorkflowStatus.Review, true) > 0) { GoToLink(Page.ResolveUrl("~/Package/JNPTracker.aspx")); } } } break; case enumActionType.SendToReviseToHiringManager: case enumActionType.SendToReviseToHumanResources: validationErrors = WorkflowManager.GetStaffingObjetValidationErros(wo.StaffingObjectID, wo.StaffingObjectTypeID, ref blnhaserror, true); if (blnhaserror) { HasErrors = true; customValidator.ErrorMessage = validationErrors; Page.Validate(); } else { we = new WorkflowObjectSavedEventArgs(); if (WorkflowObjectSaved != null) { WorkflowObjectSaved(this, we); } if (!we.Cancel) { if (WorkflowManager.SetCurrentWorkflowStatus(wo, (int)enumJNPWorkflowStatus.Revise, true) > 0) { GoToLink(Page.ResolveUrl("~/Package/JNPTracker.aspx")); } } } break; case enumActionType.SendForFinalReviewToHumanResources: validationErrors = WorkflowManager.GetStaffingObjetValidationErros(wo.StaffingObjectID, wo.StaffingObjectTypeID, ref blnhaserror, true); if (blnhaserror) { HasErrors = true; customValidator.ErrorMessage = validationErrors; Page.Validate(); } else { we = new WorkflowObjectSavedEventArgs(); if (WorkflowObjectSaved != null) { WorkflowObjectSaved(this, we); } if (!we.Cancel) { if (WorkflowManager.SetJNPCurrentWorkflowStatus(CurrentJNPID, (int)enumJNPWorkflowStatus.FinalReview, enumWorkflowStatusType.JNP, CurrentUserID, true) > 0) { GoToLink(Page.ResolveUrl("~/Package/JNPTracker.aspx")); } } } break; case enumActionType.SaveAndUnlock: we = new WorkflowObjectSavedEventArgs(); if (WorkflowObjectSaved != null) { WorkflowObjectSaved(this, we); } if (!we.Cancel) { if ((wo.ParentObjectID > 0) && (wo.ParentObjetTypeID == enumStaffingObjectType.JNP)) { checkid = WorkflowManager.CheckStaffingObject(wo.ParentObjectID, wo.ParentObjetTypeID, enumActionType.CheckIn, wo.UserID); } if (checkid > 0) { GoToLink(Page.ResolveUrl("~/Package/JNPTracker.aspx")); } } break; case enumActionType.CreateCategoryRatingOptional: if (CategoryRatingManager.CreateCategoryRatingFromJobAnalysis(CurrentJNPID, CurrentJAID, false, CurrentUserID) > 0) { ReloadCurrentJNP(base.CurrentJNPID); GoToLink(Page.ResolveUrl("~/CR/CategoryRating.aspx"), base.CurrentNavMode); } break; case enumActionType.RestoreCategoryRatingOptional: if (CategoryRatingManager.RestoreCategoryRating(CurrentCRID, CurrentUserID) > 0) { ReloadCurrentJNP(base.CurrentJNPID); GoToLink(Page.ResolveUrl("~/CR/CategoryRating.aspx"), base.CurrentNavMode); } break; case enumActionType.CheckAndPublish: validationErrors = WorkflowManager.GetStaffingObjetValidationErros(wo.StaffingObjectID, wo.StaffingObjectTypeID, ref blnhaserror, true); if (blnhaserror) { HasErrors = true; customValidator.ErrorMessage = validationErrors; Page.Validate(); } else { if (WorkflowManager.SetJNPCurrentWorkflowStatus(CurrentJNPID, (int)enumJNPWorkflowStatus.Published, enumWorkflowStatusType.JNP, CurrentUserID, true) > 0) { lblmsg.Text = "Document is published."; BindActions(); base.GetActiveDocumentType(true); //Below is no longer in scope for new requirement. //base.GetJNPCurrentDocumentWorklfowStatus(true); GoToLink(Page.ResolveUrl(string.Format("~/Package/Publish.aspx?JNPID={0}", CurrentJNPID))); } } break; default: break; } } catch (Exception ex) { HandleException(ex); } } }
public IEnumerable<HistoryItem> BuildHistory(WorkflowObject workflowObject, Filter actEntryFilter) { return _historyBuilder.Build(workflowObject, actEntryFilter); }
static void Main(string[] args) { //StopWatch sw = new StopWatch(); //for(var i=0; i<2; i++) { // sw.Start(); // Thread.Sleep(1000); // Debug.WriteLine("Duration: " + sw.Stop()); // Debug.WriteLine("Press enter to run the stopwatch one more time."); // Console.ReadLine(); //} //Post p = new Post("title here", "description here"); //int voteCount = p.UpVote(); //voteCount = p.UpVote(); //voteCount = p.DownVote(); //MyStack_List stack = new MyStack_List(); //stack.Push(1); //stack.Push(2); //stack.Push(3); //stack.Push(4); //Console.WriteLine(stack.Pop()); // take out 4 //Console.WriteLine(stack.Pop()); // take out 3 //stack.Push(5); //stack.Push(6); //stack.Push(7); //Console.WriteLine(stack.Pop()); // Takes out 7 ////should have 1,2,5,6 //stack.Clear(); ////POP V2 //var ini = 0; //var max = 5; ////Pushes the numbers 0 to 5 //for(int i = ini; i<=max; i++) { // stack.Push(i); // Debug.WriteLine("Pushed: {0}", i); //} ////Pops all items in the list //for (int i = ini; i <= max; i++) { // var itemPopped = stack.Pop(); // Debug.WriteLine("Popped: {0}", itemPopped); //} //section 5 //SqlConnection sqlConnection = new SqlConnection("my SQL connection string."); //OracleConnection oracleConnection = new OracleConnection("my Oracle connection string."); //DbCommand dbCommand = new DbCommand(sqlConnection, "instruction for db"); //dbCommand.Open(); //dbCommand.Run(); //dbCommand.Close(); WorkflowObject workFlowObject = new WorkflowObject(); workFlowObject.AddActivityToWorkFlow(new Activity_1()); workFlowObject.AddActivityToWorkFlow(new Activity_2()); workFlowObject.AddActivityToWorkFlow(new Activity_3()); WorkflowEngine workflowEngine = new WorkflowEngine(); workflowEngine.Run(workFlowObject); }
public IDictionary<int, ActEntryTemplate> RenderPolicies(WorkflowObject workflowObject) { return _resultCache[workflowObject]; }
protected abstract void DefineTemplate(WorkflowObject workflowObject);
public HistoryViewModel GetHistory(WorkflowObject workflowObject) { return getHistoryWithConstraint(workflowObject, null); }
public HistoryItemAssembler(IDictionary<int, ActEntryTemplate> templatesByCode, WorkflowObject workflowObject) { _templatesByCode = templatesByCode; _workflowObject = workflowObject; }
/// <summary> /// Renders a snippet using a Liquid template engine. /// </summary> /// <param name="snippetContent">The snippet content to render.</param> /// <param name="model">The model used to provide properties to snippet Liquid templates.</param> /// <param name="messagingObject">An optional messaging object to add to the variable context, accessible to snippets.</param> /// <param name="resourceTemplate">An optional resource template object to add to the variable context, accessible to templates.</param> /// <param name="resourceSnippet">An optional resource template object to add to the variable context, accessible to snippets.</param> /// <param name="workflowObject">A workflow object to add to the variable context, accessible to snippets.</param> /// <returns>The rendered snippet content.</returns> public async Task <string> RenderSnippetAsync(string snippetContent, AzureIntegrationServicesModel model, MessagingObject messagingObject = null, TargetResourceTemplate resourceTemplate = null, TargetResourceSnippet resourceSnippet = null, WorkflowObject workflowObject = null) { _ = model ?? throw new ArgumentNullException(nameof(model)); _ = snippetContent ?? throw new ArgumentNullException(nameof(snippetContent)); // Create variables on script object, to be accessible to Liquid templates var scriptObject = new ScriptObject { ["model"] = model }; // Is there a messaging object? if (messagingObject != null) { var messagingObjects = model.FindMessagingObject(messagingObject.Key); if (messagingObjects.messageBus != null) { scriptObject["message_bus"] = messagingObjects.messageBus; if (messagingObjects.application != null) { scriptObject["application"] = messagingObjects.application; } if (messagingObjects.messagingObject != null) { scriptObject["messaging_object"] = messagingObjects.messagingObject; switch (messagingObjects.messagingObject.Type) { case MessagingObjectType.Message: scriptObject["message"] = (Message)messagingObjects.messagingObject; break; case MessagingObjectType.Channel: scriptObject["channel"] = (Channel)messagingObjects.messagingObject; break; case MessagingObjectType.Intermediary: scriptObject["intermediary"] = (Intermediary)messagingObjects.messagingObject; break; case MessagingObjectType.Endpoint: scriptObject["endpoint"] = (Endpoint)messagingObjects.messagingObject; break; } } } else { // Should never happen, unless the messaging object is not attached to the target model _logger.LogWarning(WarningMessages.MessagingObjectMissingInModel, messagingObject.Key); } } // Is there a resource template? if (resourceTemplate != null) { scriptObject["resource_template"] = resourceTemplate; } // Is there a resource snippet? if (resourceSnippet != null) { scriptObject["resource_snippet"] = resourceSnippet; } // Is there a workflow object? if (workflowObject != null) { scriptObject["workflow_object"] = workflowObject; } // Push variables onto the context _context.PushGlobal(scriptObject); try { // Render snippet var snippet = Template.ParseLiquid(snippetContent); var renderedContent = await snippet.RenderAsync(_context).ConfigureAwait(false); return(renderedContent); } finally { // Pop model from context stack _context.PopGlobal(); } }
private HistoryViewModel getHistoryForFirst(WorkflowObject workflowObject, Filter actEntryFilter, int numberOfEntries) { var historyItems = getHistoryItems(workflowObject, actEntryFilter).Take(numberOfEntries); return new HistoryViewModel { WorkflowObject = workflowObject, HistoryItems = historyItems.ToArray() }; }
public ActEntryGathererScenario(WorkflowObject workflowObject, bool showAll) { _workflowObject = workflowObject; _showAll = showAll; }
public HistoryViewModel GetHistoryTop(WorkflowObject workflowObject, int numberOfMostRecentEntries) { return getHistoryForFirst(workflowObject, null, numberOfMostRecentEntries); }
public void TheWorkflowObjectIs(WorkflowObject workflowObject) { _workflowObject = workflowObject; }
public bool Handles(WorkflowObject workflowObject) { return(workflowObject.Type != WorkflowObject.Case); }
public IDictionary<int, ActEntryTemplate> RenderPolicies(WorkflowObject workflowObject) { var templates = buildTemplatesFor(workflowObject); return templates; }
public IEnumerable <HistoryItem> BuildHistory(WorkflowObject workflowObject, Filter actEntryFilter) { return(_historyBuilder.Build(workflowObject, actEntryFilter)); }
private HistoryViewModel getHistoryWithConstraint(WorkflowObject workflowObject, Filter actEntryFilter) { var historyItems = getHistoryItems(workflowObject, actEntryFilter); return new HistoryViewModel { WorkflowObject= workflowObject, HistoryItems = historyItems.ToArray() }; }