generator-jhipster-string-converter

Long to String converter

Usage no npm install needed!

<script type="module">
  import generatorJhipsterStringConverter from 'https://cdn.skypack.dev/generator-jhipster-string-converter';
</script>

README

generator-jhipster-string-converter

Modified from https://github.com/amitjindal/generator-jhipster-postgresstring-converter

Prerequisites

As this is a JHipster module, we expect you have JHipster and its related tools already installed:

Installation

With NPM

To install this module:

npm install -g generator-jhipster-string-converter

To update this module:

npm update -g generator-jhipster-string-converter

Generate Result

Domain


import org.hibernate.annotations.GenericGenerator;

    // ...
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid2")
    private String id;

    // ...
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    

Repository

// ...
@SuppressWarnings("unused")
@Repository
public interface AppRepository extends JpaRepository<App, String> {

}

Service

    /**
     * Get the "id" app.
     *
     * @param id the id of the entity
     * @return the entity
     */
    Optional<App> findOne(String id);

    /**
     * Delete the "id" app.
     *
     * @param id the id of the entity
     */
    void delete(String id);

impl/ServiceImpl

    /**
     * Get one app by id.
     *
     * @param id the id of the entity
     * @return the entity
     */
    @Override
    @Transactional(readOnly = true)
    public Optional<App> findOne(String id) {
        log.debug("Request to get App : {}", id);
        return appRepository.findById(id);
    }

    /**
     * Delete the app by id.
     *
     * @param id the id of the entity
     */
    @Override
    public void delete(String id) {
        log.debug("Request to delete App : {}", id);
        appRepository.deleteById(id);
    }

Resource


    /**
     * GET  /apps/:id : get the "id" app.
     *
     * @param id the id of the app to retrieve
     * @return the ResponseEntity with status 200 (OK) and with body the app, or with status 404 (Not Found)
     */
    @GetMapping("/apps/{id}")
    @Timed
    public ResponseEntity<App> getApp(@PathVariable String id) {
        log.debug("REST request to get App : {}", id);
        Optional<App> app = appService.findOne(id);
        return ResponseUtil.wrapOrNotFound(app);
    }

    /**
     * DELETE  /apps/:id : delete the "id" app.
     *
     * @param id the id of the app to delete
     * @return the ResponseEntity with status 200 (OK)
     */
    @DeleteMapping("/apps/{id}")
    @Timed
    public ResponseEntity<Void> deleteApp(@PathVariable String id) {
        log.debug("REST request to delete App : {}", id);
        appService.delete(id);
        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
    }