package org.omg.bpmn.miwg.api;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.Hashtable;
import java.util.Map;

import org.omg.bpmn.miwg.api.tools.AnalysisTool;

public class AnalysisRun {

	private AnalysisJob job;

	private Map<AnalysisTool, AnalysisResult> results = new Hashtable<AnalysisTool, AnalysisResult>();

	public AnalysisRun(AnalysisJob job) {
		this.job = job;
	}

	public void addResult(AnalysisTool tool, AnalysisResult result) {
		results.put(tool, result);
	}

	public String buildOverviewHTML(File folder)
			throws UnsupportedEncodingException {
		StringBuilder sb = new StringBuilder();

		sb.append("<div class=\"test\" ");

		for (AnalysisTool tool : results.keySet()) {
			AnalysisResult result = results.get(tool);
			assert result != null;

			sb.append(tool.getName() + "-ok=\"" + result.numOK + "\" ");
			sb.append(tool.getName() + "-finding=\"" + result.numFindings
					+ "\" ");
		}

		sb.append(">\n");
		
		sb.append("<ul>\n");

		for (AnalysisTool tool : results.keySet()) {
			AnalysisResult result = results.get(tool);
			assert result != null;

			sb.append("<li>");
			sb.append("<a href=\"" + result.getHTMLResultsLink(job) + "\">");
			sb.append(result.getResultsFileName(job));
			sb.append("</a>");
			sb.append("</li>\n");
		}

		sb.append("</ul>\n");
		
		
		sb.append("</div>\n");

		String html = sb.toString();

		return html;
	}

	public AnalysisResult getResult(String analysisToolName) {
		for (AnalysisTool tool : results.keySet()) {
			if (tool.getName().equals(analysisToolName)) {
				AnalysisResult result = results.get(tool);
				assert result != null;

				return result;
			}
		}

		return null;
	}

}

package org.omg.bpmn.miwg.api;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.Hashtable;
import java.util.Map;

import org.omg.bpmn.miwg.api.tools.AnalysisTool;

public class AnalysisRun {

	private AnalysisJob job;

	private Map<AnalysisTool, AnalysisResult> results = new Hashtable<AnalysisTool, AnalysisResult>();

	public AnalysisRun(AnalysisJob job) {
		this.job = job;
	}

	public void addResult(AnalysisTool tool, AnalysisResult result) {
		results.put(tool, result);
	}

	public String buildOverviewHTML(File folder)
			throws UnsupportedEncodingException {
		StringBuilder sb = new StringBuilder();

		sb.append("<div class=\"test\" ");

		for (AnalysisTool tool : results.keySet()) {
			AnalysisResult result = results.get(tool);
			assert result != null;

            sb.append("data-" + tool.getName() + "-ok=\"" + result.numOK
                    + "\" ");
            sb.append("data-" + tool.getName() + "-finding=\""
                    + result.numFindings
					+ "\" ");
		}

		sb.append(">\n");
		
		sb.append("<ul>\n");

		for (AnalysisTool tool : results.keySet()) {
			AnalysisResult result = results.get(tool);
			assert result != null;

			sb.append("<li>");
			sb.append("<a href=\"" + result.getHTMLResultsLink(job) + "\">");
			sb.append(result.getResultsFileName(job));
			sb.append("</a>");
			sb.append("</li>\n");
		}

		sb.append("</ul>\n");
		
		
		sb.append("</div>\n");

		String html = sb.toString();

		return html;
	}

	public AnalysisResult getResult(String analysisToolName) {
		for (AnalysisTool tool : results.keySet()) {
			if (tool.getName().equals(analysisToolName)) {
				AnalysisResult result = results.get(tool);
				assert result != null;

				return result;
			}
		}

		return null;
	}

}

Prepend non-HTML attributes with data- to ensure valid HTML whilst keeping the new naming convention