<Process Name=" ParametersScheme" CanBeInlined="false" Tags="" LogEnabled="false">
  <Designer />
  <Actors>
    <Actor Name="supporter" Rule="Supporter" Value="" />
    <Actor Name="manager" Rule="CheckRole" Value="Manager" />
  </Actors>
  <Parameters>
    <Parameter Name="Division" Type="String" Purpose="Persistence" InitialValue="First Line" />
    <Parameter Name="Description" Type="String" Purpose="Persistence" InitialValue="describe your problem" />
    <Parameter Name="Comment" Type="String" Purpose="Persistence" />
  </Parameters>
  <Commands>
    <Command Name="redirect">
      <InputParameters>
        <ParameterRef Name="Division" IsRequired="true" DefaultValue="IT Department" NameRef="Division" />
        <ParameterRef Name="Comment" IsRequired="true" DefaultValue="" NameRef="Comment" />
      </InputParameters>
    </Command>
    <Command Name="resolve">
      <InputParameters>
        <ParameterRef Name="Comment" IsRequired="true" DefaultValue="" NameRef="Comment" />
      </InputParameters>
    </Command>
    <Command Name="reject">
      <InputParameters>
        <ParameterRef Name="Comment" IsRequired="true" DefaultValue="" NameRef="Comment" />
      </InputParameters>
    </Command>
  </Commands>
  <Activities>
    <Activity Name="Processing" State="Processing" IsInitial="true" IsFinal="false" IsForSetState="true" IsAutoSchemeUpdate="true">
      <Implementation>
        <ActionRef Order="1" NameRef="SendMessageToProcessConsoleAsync">
          <ActionParameter><![CDATA[Issue is analyzing.]]></ActionParameter>
        </ActionRef>
      </Implementation>
      <Designer X="340" Y="100" Hidden="false" />
    </Activity>
    <Activity Name="Resolved" State="Resolved" IsInitial="false" IsFinal="true" IsForSetState="true" IsAutoSchemeUpdate="true">
      <Implementation>
        <ActionRef Order="1" NameRef="SendMessageToProcessConsoleAsync">
          <ActionParameter><![CDATA[**Issue was resolved.**\nDescription: @Description\nComment: @Comment]]></ActionParameter>
        </ActionRef>
      </Implementation>
      <Designer X="210" Y="850" Hidden="false" />
    </Activity>
    <Activity Name="Rejected" State="Rejected" IsInitial="false" IsFinal="true" IsForSetState="true" IsAutoSchemeUpdate="true">
      <Implementation>
        <ActionRef Order="1" NameRef="SendMessageToProcessConsoleAsync">
          <ActionParameter><![CDATA[**Issue was rejected.**\nDescription: @Description\nComment: @Comment]]></ActionParameter>
        </ActionRef>
      </Implementation>
      <Designer X="480" Y="850" Hidden="false" />
    </Activity>
    <Activity Name="High Priority?" IsInitial="false" IsFinal="false" IsForSetState="false" IsAutoSchemeUpdate="true">
      <Annotations>
        <Annotation Name="__customtype"><![CDATA[Decision]]></Annotation>
      </Annotations>
      <Designer X="380" Y="410" Hidden="false" />
    </Activity>
    <Activity Name="Calculating priority" IsInitial="false" IsFinal="false" IsForSetState="false" IsAutoSchemeUpdate="true">
      <Implementation>
        <ActionRef Order="1" NameRef="Calculate Priority" />
        <ActionRef Order="2" NameRef="Throw Exception" />
      </Implementation>
      <Designer X="340" Y="260" Hidden="false" />
    </Activity>
    <Activity Name="CommonProcessing" State="Processing" IsInitial="false" IsFinal="false" IsForSetState="false" IsAutoSchemeUpdate="true">
      <Implementation>
        <ActionRef Order="1" NameRef="SendMessageToProcessConsoleAsync">
          <ActionParameter><![CDATA[**Issue is processing.**\nIn Division: @Division\nDescription: @Description\nComment: @Comment]]></ActionParameter>
        </ActionRef>
      </Implementation>
      <Designer X="200" Y="600" Hidden="false" />
    </Activity>
    <Activity Name="HighProrityProcessing" State="HighProrityProcessing" IsInitial="false" IsFinal="false" IsForSetState="false" IsAutoSchemeUpdate="true">
      <Implementation>
        <ActionRef Order="1" NameRef="SendMessageToProcessConsoleAsync">
          <ActionParameter><![CDATA[**Issue is high priority processing.**\nIn Division: @Division\nDescription: @Description\nComment: @Comment]]></ActionParameter>
        </ActionRef>
      </Implementation>
      <Designer X="480" Y="670" Hidden="false" />
    </Activity>
  </Activities>
  <Transitions>
    <Transition Name="Processing_Resolved_1" To="Resolved" From="HighProrityProcessing" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Restrictions>
        <Restriction Type="Allow" NameRef="supporter" />
        <Restriction Type="Allow" NameRef="manager" />
      </Restrictions>
      <Triggers>
        <Trigger Type="Command" NameRef="resolve" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="393" Y="706.0000060104956" Hidden="false" />
    </Transition>
    <Transition Name="Processing_Rejected_1" To="Rejected" From="HighProrityProcessing" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Restrictions>
        <Restriction Type="Allow" NameRef="supporter" />
        <Restriction Type="Allow" NameRef="manager" />
      </Restrictions>
      <Triggers>
        <Trigger Type="Command" NameRef="reject" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="693.158203125" Y="792.9999997853395" Hidden="false" />
    </Transition>
    <Transition Name="Processing_Activity_1" To="Calculating priority" From="Processing" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Triggers>
        <Trigger Type="Auto" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="409" Y="207.99999942757188" Hidden="false" />
    </Transition>
    <Transition Name="Decision_Calculating priority_1" To="HighProrityProcessing" From="High Priority?" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Triggers>
        <Trigger Type="Auto" />
      </Triggers>
      <Conditions>
        <Condition Type="Expression" ConditionInversion="false">
          <Expression><![CDATA[@HighPriority]]></Expression>
        </Condition>
      </Conditions>
      <Designer Hidden="false" />
    </Transition>
    <Transition Name="Decision_Calculating priority_2" To="CommonProcessing" From="High Priority?" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Triggers>
        <Trigger Type="Auto" />
      </Triggers>
      <Conditions>
        <Condition Type="Otherwise" />
      </Conditions>
      <Designer Hidden="false" />
    </Transition>
    <Transition Name="Calculating priority_Decision_1" To="High Priority?" From="Calculating priority" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Triggers>
        <Trigger Type="Auto" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="416" Y="367.99999978533947" Hidden="false" />
    </Transition>
    <Transition Name="CommonProcessing_Processing_1" To="Calculating priority" From="CommonProcessing" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Restrictions>
        <Restriction Type="Allow" NameRef="supporter" />
      </Restrictions>
      <Triggers>
        <Trigger Type="Command" NameRef="redirect" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="222" Y="283.0000126649729" Hidden="false" />
    </Transition>
    <Transition Name="HighProrityProcessing_Processing_1" To="Calculating priority" From="HighProrityProcessing" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Restrictions>
        <Restriction Type="Allow" NameRef="supporter" />
        <Restriction Type="Allow" NameRef="manager" />
      </Restrictions>
      <Triggers>
        <Trigger Type="Command" NameRef="redirect" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="596.158203125" Y="286.00001495468547" Hidden="false" />
    </Transition>
    <Transition Name="CommonProcessing_Resolved_1" To="Resolved" From="CommonProcessing" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Restrictions>
        <Restriction Type="Allow" NameRef="supporter" />
      </Restrictions>
      <Triggers>
        <Trigger Type="Command" NameRef="resolve" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="232" Y="755.9999999284464" Hidden="false" />
    </Transition>
    <Transition Name="CommonProcessing_Rejected_1" To="Rejected" From="CommonProcessing" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false">
      <Restrictions>
        <Restriction Type="Allow" NameRef="supporter" />
      </Restrictions>
      <Triggers>
        <Trigger Type="Command" NameRef="reject" />
      </Triggers>
      <Conditions>
        <Condition Type="Always" />
      </Conditions>
      <Designer X="460" Y="782.9999979965014" Hidden="false" />
    </Transition>
  </Transitions>
  <CodeActions>
    <CodeAction Name="Supporter" Type="RuleGet" IsGlobal="False" IsAsync="False">
      <ActionCode><![CDATA[var division = processInstance.GetParameter<string>("Division");

return WorkflowLib.Users.Data.Where(u => u.Division == division).Select(u => u.Name).ToList();]]></ActionCode>
    </CodeAction>
    <CodeAction Name="Calculate Priority" Type="Action" IsGlobal="False" IsAsync="False">
      <ActionCode><![CDATA[var description = processInstance.GetParameter<string>("Description").ToLower();

if (description.Contains("urgent") 
    || (description.Contains("high") && description.Contains("priority"))
    || description.Contains("emergency"))
    {
        processInstance.SetParameter("HighPriority", true);
    }
else
    {
         processInstance.SetParameter("HighPriority", false);
    }
]]></ActionCode>
    </CodeAction>
    <CodeAction Name="Throw Exception" Type="Action" IsGlobal="False" IsAsync="False">
      <ActionCode><![CDATA[if (processInstance.GetParameter<bool>("ThrowError"))
{
    throw new Exception("Error!");
}]]></ActionCode>
    </CodeAction>
  </CodeActions>
  <CodeActionsCommonUsings><![CDATA[System.Threading;System;System.Linq;System.Collections;Microsoft.CSharp.RuntimeBinder;OptimaJet.Workflow.Core.Model;System.Collections.Generic;OptimaJet.Workflow.Core.Runtime;OptimaJet.Workflow;System.Dynamic;Microsoft.CSharp;System.Threading.Tasks;]]></CodeActionsCommonUsings>
</Process>