<?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="ebics-user.xml" root="ebics-users" >
	<bind node="ebics-user" type="com.axelor.apps.bankpayment.db.EbicsUser"  call="com.axelor.apps.bankpayment.ebics.script.EbicsUserImport:importEbicsUser">
      <bind node="name" to="name" />
      <bind node="userId" to="userId" />
      <bind node="password" to="password" />
      <bind node="userTypeSelect" to="userTypeSelect" />
      <bind node="statusSelect" to="statusSelect" />
      <bind node="ebicsPartner" to="ebicsPartner" search="self.partnerId = :partnerId" update="false">
      	<bind node="partnerId" to="partnerId" alias="partnerId"/>
        <bind node="ebicsTypeSelect" to="ebicsTypeSelect" />
		<bind node="testMode" to="testMode"/>
		<bind node="filterReceiverBD" to="filterReceiverBD"/>
      	<bind node="ebicsBank" to="ebicsBank" search="self.hostId = :hostId" update="true">
	   		<bind node="hostId" to="hostId" alias="hostId"/>
	   		<bind node="name" to="name" />
	   		<bind node="fullName" to="fullName"/>
	   		<bind node="url" to="url"/>
			<bind node="fax" to="fax" />
			<bind node="emailAddress" to="emailAddress" />
	   		<bind node="language" to="language" search="self.code = :code"/>
	   		<bind node="bank" to="bank" search="self.code = :code"  update="false">
	   			<bind node="code" to="code" />
                <bind node="bankDetailsTypeSelect" to="bankDetailsTypeSelect"/>
	   			<bind node="bankName" to="bankName" />
	   		</bind>
	   		<bind node="ebicsCertificateList/ebicsCertificate" to="ebicsCertificateList" search="self.typeSelect = :bankCertType and self.ebicsBank.hostId = :hostId" >
	   			<bind node="typeSelect" to="typeSelect" />
	   			<bind node="pem" to="pemString" />
	   		</bind>
	   		<bind node="certValidityPeriodSelect" to="certValidityPeriodSelect" />
	   		<bind node="protocolSelect" to="protocolSelect" />
	   		<bind node="useX509ExtentionForAutoSignedCert" to="useX509ExtentionForAutoSignedCert" />
      	</bind>
      	<bind node="bankStatementFileFormatSet/bankStatementFileFormat" to="bankStatementFileFormatSet" search="self.name = :bankStatementFileFormatName">
      		<bind node="importId" to="importId" />
      		<bind node="statementFileFormatSelect" to="statementFileFormatSelect" />
      		<bind node="name" to="name" alias="bankStatementFileFormatName" />
      		<bind node="description" to="description" />
      	</bind>
      	<bind node="pSRBankStatementFileFormat" to="pSRBankStatementFileFormat" search="self.name = :pSRBsankStatementFileFormatName">
      		<bind node="importId" to="importId" />
      		<bind node="statementFileFormatSelect" to="statementFileFormatSelect" />
      		<bind node="name" to="name" alias="pSRBsankStatementFileFormatName" />
      		<bind node="description" to="description" />
      	</bind>
      	<bind node="transportEbicsUserId" to="transportEbicsUser" search="self.userId = :transportEbicsUserId" />
      	<bind node="bankStatementGetModeSelect" to="bankStatementGetModeSelect" />
      	<bind node="bankStatementLastExeDateT" to="bankStatementLastExeDateT" />
      	<bind node="usePSR" to="usePSR" />
      	<bind node="bankDetailsSet/bankDetails" to="bankDetailsSet" search="self.fullName = :fullName">
      		<bind node="importId" to="importId" />
      		<bind node="partnerFullName" to="partnerFullName" search="self.fullName = :partnerFullName"  update="true"/>
      		<bind node="ownerName" to="ownerName" />
      		<bind node="bank" to="bank" search="self.code = :bank" update="true"/>
      		<bind node="bankCode" to="bankCode" />
      		<bind node="iban" to="iban" />
      		<bind node="sortCode" to="sortCode" />
      		<bind node="accountNbr" to="accountNbr" />
      		<bind node="bbanKey" to="bbanKey" />
      		<bind node="ibanBic" to="ibanBic" />
      		<bind node="fullName" to="fullName" />
			<bind node="bankAddress" to="bankAddress" search="self.address = :address">
				<bind node="code" to="code"/>
				<bind node="address" to="address"/>
				<bind node="label" to="label"/>
			</bind>
		</bind>
		  <bind node="receiverBankDetailsSet/bankDetails" to="receiverBankDetailsSet" search="self.fullName = :fullName">
			  <bind node="importId" to="importId" />
			  <bind node="partnerFullName" to="partnerFullName" search="self.fullName = :partnerFullName"  update="true"/>
			  <bind node="ownerName" to="ownerName" />
			  <bind node="bank" to="bank" search="self.code = :bank" update="true"/>
			  <bind node="bankCode" to="bankCode" />
			  <bind node="iban" to="iban" />
			  <bind node="sortCode" to="sortCode" />
			  <bind node="accountNbr" to="accountNbr" />
			  <bind node="active" to="active" />
			  <bind node="bbanKey" to="bbanKey" />
			  <bind node="ibanBic" to="ibanBic" />
			  <bind node="fullName" to="fullName" />
			  <bind node="bankAddress" to="bankAddress" search="self.address = :address">
				  <bind node="code" to="code"/>
				  <bind node="address" to="address"/>
				  <bind node="label" to="label"/>
			  </bind>
      	</bind>
      </bind>
      <bind node="securityMedium" to="securityMedium" />
      <bind node="nextOrderId" to="nextOrderId"  />
      <bind node="associatedUserCode" to="associatedUser" search="self.code = :userCode" update="true" alias="userCode"/>
      <bind node="dn" to="dn" />
      <bind to="a005Certificate" node="a005Certificate">
      	<bind node="pem" to="pemString" />
      	<bind to="typeSelect" eval="'signature'"  />
      	<bind node="privateKey" to="privateKey" eval="privateKey != null ? org.apache.commons.codec.binary.Base64.decodeBase64(privateKey) : null" />
      </bind>
      <bind to="e002Certificate" node="e002Certificate">
      	<bind node="pem" to="pemString" />
      	<bind to="typeSelect" eval="'encryption'" />
      	<bind node="privateKey" to="privateKey" eval="privateKey != null ? org.apache.commons.codec.binary.Base64.decodeBase64(privateKey) : null" />
      </bind>
      <bind to="x002Certificate" node="x002Certificate">
      	<bind node="pem" to="pemString" />
      	<bind to="typeSelect" eval="'authentication'" />
      	<bind node="privateKey" to="privateKey" eval="privateKey != null ? org.apache.commons.codec.binary.Base64.decodeBase64(privateKey) : null"/>
      </bind>
    </bind>
    <bind node="ebicsRequestLogList/ebicsRequestLog" type="com.axelor.apps.bankpayment.db.EbicsRequestLog">
        <bind node="ebicsUser" to="ebicsUser" search="self.userId = :ebicsUser" create="false"/>
        <bind node="requestType" to="requestType" />
        <bind node="requestTime" to="requestTime" />
        <bind node="responseCode" to="responseCode" />
        <bind node="requestTraceText" to="requestTraceText" />
        <bind node="responseTraceText" to="responseTraceText" />
    </bind>
  </input> 
    	
</xml-inputs>