class ObliterateDelegator extends BaseDelegator implements IObliterateDelegator {

    @Override
    public List<IObliterateResult> obliterateFiles(
            @Nonnull final List<IFileSpec> fileSpecs,
            final ObliterateFilesOptions opts) throws P4JavaException {

        Validate.notNull(fileSpecs);

        List<IObliterateResult> obliterateResults = new ArrayList<>();

        List<Map<String, Object>> resultMaps = execMapCmdList(
                OBLITERATE,
                processParameters(opts, fileSpecs, server),
                null);

        // The "obliterate" command can take multiple filespecs.
        // Each filespec has its own result in the results map.
        // Each result has summary keys: "revisionRecDeleted", etc.
        // The summary keys indicate boundary between results.
        // Additionally, there might be a "reportOnly" key at the end.
        // Note: some results might not have "purgeFile" and "purgeRev" values.
        if (nonNull(resultMaps)) {
            // Check for the "reportOnly" key in the last map entry.
            // We only check if there are two or more elements.
            boolean reportOnly = false;
            if (resultMaps.size() > 1) {
                Map<String, Object> lastResultMap = resultMaps.get(resultMaps.size() - 1);
                reportOnly = nonNull(lastResultMap) && lastResultMap.containsKey(REPORT_ONLY);
            }

            try {
                List<IFileSpec> fsList = new ArrayList<>();
                for (Map<String, Object> map : resultMaps) {
                    // p4ic4idea: use IServerMessage
                    final IServerMessage errStr = handleFileErrorStr(map);
                    if (isNull(errStr)) {
                        if (map.containsKey(PURGE_FILE)) {
                            FileSpec fs = createPurgeFileSpecFromMap(map);
                            fsList.add(fs);
                        } else if (map.containsKey(REVISION_REC_DELETED)) {
                            IObliterateResult result = createObliterateResultFromMapIfRevisionRecordsDeleted(
                                    map,
                                    fsList,
                                    reportOnly);

                            obliterateResults.add(result);
                            // Create a new list for the next result
                            fsList = new ArrayList<>();
                        }
                    } else {
                        FileSpec fs = createInfoOrErrorFileSpecFromMap(
                                map,
                                errStr,
                                new Function<Map<String, Object>, Boolean>() {
                                    @Override
                                    public Boolean apply(Map<String, Object> map) {
                                        return errStr.isInfo();
                                    }
                                });

                        fsList.add(fs);
                        IObliterateResult result = new ObliterateResult(fsList, 0, 0, 0, 0, 0, 0,
                                reportOnly);
                        obliterateResults.add(result);
                    }
                }
            } catch (Exception exc) {
                Log.error("Unexpected exception in ObliterateFileSpec constructor %s",
                        exc.getLocalizedMessage());
                Log.exception(exc);
            }
        }

        return obliterateResults;
    }

    public  ObliterateDelegator(IOptionsServer server);

}