<Requests>
    <AQLDownloadRequest>
        <RequestValidationRules
                isEmptyIdsAllowed="false"
                isEmptyDatesAllowed="false"
                isIdsFormatted="true"
        />
        <DownloadRequestType>Arango</DownloadRequestType>
        <DownloadRequestEntitySelectorQuery>
            <![CDATA[
                    WITH applications, subject, history, edges

                    FOR app IN applications
                        FILTER app.statement.recruitsData.mainInfo[0].id IN @ids
                        LET parentEdges = (
                            FOR vertex, edge, path
                                IN 1..1
                                OUTBOUND app._id edges
                                OPTIONS { uniqueVertices: "path" }
                                FILTER edge.field IN ["applicant", "history", "interdepreq"]
                                RETURN { edgesId: edge._key, parent: DOCUMENT(vertex._id) }
                        )
                        RETURN {
                            applicationId: app._key,
                            edgesId: (FOR e IN parentEdges RETURN e.edgesId),
                            subjectId: (FOR e IN parentEdges FILTER e.parent.schema == "Subject" RETURN e.parent._key),
                            historyId: (FOR e IN parentEdges FILTER e.parent.schema == "History" RETURN e.parent._key),
                            interdepreqId: (FOR e IN parentEdges FILTER e.parent.schema == "Interdepreq" RETURN e.parent._key)
                        }
                ]]>
        </DownloadRequestEntitySelectorQuery>
        <AqlRequestCollections>
            <AqlRequestCollection type="read" dateAttribute="statement.recruitsData.mainInfo[0].systemCreateDate">applications</AqlRequestCollection>
            <AqlRequestCollection type="read" dateAttribute="date">history</AqlRequestCollection>
        </AqlRequestCollections>
        <AqlConnectionParams>
            <Host>localhost</Host>
            <Port>8529</Port>
            <Username>root</Username>
            <Password>test</Password>
            <Database>_system</Database>
        </AqlConnectionParams>
    </AQLDownloadRequest>
    <SQLDownloadRequest>
        <DownloadRequestType>По конкретным id</DownloadRequestType>
        <RequestValidationRules
            isEmptyDatesAllowed="true"
        />
        <RequestURL>
            Select system_id_ern from public.recruits where id in ${endpointArguments};
        </RequestURL>
        <SqlConnectionParams>
            <JdbcHost>10.10.31.118</JdbcHost>
            <JdbcPort>5432</JdbcPort>
            <JdbcUsername>ervu</JdbcUsername>
            <JdbcPassword>ervu</JdbcPassword>
            <JdbcDriverClassName>org.postgresql.Driver</JdbcDriverClassName>
            <JdbcXaDataSourceClassName>org.postgresql.xa.PGXADataSource</JdbcXaDataSourceClassName>
            <JdbcXaDataSourcePoolSize>50</JdbcXaDataSourcePoolSize>
            <JdbcDatabase>person_registry</JdbcDatabase>
            <JdbcXaDataSourceBorrowConnectionTimeout>4000</JdbcXaDataSourceBorrowConnectionTimeout>
        </SqlConnectionParams>
    </SQLDownloadRequest>
    <SQLDownloadRequest>
        <RequestValidationRules
            isEmptyIdsAllowed="true"
            isEmptyDatesAllowed="true"
            isIdsFormatted="true"
        />
        <DownloadRequestType>С выделенным подзапросом (100)</DownloadRequestType>
        <RequestArgumentLimit>100</RequestArgumentLimit>
        <RequestURL>
            Select system_id_ern from public.recruits where id in ${additionalArguments};
        </RequestURL>
        <SqlConnectionParams>
            <JdbcHost>10.10.31.118</JdbcHost>
            <JdbcPort>5432</JdbcPort>
            <JdbcUsername>ervu</JdbcUsername>
            <JdbcPassword>ervu</JdbcPassword>
            <JdbcDriverClassName>org.postgresql.Driver</JdbcDriverClassName>
            <JdbcXaDataSourceClassName>org.postgresql.xa.PGXADataSource</JdbcXaDataSourceClassName>
            <JdbcXaDataSourcePoolSize>50</JdbcXaDataSourcePoolSize>
            <JdbcDatabase>person_registry</JdbcDatabase>
            <JdbcXaDataSourceBorrowConnectionTimeout>4000</JdbcXaDataSourceBorrowConnectionTimeout>
        </SqlConnectionParams>
        <RequestArgument>
            <RequestArgumentURL>
                select id from public.recruits;
            </RequestArgumentURL>
            <RequestArgumentName>additionalArguments</RequestArgumentName>
            <RequestArgumentConnectionParams>
                <JdbcHost>10.10.31.118</JdbcHost>
                <JdbcPort>5432</JdbcPort>
                <JdbcUsername>ervu</JdbcUsername>
                <JdbcPassword>ervu</JdbcPassword>
                <JdbcDriverClassName>org.postgresql.Driver</JdbcDriverClassName>
                <JdbcXaDataSourceClassName>org.postgresql.xa.PGXADataSource</JdbcXaDataSourceClassName>
                <JdbcXaDataSourcePoolSize>50</JdbcXaDataSourcePoolSize>
                <JdbcDatabase>person_registry</JdbcDatabase>
                <JdbcXaDataSourceBorrowConnectionTimeout>4000</JdbcXaDataSourceBorrowConnectionTimeout>
            </RequestArgumentConnectionParams>
        </RequestArgument>
    </SQLDownloadRequest>
    <SQLDownloadRequest>
        <RequestValidationRules
            isEmptyIdsAllowed="true"
            isEmptyDatesAllowed="true"
            isIdsFormatted="true"
        />
        <DownloadRequestType>Одним запросом (50)</DownloadRequestType>
        <RequestArgumentLimit>50</RequestArgumentLimit>
        <RequestURL>
            Select system_id_ern from public.recruits;
        </RequestURL>
        <SqlConnectionParams>
            <JdbcHost>10.10.31.118</JdbcHost>
            <JdbcPort>5432</JdbcPort>
            <JdbcUsername>ervu</JdbcUsername>
            <JdbcPassword>ervu</JdbcPassword>
            <JdbcDriverClassName>org.postgresql.Driver</JdbcDriverClassName>
            <JdbcXaDataSourceClassName>org.postgresql.xa.PGXADataSource</JdbcXaDataSourceClassName>
            <JdbcXaDataSourcePoolSize>50</JdbcXaDataSourcePoolSize>
            <JdbcDatabase>person_registry</JdbcDatabase>
            <JdbcXaDataSourceBorrowConnectionTimeout>4000</JdbcXaDataSourceBorrowConnectionTimeout>
        </SqlConnectionParams>
    </SQLDownloadRequest>

</Requests>