Sha256: 8f4a1c30c4059127727f09d22d59a50085267a570e2667d92d2a0845200725e5

Contents?: true

Size: 918 Bytes

Versions: 3

Compression:

Stored size: 918 Bytes

Contents

class RepositoryGenerator < BaseScaffold

  def build
    define_source_paths
    template("repository.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_interface_name}.java"))
    template("repository_impl.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_impl_name}.java"))
    template("repository_test.erb", Configuration.test_class_path(Configuration.repositories_package, "#{repository_test_class_name}.java"))
  end

  def orm_import
    return "org.hibernate.Session" if Configuration.hibernate?
    "javax.persistence.EntityManager"
  end

  def orm_parameter_name
    return "session" if Configuration.hibernate?
    "entityManager"
  end

  def orm_class
    orm_parameter_name.camelize
  end

  def template_path
    "src/templates/repositories"
  end
  
  def source_root
    File.join File.dirname(__FILE__), "templates"
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
heroku-vraptor-scaffold-0.9.0 lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb
vraptor-scaffold-1.3.0 lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb
vraptor-scaffold-1.3.0.rc lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb