<?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.xml" root="bpm" >
 		<bind node="appBuilder" type="com.axelor.studio.db.AppBuilder" search="self.code = :code" update="true" 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="image/@name" alias="fileName"/>
 			<bind node="image" alias="imageData" />
 		</bind>
 		<bind node="appBuilder" type="com.axelor.studio.db.AppBuilder" search="self.code = :code" create="false" update="true" call="com.axelor.studio.service.ImportService:importAppBuilder">
 			<bind node="code" to="code" />
			<bind node="depends" alias="depends" />
			<bind to="dependsOnSet" alias="deps"  search="self.code in :deps"  eval="depends != null ? depends.split(',') as List : []" create="false"/>
 		</bind>
 		<bind node="models/model" type="com.axelor.meta.db.MetaJsonModel" search="self.name = :name" update="true">
 			<bind node="name" to="name" />
            <bind node="title" to="title" />
            <bind node="onNew" to="onNew" />
            <bind node="onSave" to="onSave" />
            <bind node="menuTitle" to="menuTitle" />
            <bind node="menuIcon" to="menuIcon" />
            <bind node="menuBackground" to="menuBackground" />
            <bind node="menuOrder" to="menuOrder" />
            <bind node="menuTop" to="menuTop" />
            <bind node="menuParent" to="menuParent" search="self.id = :menuParent" create="false"  />
 			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false"  />
 		</bind>
 		<bind node="fields/field" type="com.axelor.meta.db.MetaJsonField"  if="jsonModel != null &amp;&amp; !jsonModel.empty"
 			search="self.name = :name and self.model = :model and self.modelField = :modelField and self.jsonModel.name = :jsonModel"
 			call="com.axelor.studio.service.ImportService:importJsonModelField" update="true">
 			<bind node="name" to="name" />
 			<bind node="title" to="title" />
 			<bind node="type" to="type" />
 			<bind node="defaultValue" to="defaultValue" />
 			<bind node="domain" to="domain" />
 			<bind node="enumType" to="enumType" />
 			<bind node="help" to="help" />
 			<bind node="formView" to="formView" />
 			<bind node="gridView" to="gridView" />
 			<bind node="hidden" to="hidden" />
 			<bind node="visibleInGrid" to="visibleInGrid" />
 			<bind node="hideIf" to="hideIf" />
 			<bind node="isWkf" to="isWkf" />
 			<bind node="maxSize" to="maxSize" />
 			<bind node="minSize" to="minSize" />
 			<bind node="model" to="model" />
 			<bind node="modelField" to="modelField" />
 			<bind node="nameField" to="nameField" />
 			<bind node="onChange" to="onChange" />
 			<bind node="onClick" to="onClick" />
 			<bind node="precision" to="precision" />
 			<bind node="regex" to="regex" />
 			<bind node="required" to="required" />
 			<bind node="requiredIf" to="requiredIf" />
 			<bind node="readonly" to="readonly" />
 			<bind node="scale" to="scale" />
 			<bind node="selection" to="selection" />
 			<bind node="sequence" to="sequence" />
 			<bind node="showIf" to="showIf" />
 			<bind node="targetModel" to="targetModel" />
 			<bind node="widget" to="widget" />
 			<bind node="widgetAttrs" to="widgetAttrs" />
 			<bind node="valueExpr" to="valueExpr"/>
 			<bind node="jsonModel" to="jsonModel" search="self.name = :jsonModel" update="true" alias="jsonModel" create="false" />
 			<bind node="targetJsonModel" to="targetJsonModel" search="self.name = :targetJsonModel" update="true" create="false" />
 			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false" />
 			<bind node="modelAppBuilder" alias="modelAppBuilder" />
 		</bind>
 		
 		<bind node="fields/field" type="com.axelor.meta.db.MetaJsonField"  if="jsonModel == null"
 			search="self.name = :name and self.model = :model and self.modelField = :modelField and self.jsonModel is null"
 			call="com.axelor.studio.service.ImportService:importJsonField" update="true">
 			<bind node="name" to="name" />
 			<bind node="title" to="title" />
 			<bind node="type" to="type" />
 			<bind node="defaultValue" to="defaultValue" />
 			<bind node="domain" to="domain" />
 			<bind node="enumType" to="enumType" />
 			<bind node="help" to="help" />
 			<bind node="formView" to="formView" />
 			<bind node="gridView" to="gridView" />
 			<bind node="hidden" to="hidden" />
 			<bind node="visibleInGrid" to="visibleInGrid" />
 			<bind node="hideIf" to="hideIf" />
 			<bind node="isWkf" to="isWkf" />
 			<bind node="maxSize" to="maxSize" />
 			<bind node="minSize" to="minSize" />
 			<bind node="model" to="model" />
 			<bind node="modelField" to="modelField" />
 			<bind node="nameField" to="nameField" />
 			<bind node="onChange" to="onChange" />
 			<bind node="onClick" to="onClick" />
 			<bind node="precision" to="precision" />
 			<bind node="regex" to="regex" />
 			<bind node="required" to="required" />
 			<bind node="requiredIf" to="requiredIf" />
 			<bind node="readonly" to="readonly" />
 			<bind node="scale" to="scale" />
 			<bind node="selection" to="selection" />
 			<bind node="sequence" to="sequence" />
 			<bind node="showIf" to="showIf" />
 			<bind node="targetModel" to="targetModel" />
 			<bind node="widget" to="widget" />
 			<bind node="widgetAttrs" to="widgetAttrs" />
 			<bind node="valueExpr" to="valueExpr"/>
 			<bind node="jsonModel" to="jsonModel" search="self.name = :jsonModel" update="true" create="false" />
 			<bind node="targetJsonModel" to="targetJsonModel" search="self.name = :targetJsonModel" update="true" create="false" />
 			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false"/>
 			<bind node="modelAppBuilder" alias="modelAppBuilder" create="false"/>
 		</bind>
 
 	</input>
 	
 	<input file="bpm.xml" root="bpm" >
 		
 		<bind node="models/model" type="com.axelor.meta.db.MetaJsonModel" search="self.name = :name" create="false" call="com.axelor.studio.service.ImportService:importAppMetaJsonModel"  update="true">
 			<bind node="name" to="name" />
 		</bind>
 		
 	</input>
 	
 	<input file="bpm.xml" root="bpm" >
 			
 		<bind node="selections/selection" type="com.axelor.meta.db.MetaSelect" search="self.name = :name" update="true">
 			<bind node="name" to="name"/>
 			<bind node="module" to="module"/>
 			<bind node="priority" to="priority"/>
 			<bind node="items/option" to="items">
 				<bind node="title" to="title"/>
 				<bind node="value" to="value"/>
 				<bind node="icon" to="icon"/>
 				<bind node="data" to="data"/>
 				<bind node="order" to="order"/>
 				<bind node="hidden" to="hidden"/>
 				<bind node="select" to="select" search="self.name = :select" create="false"/>
 			</bind>
 			<bind node="isCustom" to="isCustom"/>
 			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false" />
 		</bind>
 		
		<bind node="chartBuilders/chartBuilder" type="com.axelor.studio.db.ChartBuilder" search="self.name = :name" call="com.axelor.studio.service.ImportService:importChartBuilder" update="true">
			<bind node="name" to="name" />
			<bind node="title" to="title" />
			<bind node="chartType" to="chartType" />
			<bind node="isJson" to="isJson" />
			<bind node="model" to="model" alias="_model"/>
			<bind node="groupOn" to="groupOn" search="self.name = :groupOn and self.metaModel.fullName = :_model"  />
			<bind node="groupOnJson" to="groupOnJson" search="self.name = :groupOnJson and self.jsonModel.name = :_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" create="false" />
			<bind node="aggregateOn" to="aggregateOn" search="self.name = :aggregateOn and self.metaModel.fullName = :_model" create="false" />
			<bind node="aggregateOnTarget" to="aggregateOnTarget" />
			<bind node="aggregateDateType" to="aggregateDateType" />
			<bind node="aggregateOnTargetType" to="aggregateOnTargetType" />
			<bind node="displayField" to="displayField" search="self.name = :displayField and self.metaModel.fullName = :_model"  create="false"/>
			<bind node="displayFieldJson" to="displayFieldJson" search="self.name = :displayFieldJson and self.jsonModel.name = :_model" create="false" />
			<bind node="displayType" to="displayType" />
			<bind node="filters/filter" to="filterList">
				<bind node="metaField" to="metaField" search="self.name = :metaField and self.metaModel.fullName = :_model" create="false" />
				<bind node="metaJsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :_model" create="false" />
				<bind node="operator" to="operator" />
				<bind node="targetField" to="targetField"/>
				<bind node="targetType" to="targetType"/>
				<bind node="value" to="value"/>
				<bind node="defaultValue" to="defaultValue"/>
				<bind node="isParameter" to="isParameter"/>
				<bind node="isJson" to="isJson" />
				<bind node="isTargetJson" to="isTargetJson" />
				<bind node="logicOp" to="logicOp" />
			</bind>
			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false" />
		</bind>
 		
 		<bind node="dashboardBuilders/dashboardBuilder" type="com.axelor.studio.db.DashboardBuilder" search="self.name = :name" update="true">
			<bind node="name" to="name" />
			<bind node="title" to="title" />
			<bind node="model" to="model" />
			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false" />
		</bind>
		
		<bind node="dashletBuilders/dashletBuilder" type="com.axelor.studio.db.DashletBuilder" 
			search="self.name = :name and self.dashboardBuilder.name = :dashboardBuilder and (self.appBuilder.code = :appBuilder OR self.dashboardBuilder.appBuilder.code = :parentAppBuilder)" update="true">
			<bind node="name" to="name" />
			<bind node="metaView" to="metaView" search="self.name = :metaView" />
			<bind node="dashboardBuilder" to="dashboardBuilder" search="self.name = :dashboardBuilder" create="false" />
			<bind node="action" to="action" search="self.name = :action" create="false" />
			<bind node="sequence" to="sequence" />
			<bind node="viewType" to="viewType" />
			<bind node="colspan" to="colspan" />
			<bind node="paginationLimit" to="paginationLimit" />
			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false" />
			<bind node="parentAppBuilder" alias="parentAppBuilder" />
		</bind>
		
 	</input>		
 	
 	<input file="bpm.xml" root="bpm" >
 	
 		<bind node="dashboardBuilders/dashboardBuilder" type="com.axelor.studio.db.DashboardBuilder" search="self.name = :name" create="false" call="com.axelor.studio.service.ImportService:importAppDashboardBuilder" update="true">
			<bind node="name" to="name" />
		</bind>
		
	</input>
	
	<input file="bpm.xml" root="bpm" >
	
		<bind node="actionBuilders/actionBuilder" type="com.axelor.studio.db.ActionBuilder" search="self.name = :name" call="com.axelor.studio.service.ImportService:importActionBuilder" update="true">
			<bind node="name" to="name" />
			<bind node="typeSelect" to="typeSelect" alias="_type" />
			<bind node="model" to="model" alias="_model"/>
			<bind node="targetModel" to="targetModel" alias="_targetModel" />
			<bind node="title" to="title" />
			<bind node="transactional" to="transactional" />
			<bind node="scriptType" to="scriptType" />
			<bind node="scriptText" to="scriptText" />
			<bind node="actionBuilderViews/view" to="actionBuilderViews">
				<bind node="viewType" to="viewType" />
				<bind node="viewName" to="viewName" />
				<bind node="sequence" to="sequence" />
			</bind>
			<bind node="isJson" to="isJson" alias="_isJson" />
			<bind node="domainCondition" to="domainCondition" />
			<bind node="viewParams/line" to="viewParams">
				<bind node="name" to="name"/>
				<bind node="value" to="value"/>
			</bind>
			<bind node="menuAction" to="menuAction"/>
			<bind node="lines/line" to="lines">
				<bind node="target" alias="target" />
				<bind node="source" alias="source" />
				<bind node="metaJsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :target" create="false"/>
				<bind node="metaField" to="metaField" search="self.name = :metaField and self.metaModel.fullName = :target"  create="false"/>
				<bind node="valueJson" to="valueJson" search="self.name = :valueJson and self.jsonModel.name = :source" create="false" />
				<bind node="valueField" to="valueField" search="self.name = :valueField and self.metaModel.fullName = :source" create="false" />
				<bind node="value" to="value"/>
				<bind node="conditionText" to="conditionText"/>
				<bind node="filter" to="filter"/>
				<bind node="validationTypeSelect" to="validationTypeSelect"/>
				<bind node="validationMsg" to="validationMsg"/>
				<bind node="name" to="name"/>
				<bind node="dummy" to="dummy"/>
				<bind node="subLines/line" to="subLines">
					<bind node="target" alias="target" />
					<bind node="source" alias="source" />
					<bind node="metaJsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :target" create="false"/>
					<bind node="metaField" to="metaField" search="self.name = :metaField and (self.metaModel.fullName = :target OR self.metaModel.name = :target)" create="false" />
					<bind node="valueJson" to="valueJson" search="self.name = :valueJson and self.jsonModel.name = :source" create="false" />
					<bind node="valueField" to="valueField" search="self.name = :valueField and (self.metaModel.fullName = :source OR self.metaModel.fullName = :source)" create="false" />
					<bind node="value" to="value"/>
					<bind node="conditionText" to="conditionText"/>
					<bind node="filter" to="filter"/>
					<bind node="validationTypeSelect" to="validationTypeSelect"/>
					<bind node="validationMsg" to="validationMsg"/>
					<bind node="name" to="name"/>
					<bind node="dummy" to="dummy"/>
					<bind node="subLines/line" to="subLines">
						<bind node="target" alias="target" />
						<bind node="source" alias="source" />
						<bind node="metaJsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :target" create="false"/>
						<bind node="metaField" to="metaField" search="self.name = :metaField and (self.metaModel.fullName = :target OR self.metaModel.name = :target)" create="false" />
						<bind node="valueJson" to="valueJson" search="self.name = :valueJson and self.jsonModel.name = :source" create="false"/>
						<bind node="valueField" to="valueField" search="self.name = :valueField and (self.metaModel.fullName = :source OR self.metaModel.fullName = :source)" create="false" />
						<bind node="value" to="value"/>
						<bind node="conditionText" to="conditionText"/>
						<bind node="filter" to="filter"/>
						<bind node="validationTypeSelect" to="validationTypeSelect"/>
						<bind node="validationMsg" to="validationMsg"/>
						<bind node="name" to="name"/>
						<bind node="dummy" to="dummy"/>
					</bind>
				</bind>
			</bind>
			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false" />
		</bind>
		
		<bind node="menuBuilders/menuBuilder" type="com.axelor.studio.db.MenuBuilder" search="self.name = :name" call="com.axelor.studio.service.ImportService:importMenuBuilder"  update="true">
			<bind node="name" to="name" />
			<bind node="title" to="title" />
			<bind node="icon" to="icon" />
			<bind node="iconBackground" to="iconBackground" />
			<bind node="order" to="order" />
			<bind node="tag" to="tag" />
			<bind node="tagCount" to="tagCount" />
			<bind node="tagStyle" to="tagStyle" />
			<bind node="top" to="top" />
			<bind node="left" to="left" />
			<bind node="mobile" to="mobile" />
			<bind node="hidden" to="hidden" />
			<bind node="link" to="link" />
			<bind node="conditionToCheck" to="conditionToCheck" />
			<bind node="moduleToCheck" to="moduleToCheck" />
			<bind node="showAction" to="showAction" />
			<bind node="parentMenu" to="parentMenu" search="self.name = :parentMenu" />
			<bind node="actionBuilder" to="actionBuilder" search="self.name = :actionBuilder"/>
			<bind node="groups/group" to="groups" search="self.code = :groupCode" update="true" create="false" >
				<bind node="text()" to="code" alias="groupCode"/>
			</bind>
			<bind node="roles/role" to="roles" search="self.name = :roleName" update="true" create="false">
				<bind node="text()" to="name" alias="roleName"/>
			</bind>
			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false"/>
		</bind>
		
		<bind node="wkfs/wkf" type="com.axelor.studio.db.Wkf" search="self.name = :name" update="true">
			<bind node="name" to="name" />
			<bind node="model" to="model" />
			<bind node="isJson" to="isJson" alias="_isJson"/>
			<bind node="jsonField" to="jsonField" />
			<bind node="isTrackFlow" to="isTrackFlow"/>
			<bind node="statusField" to="statusField" search="self.jsonModel.name = :model and self.name = :statusField" if="_isJson == 'true'" create="false" />
			<bind node="statusField" to="statusField" search="self.model = :model and self.modelField = :jsonField and self.name = :statusField and self.jsonModel is null" if="_isJson == 'false'" create="false" />
			<bind node="displayTypeSelect" to="displayTypeSelect" />
			<bind node="bpmnXml" to="bpmnXml" />
			<bind node="appBuilder" to="appBuilder" search="self.code = :appBuilder" create="false"/>
		</bind>
		
		<bind node="nodes/node" type="com.axelor.studio.db.WkfNode" search="self.name = :name and self.wkf.name = :wkf" update="true">
			<bind node="wkf" to="wkf" search="self.name = :wkf" create="false"/>
			<bind node="name" to="name" />
			<bind node="title" to="title" />
			<bind node="xmlId" to="xmlId" />
			<bind node="sequence" to="sequence" />
			<bind node="nodeType" to="nodeType" />
			<bind node="metaFieldModel" alias="metaFieldModel" />
			<bind node="metaField" to="metaField" search="self.name = :metaField and self.metaModel.name = :metaFieldModel" create="false"/>
			<bind node="roleSet/role" to="roleSet" search="self.name = :roleName" update="false" create="false">
				<bind node="text()" to="name" alias="roleName"/>
			</bind>
			<bind node="metaActionSet/action" to="metaActionSet" search="self.name = :actionName" update="false" create="false">
				<bind node="text()" to="name" alias="actionName"/>
			</bind>
		</bind>
		
		<bind node="nodes/node" type="com.axelor.studio.db.WkfNode" search="self.name = :name and self.wkf.name = :wkf" update="true" create="false">
			<bind node="wkf" to="wkf" search="self.name = :wkf" create="false"/>
			<bind node="name" to="name" />
			<bind node="title" to="title" />
			<bind node="xmlId" to="xmlId" />
			<bind node="sequence" to="sequence" />
			<bind node="nodeType" to="nodeType" />
			<bind node="metaFieldModel" alias="metaFieldModel" />
			<bind node="metaField" to="metaField" search="self.name = :metaField and self.metaModel.name = :metaFieldModel" />
			<bind node="roleSet/role" to="roleSet" search="self.name = :roleName" update="false" create="false">
				<bind node="text()" to="name" alias="roleName"/>
			</bind>
			<bind node="metaActionSet/action" to="metaActionSet" search="self.name = :actionName" update="false" create="false">
				<bind node="text()" to="name" alias="actionName"/>
			</bind>
		</bind>
		
		<bind node="transitions/transition" type="com.axelor.studio.db.WkfTransition"  search="self.name = :name and self.wkf.name = :wkf" update="true">
			<bind node="wkf" to="wkf" search="self.name = :wkf" update="true" create="false"/>
			<bind node="name" to="name" />
			<bind node="xmlId" to="xmlId" />
			<bind node="isButton" to="isButton" />
			<bind node="buttonTitle" to="buttonTitle" />
			<bind node="roleSet/role" to="roleSet" search="self.name = :roleName" create="false">
				<bind node="text()" to="name" alias="roleName"/>
			</bind>
			<bind node="conditions/condition" to="conditions">
				<bind node="metaModel" alias="metaModel" />
				<bind node="jsonModel" alias="jsonModel" />
				<bind node="metaField" to="metaField" search="self.name = :metaField and self.metaModel.fullName = :metaModel" create="false"/>
				<bind node="metaJsonField" to="metaJsonField" search="self.name = :metaJsonField and self.jsonModel.name = :jsonModel" create="false" if="jsonModel != null"/>
				<bind node="metaJsonField" to="metaJsonField" search="self.name = :metaJsonField and self.model = :model and self.modelField = :modelField" create="false" if="jsonModel == null"/>
				<bind node="operator" to="operator" />
				<bind node="targetField" to="targetField"/>
				<bind node="targetType" to="targetType"/>
				<bind node="value" to="value"/>
				<bind node="isJson" to="isJson" />
				<bind node="isTargetJson" to="isTargetJson" />
				<bind node="logicOp" to="logicOp" />
			</bind>
			<bind node="source" to="source" search="self.name = :source and self.wkf.name = :wkf" update="false" create="false" />
			<bind node="target" to="target" search="self.name = :target and self.wkf.name = :wkf" update="false" create="false" />
			<bind node="alertTypeSelect" to="alertTypeSelect" />
			<bind node="alertMsg" to="alertMsg" />
			<bind node="successMsg" to="successMsg" />
		</bind>
		
		<bind node="nodes/node" type="com.axelor.studio.db.WkfNode" search="self.name = :nodeName and self.wkf.name = :wkf" update="true" create="false">
			<bind node="wkf" to="wkf" search="self.name = :wkf" update="true" create="false" />
			<bind node="name" to="name" alias="nodeName" />
			<bind node="incomings/incoming" to="incoming" search="self.name = :inNode and self.wkf.name = :wkf" update="false" create="false">
				<bind node="text()" to="name" alias="inNode" />
			</bind>
			<bind node="outgoings/outgoing" to="outgoings" search="self.name = :outNode and self.wkf.name = :wkf" update="false" create="false">
				<bind node="text()" to="name" alias="outNode" />
			</bind>
		</bind>
 	</input> 
 	
 	<input file="bpm.xml" root="bpm" >
 		<bind node="wkfs/wkf" type="com.axelor.studio.db.Wkf" search="self.name = :name" create="false" call="com.axelor.studio.service.ImportService:importAppWkf">
			<bind node="name" to="name" />
		</bind>
 	</input>
    	
</xml-inputs>