<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Stephen White (private) -->
<process name="E-Mail Voting Process">
	<context>
		<property name="NumVWGM">
			<value>10</value>
		</property>
		<property name="VotedOnce">
			<value>false</value>
		</property>
		<property name="NoMajority">
			<value>true</value>
		</property>
		<property name="DiscussionOver">
			<value>false</value>
		</property>
		<property name="NumIssues">
			<value>0</value>
		</property>
		<property name="NumVoted">
			<value>0</value>
		</property>
		<property name="VotersWarned">
			<value>false</value>
		</property>
		<property name="ConCall">
			<value>false</value>
		</property>
	</context>
	<sequence>
		<!-- This starts the beginning of the Process.-->
		<action name="Review Issue List" portType="tns:internalPort" operation="sendIssueList">
			<output part="NumIssues" xpath="..."/>
		</action>
		<switch name="Any Issues Ready?">
			<case name="Yes" condition="NumIssues > 0">
				<!--	A chunk of this process is separated into a derived nested process so that it can be called from a complex loop. -->
				<call name="DerivedProcess1"/>
			</case>
			<default name="Default">
				<!--	This is one of the two ways to the end of the Process. -->
				<empty/>
			</default>
		</switch>
	</sequence>
	<process name="DerivedProcess1">
		<until condition="DiscussionOver">
			<!--	This calls the first Sub-Process.	-->
			<call process="Discussion Cycle"/>
		</until>
		<call process="DerivedProcess2"/>
	</process>
	<process name="DerivedProcess2">
		<!-- This starts the middle section of the process. -->
		<action name="Announce Issues for Vote" portType="tns:emailPort" operation="sendVoteAnnouncement"/>
		<call process="DerivedProcess3"/>
	</process>
	<process name="DerivedProcess3">
		<!--	this calls the second Sub-Process. After the Collect Votes Sub-Process times out, the rest of the process will be in the onTimeout event handler of that process. Calls from there will loop back into other processes.	-->
		<call name="Collect Votes" process="Collect Votes"/>
	</process>
	<process name="DerivedProcess4">
		<switch name="Issues w/o Majority?">
			<case name="Yes" condition="NoMajority = true">
				<switch name="2nd Time?">
					<case name="Yes" condition="VotedOnce = true">
						<!--	This is done to do the complex looping situation. -->
						<!--	This is done for the complex looping situation. -->
						<call process="DerivedProcess1"/>
					</case>
					<default name="No (default)">
						<all>
							<action name="Reduce to Two Solutions" portType="tns:internalPort" operation="sendReceiveSolutions">
								<output part="NoMajority" xpath="..."/>
							</action>
							<action name="E-Mail Voters that have to Change Votes" portType="tns:emailPort" operation="sendVoteWarning"/>
							<!--	This is done for the complex looping situation. -->
							<call process="DerivedProcess2"/>
						</all>
					</default>
				</switch>
			</case>
			<default name="No (default)">
				<!--	This is one of the two ways to the end of the Process. -->
				<empty/>
			</default>
		</switch>
	</process>
	<process name="Discussion Cycle">
		<!--	This defines the first Sub-Process. -->
		<action name="Announce Issues for Discussion" portType="tns:emailPort" operation="sendDiscussionAnnouncement"/>
		<all>
			<call process="Moderate E-mail Discussion"/>
			<sequence>
				<delay name="Delay 6 days from Discussion Announcement" duration="P6D" reference="bpml:start($Discussion Cycle)"/>
				<action name="E-Mail Discussion Deadline Warning" portType="tns:emailPort" operation="sendDiscussionWarning"/>
			</sequence>
			<sequence>
				<action name="Check Calendar for Conference Call" portType="tns:internalPort" operation="receiveCallSchedule">
					<output part="ConCall" xpath="…"/>
				</action>
				<switch name="Conference Call in Discussion Week?">
					<case name="Yes" condition="ConCall = true">
						<delay name="Wait until Thursday, 9am" duration="P6DT9H"/>
						<action name="Moderate Conference Call Discussion" portType="tns:internalPort" operation="sendConCall"/>
						<raise name="No Call" signal="No Call"/>
					</case>
					<default name="Default">
						<raise signal="Call"/>
					</default>
				</switch>
			</sequence>
		</all>
	</process>
	<process name="Moderate E-mail Discussion">
		<action name="Moderate E-mail Discussion" portType="tns:internalPort" operation="sendDiscussion"/>
		<context>
			<exception>
				<onTimeout property="tns:OneWeek" type="duration">
					<action name="Review Status of Discussion" portType="tns:internalPort" operation="receiveDiscussionStatus">
						<output part="DiscussionOver" xpath="…"/>
					</action>
				</onTimeout>
			</exception>
		</context>
	</process>
	<process name="Collect Votes">
		<!--	This is a nested process for the E-Mail Voting collection. It consists of an all and a timeout event handler. The all will never complete normally since there is an 
		infinite loop inside. The timeout is intended to be the normal way of ending the process. -->
		<all>
			<!--	This is the first of the four paths of the fork. -->
			<choice name="Conference Call this Week?">
				<onSynch>
					<synch name="Call" signal="Call"/>
					<action name="Moderate Conference Call Discussion" portType="tns:internalPort" operation="sendConCall"/>
					<raise name="No Call" signal="No Call"/>
				</onSynch>
				<onSynch>
					<synch name="No Call" signal="No Call"/>
					<raise name="Call" signal="Call"/>
				</onSynch>
			</choice>
			<!--	This is the second of the four paths of the fork. -->
			<action name="Moderate E-Mail Discussion" portType="tns:internalPort" operation="sendDiscussion"/>
			<!--	This is the third of the four paths of the fork. 	-->
			<sequence>
				<delay name="Delay 6 days from Vote Announcement" duration="P6D" reference="bpml:start($Collect Votes)"/>
				<action name="E-Mail Vote Deadline Warning" portType="tns:emailPort" operation="sendVoteWarning"/>
			</sequence>
			<!--	This is the fourth of the four paths of the fork. This branch of the all is intended to be an infinite loop that is eventually interrupted by the Time Out.  This is necessary since any voter can change their vote until the deadline.-->
			<until condition="1=0">
				<action name="Receive Vote" portType="tns:emailPort" operation="receiveVote"/>
				<action name="Increment Tally" portType="tns:internalPort" operation="sendReceiveTotal">
					<output part="AllItemsCompleted" xpath="..."/>
					<output part="NoMajority" xpath="..."/>
				</action>
			</until>
		</all>
		<context>
			<onTimeout property="tns:OneWeek" type="duration">
				<!--	The BPMN diagram shows that the Timer Intermediate Event connects directly to the rest of the Process. Thus, they will show up in this activity set. -->
				<action name="Prepare Results" portType="tns:internalPort" operation="sendReceiveResults">
					<output part="NumVoted" xpath="..."/>
					<output part="NoMajority" xpath="..."/>
				</action>
				<action name="E-Mail Results of Vote" portType="tns:emailPort" operation="sendVotingResults"/>
				<switch name="Did Enough Members Vote?">
					<case name="No" condition="NumVoted>(.7)*(NumVWGM)">
						<switch name="Have the members been warned?">
							<case name="Yes" condition="VotersWarned=true">
								<action name="Reduce number of Voting Members and Recalculate Vote" portType="tns:internalPort" operation="sendReceiveNumVoters"/>
								<!--	Some elements of the process were separated into a derived nested process since they would have been repeated. They would have been repeated because they are arrived by alternative paths that do not close a set of alternative paths. -->
								<!--	This is done for the complex looping situation. -->
								<call process="DerivedProcess4"/>
							</case>
							<default name="No (default)">
								<action name="Re-announce Vote with warning to voting members" portType="tns:emailPort" operation="sendReannounceVote">
									<output part="VotersWarned" xpath="..."/>
								</action>
								<!--	This is done for the complex looping situation. -->
								<call process="DerivedProcess3"/>
							</default>
						</switch>
					</case>
					<default name="Yes (default)">
						<!--	Some elements of the process were separated into a derived nested process since they would have been repeated. They would	have been repeated because they are arrived by alternative paths that do not close a set of alternative paths.	-->
						<!--	This is done for the complex looping situation. -->
						<call process="DerivedProcess4"/>
					</default>
				</switch>
			</onTimeout>
		</context>
	</process>
</process>

