<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by Stephen A. White (Web Services Architecture WG) -->
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Stephen White (private) -->
<package>
	<!-- a package element wraps the processes so that they can be presented in one document -->
	<!-- The Main Process -->
	<process name="E-Mail Voting Process">
		<containers>
			<container name="processData" messageType="processDataMessage"/>
		</containers>
		<sequence>
			<!--This starts the beginning of the Process.-->
			<invoke name="Review Issue List" partner="Internal" portType="tns:internalPort" operation="sendIssueList" inputContainer="processData" outputContainer="processData"/>
			<switch name="Any Issues Ready?">
				<!--name="Yes" -->
				<case condition="bpws:getContainerProperty(processData,NumIssues) > 0">
					<!-- A chunk of this process is separated into a derived process so that it can be called from a complex loop. -->
					<invoke name="DerivedProcess1" partner="Internal" portType="tns:processPort" operation="callDerivedProcess1" inputContainer="processData"/>
				</case>
				<!--name="otherwise" -->
				<otherwise>
					<!--This is one of the two ways to the end of the Process.-->
					<empty/>
				</otherwise>
			</switch>
		</sequence>
	</process>
	<!-- A Derived Process -->
	<process name="DerivedProcess1">
		<containers>
			<container name="processData" messageType="processDataMessage"/>
		</containers>
		<sequence>
			<receive partner="Internal" portType="tns:processPort" operation="callDerivedProcess1" container="processData" createInstance="Yes"/>
			<while condition="bpws:getContainerProperty(processData,DiscussionOver) = false">
				<!-- This calls the first Sub-Process. -->
				<invoke name="Discussion Cycle" partner="Internal" portType="tns:processPort" operation="callDiscussionCycle" inputContainer="processData" outputContainer="processData"/>
			</while>
			<invoke name="DerivedProcess2" partner="Internal" portType="tns:processPort" operation="callDerivedProcess2" inputContainer="processData"/>
		</sequence>
	</process>
	<!-- A Derived Process -->
	<process name="DerivedProcess2">
		<!-- This starts the middle section of the process. -->
		<containers>
			<container name="processData" messageType="processDataMessage"/>
		</containers>
		<sequence>
			<receive partner="Internal" portType="tns:processPort" operation="callDerivedProcess2" container="processData" createInstance="Yes"/>
			<invoke name="Announce Issues for Vote" partner="WGVoter" portType="tns:emailPort" operation="sendVoteAnnouncement" inputContainer="processData"/>
			<invoke name="DerivedProcess3" partner="Internal" portType="tns:processPort" operation="callDerivedProcess3" inputContainer="processData"/>
		</sequence>
	</process>
	<!-- A Derived 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. -->
		<containers>
			<container name="processData" messageType="processDataMessage"/>
		</containers>
		<sequence>
			<receive partner="Internal" portType="tns:processPort" operation="callDerivedProcess3" container="processData" createInstance="Yes"/>
			<invoke name="Collect Votes" partner="Internal" portType="tns:processPort" operation="callCollectVotes" inputContainer="processData"/>
		</sequence>
	</process>
	<!-- A Derived Process -->
	<process name="DerivedProcess4">
		<containers>
			<container name="processData" messageType="processDataMessage"/>
		</containers>
		<sequence>
			<receive partner="Internal" portType="tns:processPort" operation="callDerivedProcess4" container="processData" createInstance="Yes"/>
			<switch name="Issues w/o Majority?">
				<case name="Yes" condition="NoMajority = true">
					<switch name="2nd Time?">
						<!-- name="Yes"  -->
						<case condition="bpws:getContainerProperty(processData,VotedOnce) = true">
							<!--	This is done for the complex looping situation. -->
							<invoke name="DerivedProcess1" partner="Internal" portType="tns:processPort" operation="callDerivedProcess1" inputContainer="processData"/>
						</case>
						<!-- name="No (otherwise)"  -->
						<otherwise>
							<sequence>
								<flow>
									<invoke name="Reduce to Two Solutions" partner="internal" portType="tns:internalPort" operation="sendReceiveSolutions" inputContainer="processData" outputContainer="processData"/>
									<invoke name="E-Mail Voters that have to Change Votes" partner="WGVoter" portType="tns:emailPort" operation="sendVoteWarning" inputContainer="processData"/>
								</flow>
								<!--	This is done for the complex looping situation. -->
								<invoke process="DerivedProcess2" partner="Internal" portType="tns:processPort" operation="callDerivedProcess2" inputContainer="processData"/>
							</sequence>
						</otherwise>
					</switch>
				</case>
				<otherwise name="No (otherwise)">
					<!-- This is one of the two ways to the end of the Process. -->
					<empty/>
				</otherwise>
			</switch>
		</sequence>
	</process>
	<!-- A User Built Process -->
	<process name="Discussion Cycle">
		<!--	This defines the first Sub-Process. -->
		<containers>
			<container name="processData" messageType="processDataMessage"/>
		</containers>
		<sequence>
			<receive partner="Internal" portType="tns:processPort" operation="callDiscussionCycle" container="processData" createInstance="Yes"/>
			<invoke name="Announce Issues for Discussion" partner="WGVoter" portType="tns:emailPort" operation="sendDiscussionAnnouncement" inputContainer="processData"/>
			<flow>
				<links>
					<link name="Delay 6 days from Discussion Announcement to E-Mail Discussion Deadline Warning"/>
					<link name="Check Calendar for Conference Call to Wait until Thursday, 9am"/>
					<link name="Check Calendar for Conference Call to Call"/>
					<link name="Wait until Thursday, 9am to Moderate Conference Call Discussion"/>
					<link name="Moderate Conference Call Discussion to No Call"/>
				</links>
				<!-- This is the first of the three paths of the fork. -->
				<scope>
					<flow>
						<invoke name="Moderate E-mail Discussion" partner="internal" portType="tns:internalPort" operation="sendDiscussion" inputContainer="processData" outputContainer="processData"/>
						<sequence>
							<wait name="7 days" for="P7D"/>
							<throw faultName="7 days_fault"/>
						</sequence>
					</flow>
					<faultHander>
						<catch faultName="7 days_fault">
							<invoke name="Review Status of Discussion" partner="internal" portType="tns:internalPort" operation="receiveDiscussionStatus" inputContainer="processData" outputContainer="processData"/>
						</catch>
					</faultHander>
				</scope>
				<!-- This is the second of the three paths of the fork. -->
				<wait name="Delay 6 days from Discussion Announcement" for="P6D">
					<target linkName="Delay 6 days from Discussion Announcement to E-Mail Discussion Deadline Warning"/>
				</wait>
				<invoke name="E-Mail Discussion Deadline Warning" partner="WGVoter" portType="tns:emailPort" operation="sendDiscussionWarning" inputContainer="processData">
					<source linkName="Delay 6 days from Discussion Announcement to E-Mail Discussion Deadline Warning"/>
				</invoke>
				<!-- This is the third of the three paths of the fork. -->
				<invoke name="Check Calendar for Conference Call" partner="internal" portType="tns:internalPort" operation="receiveCallSchedule" inputContainer="processData" outputContainer="processData">
					<target linkName="Check Calendar for Conference Call to Wait until Thursday, 9am" transitionCondition="bpws:getContainerProperty(processData,conCall)=true"/>
					<target linkName="Check Calendar for Conference Call to Call" transitionCondition="(bpws:getContainerProperty(processData,conCall)=true)=false"/>
				</invoke>
				<!-- name="Yes" -->
				<wait name="Wait until Thursday, 9am" for="P6DT9H">
					<source linkName="Check Calendar for Conference Call to Wait until Thursday, 9am"/>
					<target linkName="Wait until Thursday, 9am to Moderate Conference Call Discussion"/>
				</wait>
				<invoke name="Moderate Conference Call Discussion" partner="internal" portType="tns:internalPort" operation="sendConCall" inputContainer="processData" outputContainer="processData">
					<source linkName="Wait until Thursday, 9am to Moderate Conference Call Discussion"/>
					<target linkName="Moderate Conference Call Discussion to No Call"/>
				</invoke>
				<!-- This is used as a message to be used for a pick in the "Collect Votes" process -->
				<invoke name="No Call" partner="internal" portType="tns:processlPort" operation="sendNo_Call" inputContainer="processData">
					<source linkName="Moderate Conference Call Discussion to No Call"/>
				</invoke>
				<!-- name="otherwise" -->
				<!-- This is used as a message to be used for a pick in the "Collect Votes" process -->
				<invoke name="Call" partner="internal" portType="tns:processlPort" operation="sendCall" inputContainer="processData">
					<source linkName="Check Calendar for Conference Call to Call"/>
				</invoke>
			</flow>
		</sequence>
	</process>
	<!-- A User Built Process -->
	<process name="Collect Votes">
		<!--	This is a 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. -->
		<containers>
			<container name="processData" messageType="processDataMessage"/>
		</containers>
		<sequence>
			<receive partner="Internal" portType="tns:processPort" operation="callCollectVotes" container="processData" createInstance="Yes"/>
			<scope>
				<flow>
					<sequence>
						<wait name="7 days" for="P7D"/>
						<throw faultName="7 days_fault"/>
					</sequence>
					<flow>
						<links>
							<link name="Delay 6 days from Vote Announcement to E-Mail Vote Deadline Warning"/>
						</links>
						<!--	This is the first of the four paths of the fork. -->
						<pick name="Conference Call this Week?">
							<!-- name="Call"  -->
							<onMessage partner="internal" portType="tns:processlPort" operation="sendCall" Container="processData">
								<invoke name="Moderate Conference Call Discussion" partner="internal" portType="tns:internalPort" operation="sendConCall" inputContainer="processData" outputContainer="processData"/>
								<invoke name="No Call" partner="internal" portType="tns:processlPort" operation="sendNo_Call" inputContainer="processData"/>
							</onMessage>
							<!-- name="No Call"  -->
							<onMessage partner="internal" portType="tns:processlPort" operation="sendNo_Call" Container="processData">
								<invoke name="Call" partner="internal" portType="tns:processlPort" operation="sendCall" inputContainer="processData"/>
							</onMessage>
						</pick>
						<!-- This is the second of the four paths of the fork. -->
						<invoke name="Moderate E-Mail Discussion" partner="internal" portType="tns:internalPort" operation="sendDiscussion" inputContainer="processData" outputContainer="processData"/>
						<!--	This is the third of the four paths of the fork. 	-->
						<wait name="Delay 6 days from Vote Announcement" for="P6D">
							<target linkName="Delay 6 days from Vote Announcement to E-Mail Vote Deadline Warning"/>
						</wait>
						<invoke name="E-Mail Vote Deadline Warning" partner="WGVoter" portType="tns:emailPort" operation="sendVoteWarning" inputContainer="processData">
							<source linkName="Delay 6 days from Vote Announcement to E-Mail Vote Deadline Warning"/>
						</invoke>
						<!--	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. -->
						<while condition="1=0">
							<sequence>
								<receive name="Receive Vote" partner="WGVoter" portType="tns:emailPort" operation="receiveVote" container="processData"/>
								<invoke name="Increment Tally" partner="internal" portType="tns:internalPort" operation="sendReceiveTotal" inputContainer="processData" outputContainer="processData"/>
							</sequence>
						</while>
					</flow>
				</flow>
				<faultHander>
					<catch faultName="7 days_fault">
						<!-- 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. -->
						<sequence>
							<invoke name="Prepare Results" partner="internal" portType="tns:internalPort" operation="sendReceiveResults" inputContainer="processData" outputContainer="processData"/>
							<invoke name="E-Mail Results of Vote" partner="WGVoter" portType="tns:emailPort" operation="sendVotingResults" inputContainer="processData"/>
							<switch name="Did Enough Members Vote?">
								<!-- name="No" -->
								<case condition="bpws:getContainerProperty(processData,NumVoted)>(.7)*(bpws:getContainerProperty(processData,NumVWGM))">
									<switch name="Have the members been warned?">
										<!-- name="Yes" -->
										<case condition="bpws:getContainerProperty(processData,VotersWarned)=true">
											<sequence>
												<invoke name="Reduce number of Voting Members and Recalculate Vote" partner="internal" portType="tns:internalPort" operation="sendReceiveNumVoters" inputContainer="processData" outputContainer="processData"/>
												<!--	Some elements of the process were separated into a derived 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. -->
												<invoke name="DerivedProcess4" partner="Internal" portType="tns:processPort" operation="callDerivedProcess4" inputContainer="processData"/>
											</sequence>
										</case>
										<!-- name="No (otherwise)" -->
										<otherwise>
											<sequence>
												<invoke name="Re-announce Vote with warning to voting members" partner="WGVoter" portType="tns:emailPort" operation="sendReannounceVote" inputContainer="processData" outputContainer="processData"/>
												<!--	This is done for the complex looping situation. -->
												<invoke name="DerivedProcess3" partner="Internal" portType="tns:processPort" operation="callDerivedProcess3" inputContainer="processData"/>
											</sequence>
										</otherwise>
									</switch>
								</case>
								<!-- name="Yes (otherwise)" -->
								<otherwise>
									<!-- Some elements of the process were separated into a derived 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. -->
									<invoke process="DerivedProcess4" partner="Internal" portType="tns:processPort" operation="callDerivedProcess4" inputContainer="processData"/>
								</otherwise>
							</switch>
						</sequence>
					</catch>
				</faultHander>
			</scope>
		</sequence>
	</process>
</package>

