Sha256: d3835dfe8c33f3149595dfd45fd42e9609a0109e5d1824bfa1bf87de0ce81dcc

Contents?: true

Size: 837 Bytes

Versions: 3

Compression:

Stored size: 837 Bytes

Contents

class RepositoryGenerator < BaseScaffold

  def self.source_root
    File.join File.dirname(__FILE__), "templates"
  end

  def build
    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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vraptor-scaffold-1.2.3 lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb
vraptor-scaffold-1.2.1 lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb
vraptor-scaffold-1.2.0 lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb