<commit_before>package org.fedorahosted.flies.dao;


import java.util.List;

import org.fedorahosted.flies.common.ContentState;
import org.fedorahosted.flies.common.LocaleId;
import org.fedorahosted.flies.model.HDocument;
import org.fedorahosted.flies.model.HTextFlow;
import org.fedorahosted.flies.model.HTextFlowTarget;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;

@Name("textFlowTargetDAO")
@AutoCreate
public class TextFlowTargetDAO extends AbstractDAOImpl<HTextFlowTarget, Long>{

	public TextFlowTargetDAO() {
		super(HTextFlowTarget.class);
	}
	
	public TextFlowTargetDAO(Session session) {
		super(HTextFlowTarget.class, session);
	}
	
	/**
	 * @param textFlow
	 * @param localeId
	 * @return
	 */
	public HTextFlowTarget getByNaturalId(HTextFlow textFlow, LocaleId localeId){
		return (HTextFlowTarget) getSession().createCriteria(HTextFlowTarget.class)
			.add( Restrictions.naturalId()
		        .set("textFlow", textFlow)
		        .set("locale", localeId)
		    	)<commit_msg>ensure all DAOs are Stateless Seam components (left out TextFlowTargetDAO)<commit_after>package org.fedorahosted.flies.dao;


import java.util.List;

import org.fedorahosted.flies.common.ContentState;
import org.fedorahosted.flies.common.LocaleId;
import org.fedorahosted.flies.model.HDocument;
import org.fedorahosted.flies.model.HTextFlow;
import org.fedorahosted.flies.model.HTextFlowTarget;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name("textFlowTargetDAO")
@AutoCreate
@Scope(ScopeType.STATELESS)
public class TextFlowTargetDAO extends AbstractDAOImpl<HTextFlowTarget, Long>{

	public TextFlowTargetDAO() {
		super(HTextFlowTarget.class);
	}
	
	public TextFlowTargetDAO(Session session) {
		super(HTextFlowTarget.class, session);
	}
	
	/**
	 * @param textFlow
	 * @param localeId
	 * @return
	 */
	public HTextFlowTarget getByNaturalId(HTextFlow textFlow, LocaleId localeId){
		return (HTextFlowTarget) getSession().createCriteria(HTextFlowTarget.class)
			.add( Restrictions.naturalId()
		        .set("textFlow", textFlow)
		        .set("locale", localeId)
		    	)
{'fraction_non_alphanumeric': 0.10736842105263159, 'fraction_numerical': 0.0, 'mean_word_length': 5.404312668463612, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6347991', 'n_tokens_mistral': 853, 'n_tokens_neox': 780, 'n_words': 130}