<commit_before>package com.krishagni.catissueplus.rest.controller;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.krishagni.catissueplus.core.administrative.domain.Shipment;
import com.krishagni.catissueplus.core.administrative.events.ShipmentContainerDetail;
import com.krishagni.catissueplus.core.administrative.events.ShipmentDetail;
import com.krishagni.catissueplus.core.administrative.events.ShipmentItemsListCriteria;
import com.krishagni.catissueplus.core.administrative.events.ShipmentListCriteria;
import com.krishagni.catissueplus.core.administrative.events.ShipmentSpecimenDetail;
import com.krishagni.catissueplus.core.administrative.events.StorageContainerSummary;
import com.krishagni.catissueplus.core.administrative.services.ShipmentService;
import com.krishagni.catissueplus.core.common.errors.CommonErrorCode;
import com.krishagni.catissueplus.core.common.errors.OpenSpecimenException;
import com.krishagni.catissueplus.core.common.events.RequestEvent;
import com.krishagni.catissueplus.core.common.events.ResponseEvent;
import com.krishagni.catissueplus.core.de.events.QueryDataExportResult;

@Controller
@RequestMapping("/shipments")
public class ShipmentController {

	@Autowired
	private ShipmentService shipmentSvc;
	
	@RequestMapping(method = RequestMethod.GET)
	@ResponseStatus(HttpStatus.OK)
	@ResponseBody
	public List<ShipmentDetail> getShipments(
		@RequestParam(value = "name", required = false, defaultValue = "")
		String name,

		@RequestParam(value = "sendingSite", required = false, defaultValue = "")
		String sendingSite,
			
		@RequestParam(value = "recvInstitute", required = false, defaultValue = "")
		String recvInstitute,
			
		@RequestParam(value = "recvSite", required = false, defaultValue = "")
		String recvSite,

		@RequestParam(value = "status", required = false, defaultValue = "")
		String status,
			
		@RequestParam(value = "startAt", required = false, defaultValue = "0")
		int startAt,
				
		@RequestParam(value = "maxResults", required = false, defaultValue = "50")
		int maxResults,

		@RequestParam(value = "includeStats", required = false, defaultValue = "false")
		boolean includeStats) {


		
		ShipmentListCriteria listCrit = new ShipmentListCriteria()
			.name(name)
			.sendingSite(sendingSite)
			.recvInstitute(recvInstitute)
			.recvSite(recvSite)
			.status(getStatus(status))
			.startAt(startAt)
			.maxResults(maxResults)
			.includeStat(includeStats);
		return response(shipmentSvc.getShipments(request(listCrit)));
	}

	@RequestMapping(method = RequestMethod.GET, value = "/count")
	@ResponseStatus(HttpStatus.OK)
	@ResponseBody
	public Map<String, Long> getShipmentsCount(
		@RequestParam(value = "name", required = false, defaultValue = "")
		String name,

		@RequestParam(value = "sendingSite", required = false, defaultValue = "")<commit_msg>Removed unwanted whitespaces ...<commit_after>package com.krishagni.catissueplus.rest.controller;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.krishagni.catissueplus.core.administrative.domain.Shipment;
import com.krishagni.catissueplus.core.administrative.events.ShipmentContainerDetail;
import com.krishagni.catissueplus.core.administrative.events.ShipmentDetail;
import com.krishagni.catissueplus.core.administrative.events.ShipmentItemsListCriteria;
import com.krishagni.catissueplus.core.administrative.events.ShipmentListCriteria;
import com.krishagni.catissueplus.core.administrative.events.ShipmentSpecimenDetail;
import com.krishagni.catissueplus.core.administrative.events.StorageContainerSummary;
import com.krishagni.catissueplus.core.administrative.services.ShipmentService;
import com.krishagni.catissueplus.core.common.errors.CommonErrorCode;
import com.krishagni.catissueplus.core.common.errors.OpenSpecimenException;
import com.krishagni.catissueplus.core.common.events.RequestEvent;
import com.krishagni.catissueplus.core.common.events.ResponseEvent;
import com.krishagni.catissueplus.core.de.events.QueryDataExportResult;

@Controller
@RequestMapping("/shipments")
public class ShipmentController {

	@Autowired
	private ShipmentService shipmentSvc;
	
	@RequestMapping(method = RequestMethod.GET)
	@ResponseStatus(HttpStatus.OK)
	@ResponseBody
	public List<ShipmentDetail> getShipments(
		@RequestParam(value = "name", required = false, defaultValue = "")
		String name,

		@RequestParam(value = "sendingSite", required = false, defaultValue = "")
		String sendingSite,
			
		@RequestParam(value = "recvInstitute", required = false, defaultValue = "")
		String recvInstitute,
			
		@RequestParam(value = "recvSite", required = false, defaultValue = "")
		String recvSite,

		@RequestParam(value = "status", required = false, defaultValue = "")
		String status,
			
		@RequestParam(value = "startAt", required = false, defaultValue = "0")
		int startAt,
				
		@RequestParam(value = "maxResults", required = false, defaultValue = "50")
		int maxResults,

		@RequestParam(value = "includeStats", required = false, defaultValue = "false")
		boolean includeStats) {
		
		ShipmentListCriteria listCrit = new ShipmentListCriteria()
			.name(name)
			.sendingSite(sendingSite)
			.recvInstitute(recvInstitute)
			.recvSite(recvSite)
			.status(getStatus(status))
			.startAt(startAt)
			.maxResults(maxResults)
			.includeStat(includeStats);
		return response(shipmentSvc.getShipments(request(listCrit)));
	}

	@RequestMapping(method = RequestMethod.GET, value = "/count")
	@ResponseStatus(HttpStatus.OK)
	@ResponseBody
	public Map<String, Long> getShipmentsCount(
		@RequestParam(value = "name", required = false, defaultValue = "")
		String name,

		@RequestParam(value = "sendingSite", required = false, defaultValue = "")
{'fraction_non_alphanumeric': 0.10882898302667238, 'fraction_numerical': 0.0011410640422193695, 'mean_word_length': 6.357817418677859, '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': '4267082', 'n_tokens_mistral': 2175, 'n_tokens_neox': 2076, 'n_words': 337}