<commit_before>/* DO NOT EDIT: File is auto-generated */
package <%= to_package(repository.imit.qualified_message_generator_name) %>;

import org.realityforge.replicant.server.EntityMessage;

/**
 * * Utility class that encodes RPC payloads from JPA entities for the repository "<%= repository.name %>".
 */
@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration", "JavaDoc" } )
@javax.enterprise.context.ApplicationScoped
public class <%= repository.imit.message_generator_name %>
  implements org.realityforge.replicant.server.EntityMessageGenerator
{
  private final <%= repository.imit.qualified_router_interface_name %> _router;

  @javax.inject.Inject
  public <%= repository.imit.message_generator_name %>( final <%= repository.imit.qualified_router_interface_name %> router )
  {
    _router = router;
  }

  public EntityMessage convertToEntityMessage( final Object object, final boolean isUpdate )
  {
    <%
repository.data_modules.select { |data_module| data_module.imit? }.each do |data_module|
  data_module.entities.each do |entity|
    if entity.imit? && !entity.abstract?

      links = entity.attributes.collect{|a| a.imit? && a.imit.graph_links.size > 0 ? a : nil }.compact

%>if( <%= entity.jpa.qualified_name %>.class.isInstance( object ) )
    {
      final <%= entity.jpa.qualified_name %> entity = <%= entity.jpa.qualified_name %>.class.cast( object );
      final @javax.annotation.Nonnull java.io.Serializable id = entity.<%= getter_for(entity.primary_key) %>;
      final @javax.annotation.Nonnull java.util.Map<String, java.io.Serializable> attributes = isUpdate ? <%= entity.data_module.repository.imit.qualified_jpa_encoder_name %>.encode<%= entity.name %>( entity ) : null;
      final int transportID = <%= repository.imit.message_constants_name %>.<%= Domgen::Naming.uppercase_constantize(entity.data_module.name.to_s) %>_<%= Domgen::Naming.uppercase_constantize(entity.name.to_s) %>;
      final @javax.annotation.Nonnull java.util.Map<String, java.io.Serializable> routingKeys = _router.route<%= entity.name %>( entity );
      final @javax.annotation.Nullable java.util.Set<org.realityforge.replicant.server.ChannelLink> links = <%= links.size == 0 ? "null" : "new java.util.HashSet<org.realityforge.replicant.server.ChannelLink>()" %>;
      if( isUpdate )
      {
<%
entity.attributes.each do |a|
  if a.imit? && a.imit.graph_links.size > 0
    a.imit.graph_links.each_pair do |source_graph_key, target_graph_key|
      source_graph = repository.imit.graph_by_name(source_graph_key)
      target_graph = repository.imit.graph_by_name(target_graph_key)
    -%>
        links.add( new org.realityforge.replicant.server.ChannelLink( <%= repository.imit.qualified_graph_enum_name %>.<%= Domgen::Naming.uppercase_constantize(source_graph.name) %>.ordinal(), new org.realityforge.replicant.server.ChannelDescriptor( <%= repository.imit.qualified_graph_enum_name %>.<%= Domgen::Naming.uppercase_constantize(target_graph.name) %>.ordinal(), entity.<%= getter_for(a) %>.<%= getter_for(a.referenced_entity.primary_key) %> ) ) );
<%
    end
  end
end
%>
      }
      return new EntityMessage( id, transportID, System.currentTimeMillis(), routingKeys, attributes, links );
    }
    else <%
    end
  end
end
%>
    {
      return null;
    }
  }
}<commit_msg>Update to the latest replicant API<commit_after>/* DO NOT EDIT: File is auto-generated */
package <%= to_package(repository.imit.qualified_message_generator_name) %>;

import org.realityforge.replicant.server.EntityMessage;

/**
 * * Utility class that encodes RPC payloads from JPA entities for the repository "<%= repository.name %>".
 */
@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration", "JavaDoc" } )
@javax.enterprise.context.ApplicationScoped
public class <%= repository.imit.message_generator_name %>
  implements org.realityforge.replicant.server.EntityMessageGenerator
{
  private final <%= repository.imit.qualified_router_interface_name %> _router;

  @javax.inject.Inject
  public <%= repository.imit.message_generator_name %>( final <%= repository.imit.qualified_router_interface_name %> router )
  {
    _router = router;
  }

  public EntityMessage convertToEntityMessage( final Object object, final boolean isUpdate )
  {
    <%
repository.data_modules.select { |data_module| data_module.imit? }.each do |data_module|
  data_module.entities.each do |entity|
    if entity.imit? && !entity.abstract?

      links = entity.attributes.collect{|a| a.imit? && a.imit.graph_links.size > 0 ? a : nil }.compact

%>if( <%= entity.jpa.qualified_name %>.class.isInstance( object ) )
    {
      final <%= entity.jpa.qualified_name %> entity = <%= entity.jpa.qualified_name %>.class.cast( object );
      final @javax.annotation.Nonnull java.io.Serializable id = entity.<%= getter_for(entity.primary_key) %>;
      final @javax.annotation.Nonnull java.util.Map<String, java.io.Serializable> attributes = isUpdate ? <%= entity.data_module.repository.imit.qualified_jpa_encoder_name %>.encode<%= entity.name %>( entity ) : null;
      final int transportID = <%= repository.imit.message_constants_name %>.<%= Domgen::Naming.uppercase_constantize(entity.data_module.name.to_s) %>_<%= Domgen::Naming.uppercase_constantize(entity.name.to_s) %>;
      final @javax.annotation.Nonnull java.util.Map<String, java.io.Serializable> routingKeys = _router.route<%= entity.name %>( entity );
      final @javax.annotation.Nullable java.util.Set<org.realityforge.replicant.server.ChannelLink> links = <%= links.size == 0 ? "null" : "new java.util.HashSet<org.realityforge.replicant.server.ChannelLink>()" %>;
      if( isUpdate )
      {
<%
entity.attributes.each do |a|
  if a.imit? && a.imit.graph_links.size > 0
    a.imit.graph_links.each_pair do |source_graph_key, target_graph_key|
      target_graph = repository.imit.graph_by_name(target_graph_key)
    -%>
        links.add( new org.realityforge.replicant.server.ChannelLink( new org.realityforge.replicant.server.ChannelDescriptor( <%= repository.imit.qualified_graph_enum_name %>.<%= Domgen::Naming.uppercase_constantize(target_graph.name) %>.ordinal(), entity.<%= getter_for(a) %>.<%= getter_for(a.referenced_entity.primary_key) %> ) ) );
<%
    end
  end
end
%>
      }
      return new EntityMessage( id, transportID, System.currentTimeMillis(), routingKeys, attributes, links );
    }
    else <%
    end
  end
end
%>
    {
      return null;
    }
  }
}
{'fraction_non_alphanumeric': 0.14101968076863475, 'fraction_numerical': 0.0009298000929800093, 'mean_word_length': 4.535162950257289, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 67, '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': '6204921', 'n_tokens_mistral': 2155, 'n_tokens_neox': 2038, 'n_words': 350}