<RESOURCE_PROFILE>
	<HEADER>
		<RESOURCE_IDENTIFIER value="f236f97a-199f-4f9a-80c8-0e356077e1d6_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ=="/>
		<RESOURCE_TYPE value="WorkflowTemplateDSResourceType"/>
		<RESOURCE_KIND value="WorkflowTemplateDSResources"/>
		<RESOURCE_URI value=""/>
		<DATE_OF_CREATION value="2017-01-17T17:00:00.0Z"/>
	</HEADER>
	<BODY>
		<CONFIGURATION>
			<PARAMETERS>
				<PARAM name="OAIFormat" description="OAI Format" required="true" type="string"/>
				<PARAM name="OAILayout" description="OAI Layout" required="true" type="string"/>
				<PARAM name="OAIInterpretation" description="OAI Interpretation" required="true" type="string"/>
				<PARAM name="OAIDBName" description="OAI Database Name" required="true" type="string"/>
				<PARAM name="OAIConfiguredOnly" description="Count only configured OAI sets" required="true" type="boolean"/>
			</PARAMETERS>
			<!-- TODO: review the workflow after the integration of changes from DNet40 about the OAI implementation -->
			<WORKFLOW>
				<NODE name="createCompoundIndexes" type="OAICreateIndex" isStart="true">
					<DESCRIPTION>Create composite indexes for the OAI store</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="oaiFormat" ref="OAIFormat"/>
						<PARAM name="oaiLayout" ref="OAILayout"/>
						<PARAM name="oaiInterpretation" ref="OAIInterpretation"/>
						<PARAM name="oaiDbName" ref="OAIDBName"/>
						<PARAM name="fieldNames" value="set,datestamp"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="createConfigIndexes"/>
					</ARCS>
				</NODE>
				<NODE name="createConfigIndexes" type="OAIEnsureIndexes">
					<DESCRIPTION>Ensure an index exists on fields as specified in the configuration profile</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="oaiFormat" ref="OAIFormat"/>
						<PARAM name="oaiLayout" ref="OAILayout"/>
						<PARAM name="oaiInterpretation" ref="OAIInterpretation"/>
						<PARAM name="oaiDbName" ref="OAIDBName"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="refreshConfigSets"/>
					</ARCS>
				</NODE>
				<NODE name="refreshConfigSets" type="OAIRefreshConfiguration">
					<DESCRIPTION>Reads the current OAI configuration and upsert OAI sets accordingly</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="oaiFormat" ref="OAIFormat"/>
						<PARAM name="oaiLayout" ref="OAILayout"/>
						<PARAM name="oaiInterpretation" ref="OAIInterpretation"/>
						<PARAM name="oaiDbName" ref="OAIDBName"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="updateSetsCount"/>
					</ARCS>
				</NODE>
				<NODE name="updateSetsCount" type="OAISetsCountUpdate">
					<DESCRIPTION>Count records in each OAI set, for each exported metadata format linked to the given oai collection</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="oaiFormat" ref="OAIFormat"/>
						<PARAM name="oaiLayout" ref="OAILayout"/>
						<PARAM name="oaiInterpretation" ref="OAIInterpretation"/>
						<PARAM name="oaiDbName" ref="OAIDBName"/>
						<PARAM name="configuredOnly" ref="OAIConfiguredOnly"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="success"/>
					</ARCS>
				</NODE>
			</WORKFLOW>
		</CONFIGURATION>
	</BODY>
</RESOURCE_PROFILE>
