anchor.diff:        throw new IllegalStateException( "Method invoked on invalid imitation" );
       }
     }
  +
  +  protected final void checkLinked()
  +  {
  +    checkValidity();
  +    if( !_linked )
  +    {
  +      throw new IllegalStateException( "Method invoked on unlinked imitation" );
  +    }
  +  }
  +
  +  public final void link()
  +  {
  +    _linking = true;
  +    try
  +    {
  +      performLink();
  +      _linked = true;
  +    }
  +    finally
  +    {
  +      _linking = false;
  +    }
  +  }
  +
  +  public final void delink()
  +  {
  +   _delinking = true;
  +    try
  +    {
  +      performDelink();
  +      _linked = false;
  +    }
  +    finally
  +    {
  +      _delinking = false;
  +    }
  +  }
   <% end %>
   }
positive.code: public <%= entity.abstract? ? "abstract " : "" %>class <%= entity.imit.imitation_name %>
  <%= entity.extends ?
    "    extends #{entity.data_module.entity_by_name(entity.extends).imit.qualified_imitation_name}\n" :
    "" %>
  {
    public static final String TYPE_KEY = "<%= entity.qualified_name %>";
  <% if !entity.abstract? %>
  
negative.code:    end
     end
  %>
  <% entity.referencing_attributes.
    select { |attribute| attribute.inverse.imit.traversable? && entity == attribute.referenced_entity }.
    each do |attribute| %><%= if attribute.inverse.multiplicity == :many
            "  private java.util.List<#{attribute.entity.imit.qualified_imitation_name}> #{pluralize(attribute.inverse.relationship_name)};\n"
          else # attribute.inverse.multiplicity == :one || attribute.inverse.multiplicity == :zero_or_one
            "  private #{attribute.entity.imit.qualified_imitation_name} #{attribute.inverse.relationship_name};\n"
          end %>
  <% end %>
  <% if entity.extends.nil? %>
    private boolean _linking;
    private boolean _delinking;
    private boolean _linked;
  <% end %>
    protected <%= entity.imit.imitation_name %>( final EntityRepository repository )
    {
      <%= entity.extends.nil? ? "_repository = repository" : "super( repository )" %>;
  