Skip to content

Commit

Permalink
update readme and index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
deepu105 committed Jan 2, 2016
1 parent 08c195d commit aa95d3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
## Usage

This is a [JHipster](http://jhipster.github.io/) module, that is meant to be use in a JHipster application.
This is a [JHipster](http://jhipster.github.io/) module, that is meant to be used in a JHipster application.

The module will extend the existing entities with `AbstractAuditingEntity` class to enable audits hence make sure that your entities doesn't have any superclass.
You can choose to enable audit for all entities or choose the entities to be audited from a list during generation.

The module will extend the selected entities and its DTOs with `AbstractAuditingEntity` and `AbstractAuditingDTO` class respectively to enable audits, hence make sure that your entities/DTOs doesn't have any super class.

This will also add new columns to the liquibase changeset for the entities, so it is ideal to recreate the tables if you are enabling this for existing entities.

The Audit log page is optional and can be added by choosing the option while running the generator

### Installation

As this is a [JHipster](http://jhipster.github.io/) module, we expect you have [JHipster and its related tools already installed](http://jhipster.github.io/installation.html).

This module requires Jhipster version greater than 2.26.2 in order to work

```bash
npm install -g generator-jhipster-entity-audit
```
Expand All @@ -28,6 +34,7 @@ If you want don't want to answer each question you can use
```bash
yo jhipster-entity-audit default
```
This will enable auditing for all available entities (only ones created by the jhipster:entity generator) and add the audit log page under admin

## License

Expand Down
9 changes: 6 additions & 3 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ module.exports = yeoman.generators.Base.extend({
resourceDir + 'config/liquibase/changelog/' + this.changelogDate + '_added_entity_EntityAuditEvent.xml', TPL, this, { 'interpolate': interpolateRegex });

jhipsterFunc.addChangelogToLiquibase(this.changelogDate + '_added_entity_EntityAuditEvent');

jhipsterFunc.copyTemplate(webappDir + '/scripts/components/interceptor/_entity.audit.interceptor.js', webappDir + '/scripts/components/interceptor/entity.audit.interceptor.js', TPL, this);
jhipsterFunc.addJavaScriptToIndex('components/interceptor/entity.audit.interceptor.js');
jhipsterFunc.addAngularJsInterceptor('entityAuditInterceptor');

// add the new Listener to the 'AbstractAuditingEntity' class and add import
jhipsterFunc.replaceContent(javaDir + 'domain/AbstractAuditingEntity.java', 'AuditingEntityListener.class', '{AuditingEntityListener.class, EntityAuditEventListener.class}');
jhipsterFunc.rewriteFile(javaDir + 'domain/AbstractAuditingEntity.java',
Expand Down Expand Up @@ -179,17 +184,15 @@ module.exports = yeoman.generators.Base.extend({
jhipsterFunc.copyTemplate(webappDir + '/scripts/app/admin/entityAudit/_entityAudit.controller.js', webappDir + 'scripts/app/admin/entityAudit/entityAudit.controller.js', TPL, this);
jhipsterFunc.copyTemplate(webappDir + '/scripts/app/admin/entityAudit/_entityAudit.detail.controller.js', webappDir + 'scripts/app/admin/entityAudit/entityAudit.detail.controller.js', TPL, this);
jhipsterFunc.copyTemplate(webappDir + '/scripts/components/admin/_entityAudit.service.js', webappDir + 'scripts/components/admin/entityAudit.service.js', TPL, this);
jhipsterFunc.copyTemplate(webappDir + '/scripts/components/interceptor/_entity.audit.interceptor.js', webappDir + '/scripts/components/interceptor/entity.audit.interceptor.js', TPL, this);

// add the scripts to index.html
jhipsterFunc.addJavaScriptToIndex('components/admin/entityAudit.service.js');
jhipsterFunc.addJavaScriptToIndex('components/interceptor/entity.audit.interceptor.js');
jhipsterFunc.addJavaScriptToIndex('app/admin/entityAudit/entityAudit.js');
jhipsterFunc.addJavaScriptToIndex('app/admin/entityAudit/entityAudit.controller.js');
jhipsterFunc.addJavaScriptToIndex('app/admin/entityAudit/entityAudit.detail.controller.js');
// add bower dependency required
jhipsterFunc.addBowerDependency('angular-object-diff', '0.6.1');
jhipsterFunc.addAngularJsModule('ds.objectDiff');
jhipsterFunc.addAngularJsInterceptor('entityAuditInterceptor');
// add new menu entry
jhipsterFunc.addElementToAdminMenu('entityAudit', 'list-alt', jhipsterVar.enableTranslation);
jhipsterFunc.addTranslationKeyToAllLanguages('entityAudit', 'Entity Audit', 'addAdminElementTranslationKey', jhipsterVar.enableTranslation);
Expand Down

0 comments on commit aa95d3c

Please sign in to comment.