<?xml version="1.0" encoding="UTF-8"?>
<xml-inputs xmlns="http://axelor.com/xml/ns/data-import"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/data-import http://axelor.com/xml/ns/data-import/data-import_5.2.xsd">
	
	<input file="bpm_appBuilder.xml" root="app-builders">
		<bind node="app-builder" type="com.axelor.studio.db.AppBuilder"  call="com.axelor.studio.service.ImportService:importAppBuilderImg">
 			<bind node="name" to="name" />
 			<bind node="code" to="code" />
 			<bind node="description" to="description" />
 			<bind node="sequence" to="sequence" />
			<bind node="depends" alias="depends" />
			<bind to="dependsOnSet" alias="deps"  search="self.code in :deps"  eval="depends.split(',') as List" update="true"  />
			<bind node="image/@name" alias="fileName"/>
 			<bind node="image" alias="imageData" />
 		</bind>
	</input>
	
	<input file="bpm_metaJsonModel.xml" root="json-models">
		<bind node="json-model" type="com.axelor.meta.db.MetaJsonModel" call="com.axelor.studio.service.ImportService:importMetaJsonModel">
			<bind node="@name" to="name" />
			<bind node="@title" to="title" />
			<bind node="@appBuilder" to="appBuilder" search="self.code = :appBuilder"  />
			<bind node="fields/field" to="fields">
				<bind node="@name" to="name"/>
				<bind node="@title" to="title" />
				<bind node="@type" to="type" />
				<bind node="@target-model" to="targetModel"/>
				<bind node="@target-json-model" alias="targetJsonModel" to="targetJsonModel" search="self.name = :targetJsonModel" update="true"/>
				<bind node="@required" to="required"/>
				<bind node="@domain" to="domain"/>
				<bind to="model" eval="'com.axelor.meta.db.MetaJsonRecord'" />
				<bind to="modelField" eval="'attrs'" />
				<bind node="@sequence" to="sequence"/>
				<bind node="@onChange" to="onChange" />
				<bind node="@visibleInGrid" to="visibleInGrid" />
			</bind>
		</bind>
		
		<bind node="json-field" type="com.axelor.meta.db.MetaJsonField" call="com.axelor.studio.service.ImportService:importMetaJsonField">
			<bind node="@name" to="name" />
			<bind node="@title" to="title" />
			<bind node="@type" to="type" />
			<bind node="@model" to="model" />
			<bind node="@modelField" to="modelField" />
			<bind node="@onClick" to="onClick" />
			<bind node="@target-json-model" alias="targetJsonModel" to="targetJsonModel" search="self.name = :targetJsonModel" update="true"/>
			<bind node="@jsonModel" to="jsonModel" search="self.name = :jsonModel" update="true" />
			<bind node="@sequence" to="sequence"/>
			<bind node="@onChange" to="onChange" />
			<bind node="@appBuilder" to="appBuilder" search="self.code = :appBuilder"  />
			<bind node="@showIf" to="showIf" />
		</bind>
	</input>
	
	<input file="bpm_chartBuilder.xml" root="chart-builders">
		<bind node="chart-builder" type="com.axelor.studio.db.ChartBuilder" call="com.axelor.studio.service.ImportService:importChartBuilder">
			<bind node="@name" to="name" />
			<bind node="@title" to="title" />
			<bind node="@type" to="chartType" />
			<bind node="@json" to="isJson" />
			<bind node="@model" to="model" alias="_model"/>
			<bind node="@appBuilder" to="appBuilder" search="self.code = :appBuilder"  />
			<bind node="@groupOnJson" to="groupOnJson" search="self.name = :groupOnJson and self.jsonModel.name = :_model" />
			<bind node="@groupOn" to="groupOn" search="self.name = :groupOn and self.metaModel.fullName = :_model" />
			<bind node="@groupDateType" to="groupDateType" />
			<bind node="@groupOnTarget" to="groupOnTarget" />
			<bind node="@groupOnTargetType" to="groupOnTargetType" />
			<bind node="@isJsonGroupOn" to="isJsonGroupOn" />
			<bind node="@isJsonAggregateOn" to="isJsonAggregateOn" />
			<bind node="@isJsonDisplayField" to="isJsonDisplayField" />
			<bind node="@aggregateOnJson" to="aggregateOnJson" search="self.name = :aggregateOnJson and self.jsonModel.name = :_model" />
			<bind node="@aggregateOn" to="aggregateOn" search="self.name = :aggregateOn and self.metaModel.fullName = :_model" />
			<bind node="@aggregateOnTarget" to="aggregateOnTarget" />
			<bind node="@aggregateOnTargetType" to="aggregateOnTargetType" />
			<bind node="@displayFieldJson" to="displayFieldJson" search="self.name = :displayFieldJson and self.jsonModel.name = :_model" />
			<bind node="@displayField" to="displayField" search="self.name = :displayField and self.metaModel.fullName = :_model" />
			<bind node="filters/filter" to="filterList">
				<bind node="@json" to="isJson" />
				<bind node="@targetType" to="targetType" />
				<bind node="@operator" to="operator" />
				<bind node="@targetField" to="targetField"/>
				<bind node="@jsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :_model" />
				<bind node="@field" to="metaField" search="self.name = :metaField and self.metaModel.fullName = :_model" />
				<bind node="@value" to="value"/>
				<bind node="@isParameter" to="isParameter"/>
			</bind>
		</bind>
	</input>
	
	
	<input file="bpm_dashboardBuilder.xml" root="dashboard-builders">
		<bind node="dashboard-builder" type="com.axelor.studio.db.DashboardBuilder" call="com.axelor.studio.service.ImportService:importDashboardBuilder">
			<bind node="@name" to="name" />
			<bind node="@title" to="title" />
			<bind node="@appBuilder" to="appBuilder" search="self.code = :appBuilder"  />
			<bind node="dashlets/dashlet" to="dashletBuilderList">
				<bind node="@name" to="name" />
				<bind node="@sequence" to="sequence" />
				<bind node="@viewType" to="viewType" />
				<bind node="@colspan" to="colspan" />
				<bind node="@view" to="metaView" search="self.name = :metaView" />
			</bind>
		</bind>
	</input>
	
	<input file="bpm_menuBuilder.xml" root="menu-builders">
		<bind node="menu-builder" type="com.axelor.studio.db.MenuBuilder" call="com.axelor.studio.service.ImportService:importMenuBuilder">
			<bind node="@name" to="name" />
			<bind node="@title" to="title" />
			<bind node="@icon" to="icon" />
			<bind node="@background" to="iconBackground" />
			<bind node="@parent" to="parentMenu" search="self.name = :parentMenu" />
			<bind node="@show-action" to="showAction" />
			<bind node="@appBuilder" to="appBuilder" search="self.code = :appBuilder"  />
			<bind node="action" to="actionBuilder" if="actionName != null">
				<bind node="@name" to="name" alias="actionName"  />
				<bind node="@model" to="model" />
				<bind node="@isJson" to="isJson" />
				<bind node="@title" to="title" />
				<bind to="typeSelect" eval="3"/>
				<bind node="views/view" to="actionBuilderViews">
					<bind node="@type" to="viewType" />
					<bind node="@name" to="viewName" />
					<bind node="@sequence" to="sequence" />
				</bind>
				<bind node="@domain" to="domainCondition" />
				<bind node="context/ctx" to="lines">
					<bind node="@value" to="value" />
					<bind node="@name" to="name" />
				</bind>
			</bind>
		</bind>
	</input>
	
	<input file="bpm_actionBuilder.xml" root="action-builders">
		<bind node="action-builder" type="com.axelor.studio.db.ActionBuilder" call="com.axelor.studio.service.ImportService:importActionBuilder">
			<bind node="@name" to="name" />
			<bind node="@isJson" to="isJson" />
			<bind node="@typeSelect" to="typeSelect" />
			<bind node="@model" to="model" />
			<bind node="@targetModel" to="targetModel" />
			<bind node="@appBuilder" to="appBuilder" search="self.code = :appBuilder"  />
			<bind node="lines/line" to="lines">
				<bind node="@metaModel" to="metaModel" />
				<bind node="@valueModel" to="valueModel" />
				<bind node="@jsonModel" to="jsonModel" />
				<bind node="@valueJsonModel" to="valueJsonModel" />
				<bind node="@metaField" to="metaField" search="self.name = :metaField and self.metaModel.name = :metaModel" />
				<bind node="@valueField" to="valueField" search="self.name = :valueField and self.metaModel.name = :valueModel"  />
				<bind node="@jsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :jsonModel"  />
				<bind node="@valueJsonField" to="valueJson" search="self.name = :valueJson and self.jsonModel.name = :valueJsonModel"  />
				<bind node="@name" to="name" if="metaField == null &amp;&amp; metaJsonField == null"/>
				<bind node="@metaField" to="name" if="metaField != null"/>
				<bind node="@jsonField" to="name" if="metaJsonField != null"/>
				<bind node="@value" to="value"/>
				<bind node="@filter" to="filter"/>
				<bind node="@dummy" to="dummy"/>
				<bind node="subLines/line" to="subLines">
					<bind node="@metaModel" to="metaModel" />
					<bind node="@valueModel" to="valueModel" />
					<bind node="@jsonModel" to="jsonModel" />
					<bind node="@valueJsonModel" to="valueJsonModel" />
					<bind node="@metaField" to="metaField" search="self.name = :metaField and self.metaModel.name = :metaModel" />
					<bind node="@valueField" to="valueField" search="self.name = :valueField and self.metaModel.name = :valueModel"  />
					<bind node="@jsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :jsonModel"  />
					<bind node="@valueJsonField" to="valueJson" search="self.name = :valueJson and self.jsonModel.name = :valueJsonModel"  />
					<bind node="@name" to="name" if="metaField == null &amp;&amp; metaJsonField == null"/>
					<bind node="@metaField" to="name" if="metaField != null"/>
					<bind node="@jsonField" to="name" if="metaJsonField != null"/>
					<bind node="@value" to="value"/>
					<bind node="@filter" to="filter"/>
					<bind node="@dummy" to="dummy"/>
				</bind>
			</bind>
		</bind>
	</input>
	
	<input file="bpm_workflow.xml" root="wkfs" >
		<bind node="wkf" type="com.axelor.studio.db.Wkf">
			<bind node="@appBuilder" to="appBuilder" search="self.code = :appBuilder"  />
			<bind node="@name" to="name" />
			<bind node="@isJson" to="isJson" />
			<bind node="@model" to="model" />
			<bind node="@statusField" to="statusField" search="self.jsonModel.name = :model and self.name = :statusField" update="true" />
			<bind node="@displayTypeSelect" to="displayTypeSelect" />
			<bind node="xml" to="bpmnXml" />
		</bind>
		<bind node="wkfNode" type="com.axelor.studio.db.WkfNode">
			<bind node="@name" to="name" />
			<bind node="@title" to="title" />
			<bind node="@wkf" to="wkf" search="self.name = :wkf" update="true"/>
			<bind node="@sequence" to="sequence" />
			<bind node="@nodeType" to="nodeType" />
			<bind node="@xmlId" to="xmlId" />
		</bind>
		<bind node="transition" type="com.axelor.studio.db.WkfTransition">
			<bind node="@name" to="name" />
			<bind node="@wkf" to="wkf" search="self.name = :wkf" update="true"/>
			<bind node="@source" to="source" search="self.name = :source and self.wkf.name = :wkf" update="true"/>
			<bind node="@target" to="target" search="self.name = :target and self.wkf.name = :wkf" update="true"/>
			<bind node="@isButton" to="isButton" />
			<bind node="@buttonTitle" to="buttonTitle" />
			<bind node="@alertTypeSelect" to="alertTypeSelect" />
			<bind node="@alertMsg" to="alertMsg" />
			<bind node="@successMsg" to="successMsg" />
			<bind node="@xmlId" to="xmlId" />
		</bind>
		<bind node="node" type="com.axelor.studio.db.WkfNode" search="self.name = :nodeName and self.wkf.name = :wkf" update="true">
			<bind node="@wkf" to="wkf" search="self.name = :wkf" update="true" />
			<bind node="@name" to="name" alias="nodeName" />
			<bind node="incomings/incoming" to="incoming" search="self.name = :name and self.wkf.name = :wkf" update="true">
				<bind node="@name" to="name" />
			</bind>
			<bind node="outgoings/outgoing" to="outgoings" search="self.name = :name and self.wkf.name = :wkf" update="true">
				<bind node="@name" to="name" />
			</bind>
		</bind>
	</input>
	
	<input file="bpm_workflow.xml" root="wkfs" >
		<bind node="workflow" type="com.axelor.studio.db.Wkf" search="self.name = :name" update="true" call="com.axelor.studio.service.ImportService:importWkf">
			<bind node="@name" to="name" />
		</bind>
	</input>
	
	<input file="bpm_translation.xml" root="meta-translations" >
		<bind node="meta-translation" type="com.axelor.meta.db.MetaTranslation" search="self.key = :key and self.language = :language">
			<bind node="@key" to="key" />
			<bind node="@message" to="message" />
			<bind node="@language" to="language"/>
		</bind>
	</input>
	
</xml-inputs>