Search in sources :

Example 1 with LanguageInfo

use of com.google.refine.expr.MetaParser.LanguageInfo in project OpenRefine by OpenRefine.

the class GetModelsCommand method internalRespond.

protected void internalRespond(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Project project = null;
    // This command also supports retrieving rows for an importing job.
    String importingJobID = request.getParameter("importingJobID");
    if (importingJobID != null) {
        long jobID = Long.parseLong(importingJobID);
        ImportingJob job = ImportingManager.getJob(jobID);
        if (job != null) {
            project = job.project;
        }
    }
    if (project == null) {
        project = getProject(request);
    }
    response.setHeader("Cache-Control", "no-cache");
    Map<String, LanguageInfo> prefixesMap = new HashMap<>();
    for (String languagePrefix : MetaParser.getLanguagePrefixes()) {
        LanguageInfo info = MetaParser.getLanguageInfo(languagePrefix);
        prefixesMap.put(languagePrefix, info);
    }
    Map<String, HttpHeaderInfo> headersMap = new HashMap<>();
    for (String headerLabel : HttpHeadersSupport.getHttpHeaderLabels()) {
        HttpHeaderInfo info = HttpHeadersSupport.getHttpHeaderInfo(headerLabel);
        headersMap.put(headerLabel, info);
    }
    respondJSON(response, new ModelsResponse(project.columnModel, project.recordModel, project.overlayModels, prefixesMap, headersMap));
}
Also used : Project(com.google.refine.model.Project) LanguageInfo(com.google.refine.expr.MetaParser.LanguageInfo) HashMap(java.util.HashMap) ImportingJob(com.google.refine.importing.ImportingJob) HttpHeaderInfo(com.google.refine.commands.HttpHeadersSupport.HttpHeaderInfo)

Aggregations

HttpHeaderInfo (com.google.refine.commands.HttpHeadersSupport.HttpHeaderInfo)1 LanguageInfo (com.google.refine.expr.MetaParser.LanguageInfo)1 ImportingJob (com.google.refine.importing.ImportingJob)1 Project (com.google.refine.model.Project)1 HashMap (java.util.HashMap)1