<commit_before>
/**
 *
 * SampleSourceDaoImpl.java 
 * @author echeng (table2type.pl)
 *  
 * the SampleSource Dao Impl
 *
 *
 **/

package edu.yu.einstein.wasp.dao.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import edu.yu.einstein.wasp.model.Sample;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import edu.yu.einstein.wasp.model.SampleSource;

@SuppressWarnings("unchecked")
@Transactional
@Repository
public class SampleSourceDaoImpl extends WaspDaoImpl<SampleSource> implements edu.yu.einstein.wasp.dao.SampleSourceDao {

	/**
	 * SampleSourceDaoImpl() Constructor
	 *
	 *
	 */
	public SampleSourceDaoImpl() {
		super();
		this.entityClass = SampleSource.class;
	}


	/**
	 * getSampleSourceBySampleSourceId(final int sampleSourceId)
	 *
	 * @param final int sampleSourceId
	 *
	 * @return sampleSource
	 */

	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public SampleSource getSampleSourceBySampleSourceId (final int sampleSourceId) {
    		HashMap m = new HashMap();
		m.put("sampleSourceId", sampleSourceId);

		List<SampleSource> results = this.findByMap(m);

		if (results.size() == 0) {
			SampleSource rt = new SampleSource();
			return rt;
		}
		return results.get(0);
	}



	/**
	 * getSampleSourceBySampleIdMultiplexindex(final int sampleId, final int multiplexindex)
	 *
	 * @param final int sampleId, final int multiplexindex
	 *
	 * @return sampleSource
	 */

	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public SampleSource getSampleSourceBySampleIdMultiplexindex (final int sampleId, final int multiplexindex) {
    	HashMap m = new HashMap();
		m.put("sampleId", sampleId);
		m.put("multiplexindex", multiplexindex);

		List<SampleSource> results = this.findByMap(m);

		if (results.size() == 0) {
			SampleSource rt = new SampleSource();
			return rt;
		}
		return results.get(0);
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public Sample getParentSampleByDerivedSampleId(Integer derivedSampleId){
		HashMap m = new HashMap();
		m.put("sampleId", derivedSampleId);
		List<SampleSource> results = this.findByMap(m);

		if (results.size() == 0) {
			Sample rt = new Sample();
			return rt;
		}
		return results.get(0).getSample();
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public List<Sample> getDerivedSamplesByParentSampleId(Integer parentSampleId){
		HashMap m = new HashMap();
		m.put("source_sampleId", parentSampleId);
		List<Sample> derivedSamples = new ArrayList<Sample>();
		for(SampleSource sampleSource: (List<SampleSource>) this.findByMap(m)){
			derivedSamples.add(sampleSource.getSampleViaSource());
		}
		return derivedSamples;
	}
<commit_msg>corrected backwards functionality!<commit_after>
/**
 *
 * SampleSourceDaoImpl.java 
 * @author echeng (table2type.pl)
 *  
 * the SampleSource Dao Impl
 *
 *
 **/

package edu.yu.einstein.wasp.dao.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import edu.yu.einstein.wasp.model.Sample;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import edu.yu.einstein.wasp.model.SampleSource;

@SuppressWarnings("unchecked")
@Transactional
@Repository
public class SampleSourceDaoImpl extends WaspDaoImpl<SampleSource> implements edu.yu.einstein.wasp.dao.SampleSourceDao {

	/**
	 * SampleSourceDaoImpl() Constructor
	 *
	 *
	 */
	public SampleSourceDaoImpl() {
		super();
		this.entityClass = SampleSource.class;
	}


	/**
	 * getSampleSourceBySampleSourceId(final int sampleSourceId)
	 *
	 * @param final int sampleSourceId
	 *
	 * @return sampleSource
	 */

	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public SampleSource getSampleSourceBySampleSourceId (final int sampleSourceId) {
    		HashMap m = new HashMap();
		m.put("sampleSourceId", sampleSourceId);

		List<SampleSource> results = this.findByMap(m);

		if (results.size() == 0) {
			SampleSource rt = new SampleSource();
			return rt;
		}
		return results.get(0);
	}



	/**
	 * getSampleSourceBySampleIdMultiplexindex(final int sampleId, final int multiplexindex)
	 *
	 * @param final int sampleId, final int multiplexindex
	 *
	 * @return sampleSource
	 */

	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public SampleSource getSampleSourceBySampleIdMultiplexindex (final int sampleId, final int multiplexindex) {
    	HashMap m = new HashMap();
		m.put("sampleId", sampleId);
		m.put("multiplexindex", multiplexindex);

		List<SampleSource> results = this.findByMap(m);

		if (results.size() == 0) {
			SampleSource rt = new SampleSource();
			return rt;
		}
		return results.get(0);
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public Sample getParentSampleByDerivedSampleId(Integer derivedSampleId){
		HashMap m = new HashMap();
		m.put("sampleId", derivedSampleId);
		List<SampleSource> results = this.findByMap(m);

		if (results.size() == 0) {
			Sample rt = new Sample();
			return rt;
		}
		return results.get(0).getSampleViaSource();
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	@SuppressWarnings("unchecked")
	@Transactional
	public List<Sample> getDerivedSamplesByParentSampleId(Integer parentSampleId){
		HashMap m = new HashMap();
		m.put("source_sampleId", parentSampleId);
		List<Sample> derivedSamples = new ArrayList<Sample>();
		for(SampleSource sampleSource: (List<SampleSource>) this.findByMap(m)){
			derivedSamples.add(sampleSource.getSample());
		}
		return derivedSamples;
	}

{'fraction_non_alphanumeric': 0.12219274977895668, 'fraction_numerical': 0.002475685234305924, 'mean_word_length': 4.684422110552764, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '3406002', 'n_tokens_mistral': 1942, 'n_tokens_neox': 1783, 'n_words': 366}