<commit_before>package edu.ucla.cens.awserver.service;

import java.util.Map;

import edu.ucla.cens.awserver.dao.Dao;
import edu.ucla.cens.awserver.dao.DataAccessException;
import edu.ucla.cens.awserver.datatransfer.AwRequest;

/**
 * Service a data upload for prompt responses or mobility data by dispatching to a DAO for persistence.
 * 
 * @author selsky
 */
public class UploadService implements Service {
	private Map<String, Dao> _daoMap;
	
	/**
	 * @throws IllegalArgumentException if the provided map is null or empty or does not contain values for the keys mobility or 
	 * prompt 
	 */
	public UploadService(Map<String, Dao> daoMap) {
		if(null == daoMap || daoMap.isEmpty()) {
			throw new IllegalArgumentException("a non-null Map of DAOs is required");			
		}
		if(null == daoMap.get("prompt")) {
			throw new IllegalArgumentException("no DAO found for prompt");
		}
		if(null == daoMap.get("mobility")) {
			throw new IllegalArgumentException("no DAO found for mobility");
		}
		
		_daoMap = daoMap;
	}
	
	/**
	 * 
	 */
	public void execute(AwRequest awRequest) {
		try {
		
			_daoMap.get(awRequest.getAttribute("requestType")).execute(awRequest);
			
		} catch(DataAccessException dae) {
			
			throw new ServiceException(dae);
		}
	}
}
<commit_msg>minor formatting cleanup<commit_after>package edu.ucla.cens.awserver.service;

import java.util.Map;

import edu.ucla.cens.awserver.dao.Dao;
import edu.ucla.cens.awserver.dao.DataAccessException;
import edu.ucla.cens.awserver.datatransfer.AwRequest;

/**
 * Service a data upload for prompt responses or mobility data by dispatching to a DAO for persistence.
 * 
 * @author selsky
 */
public class UploadService implements Service {
	private Map<String, Dao> _daoMap;
	
	/**
	 * @throws IllegalArgumentException if the provided map is null or empty or does not contain values for the keys mobility or 
	 * prompt 
	 */
	public UploadService(Map<String, Dao> daoMap) {
		if(null == daoMap || daoMap.isEmpty()) {
			throw new IllegalArgumentException("a non-null Map of DAOs is required");			
		}
		if(null == daoMap.get("prompt")) {
			throw new IllegalArgumentException("no DAO found for prompt");
		}
		if(null == daoMap.get("mobility")) {
			throw new IllegalArgumentException("no DAO found for mobility");
		}
		
		_daoMap = daoMap;
	}
	
	/**
	 * Dispatches to a DAO depending on the request type.
	 */
	public void execute(AwRequest awRequest) {
		try {
		
			_daoMap.get(awRequest.getAttribute("requestType")).execute(awRequest);
			
		} catch(DataAccessException dae) {
			
			throw new ServiceException(dae);
		}
	}
}

{'fraction_non_alphanumeric': 0.1100811123986095, 'fraction_numerical': 0.0, 'mean_word_length': 3.9053030303030303, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5558990', 'n_tokens_mistral': 923, 'n_tokens_neox': 819, 'n_words': 223}