<commit_before>package fr.openwide.core.jpa.business.generic.model.migration;

import java.io.Serializable;

import org.hibernate.engine.spi.SessionImplementor;

import fr.openwide.core.jpa.util.PostgreSQLSequenceGenerator;

/**
 * Sequence generator used to define the new id from the id used in an old application.
 * 
 * <pre>
 * {@code
 * @Id
 * @GeneratedValue(generator = "Ticket_id")
 * @GenericGenerator(name = "Ticket_id", strategy = "fr.openwide.core.jpa.business.generic.model.migration.MigratedFromOldApplicationSequenceGenerator")
 * @DocumentId
 * private Long id;
 * }
 * </pre>
 */
public class MigratedFromOldApplicationSequenceGenerator extends PostgreSQLSequenceGenerator {
	
	@Override
	public Serializable generate(SessionImplementor session, Object obj) {
		if (obj instanceof MigratedFromOldApplicationGenericEntity) {
			Serializable oldApplicationId = ((MigratedFromOldApplicationGenericEntity<?, ?>) obj).getOldApplicationId();
			if (oldApplicationId != null) {
				return oldApplicationId;<commit_msg>Ajout du champ  MigratedFromOldApplicationSequenceGenerator.CLASS_NAME pour faciliter la création de generators.<commit_after>package fr.openwide.core.jpa.business.generic.model.migration;

import java.io.Serializable;

import org.hibernate.engine.spi.SessionImplementor;

import fr.openwide.core.jpa.util.PostgreSQLSequenceGenerator;

/**
 * Sequence generator used to define the new id from the id used in an old application.
 * 
 * <pre>
 * {@code
 * @Id
 * @GeneratedValue(generator = "Ticket_id")
 * @GenericGenerator(name = "Ticket_id", strategy = MigratedFromOldApplicationSequenceGenerator.CLASS_NAME)
 * @DocumentId
 * private Long id;
 * }
 * </pre>
 */
public class MigratedFromOldApplicationSequenceGenerator extends PostgreSQLSequenceGenerator {
	
	public static final String CLASS_NAME = "fr.openwide.core.jpa.business.generic.model.migration.MigratedFromOldApplicationSequenceGenerator";
	
	@Override
	public Serializable generate(SessionImplementor session, Object obj) {
		if (obj instanceof MigratedFromOldApplicationGenericEntity) {
			Serializable oldApplicationId = ((MigratedFromOldApplicationGenericEntity<?, ?>) obj).getOldApplicationId();
			if (oldApplicationId != null) {
				return oldApplicationId;
{'fraction_non_alphanumeric': 0.09618794326241134, 'fraction_numerical': 0.0, 'mean_word_length': 5.966049382716049, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '383421', 'n_tokens_mistral': 663, 'n_tokens_neox': 629, 'n_words': 140}