class PrepareUpdateUnits extends ActionHandler {

    @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler)
        throws ProcessingException {

        final ItemStatus itemStatus = new ItemStatus(PREPARE_UPDATE_UNIT_LIST);

        try (MetaDataClient client = metaDataClientFactory.getClient()) {
            // parse multi select query
            JsonNode queryNode = handler.getJsonFromWorkspace("query.json");
            SelectMultiQuery multiQuery = getSelectQueryFromJson(queryNode);

            // get distribution file name
            final String distribFileName = handler.getOutput(DISTRIBUTION_FILE_RANK).getPath();
            final File distribFile = handler.getNewLocalFile(distribFileName);

            // create spliterator based on the select query
            final ScrollSpliterator<JsonNode> scrollRequest = ScrollSpliteratorHelper
                .createUnitScrollSplitIterator(client, multiQuery, batchSize);

            // create temporary file with units as JSONL
            createDistributionFile(scrollRequest, distribFile);

            // move file to workspace
            handler.transferFileToWorkspace(distribFileName, distribFile, true, false);

            // set status OK
            itemStatus.increment(StatusCode.OK);

        } catch (InvalidParseOperationException | ProcessingException e) {
            LOGGER.error(e);
            itemStatus.increment(StatusCode.FATAL);
        }
        return new ItemStatus(PREPARE_UPDATE_UNIT_LIST).setItemsStatus(PREPARE_UPDATE_UNIT_LIST, itemStatus);
    }

    public  PrepareUpdateUnits();
    @VisibleForTesting  PrepareUpdateUnits(MetaDataClientFactory metaDataClientFactory, int batchSize);

}