automatic project update

This commit is contained in:
Julien Dubois 2015-08-06 13:50:33 +02:00
parent aba13340e2
commit 8b2f6b9102
57 changed files with 3188 additions and 1 deletions

View File

@ -0,0 +1,39 @@
{
"relationships": [
{
"relationshipId": 1,
"relationshipName": "user",
"otherEntityName": "user",
"relationshipType": "many-to-one",
"otherEntityField": "login"
},
{
"relationshipId": 2,
"relationshipName": "operation",
"otherEntityName": "operation",
"relationshipType": "one-to-many",
"otherEntityRelationshipName": "bankAccount"
}
],
"fields": [
{
"fieldId": 1,
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
},
{
"fieldId": 2,
"fieldName": "balance",
"fieldType": "BigDecimal",
"fieldValidateRules": [
"required"
]
}
],
"changelogDate": "20150805124838",
"dto": "no",
"pagination": "no"
}

27
.jhipster/Label.json Normal file
View File

@ -0,0 +1,27 @@
{
"relationships": [
{
"relationshipId": 1,
"relationshipName": "operation",
"otherEntityName": "operation",
"relationshipType": "many-to-many",
"ownerSide": false,
"otherEntityRelationshipName": "label"
}
],
"fields": [
{
"fieldId": 1,
"fieldName": "label",
"fieldType": "String",
"fieldValidateRules": [
"required",
"minlength"
],
"fieldValidateRulesMinlength": "3"
}
],
"changelogDate": "20150805124936",
"dto": "no",
"pagination": "no"
}

45
.jhipster/Operation.json Normal file
View File

@ -0,0 +1,45 @@
{
"relationships": [
{
"relationshipId": 1,
"relationshipName": "bankAccount",
"otherEntityName": "bankAccount",
"relationshipType": "many-to-one",
"otherEntityField": "name"
},
{
"relationshipId": 2,
"relationshipName": "label",
"otherEntityName": "label",
"relationshipType": "many-to-many",
"otherEntityField": "label",
"ownerSide": true
}
],
"fields": [
{
"fieldId": 1,
"fieldName": "date",
"fieldType": "DateTime",
"fieldValidateRules": [
"required"
]
},
{
"fieldId": 2,
"fieldName": "description",
"fieldType": "String"
},
{
"fieldId": 3,
"fieldName": "amount",
"fieldType": "BigDecimal",
"fieldValidateRules": [
"required"
]
}
],
"changelogDate": "20150805125054",
"dto": "no",
"pagination": "infinite-scroll"
}

View File

@ -1,4 +1,4 @@
// Generated on 2015-08-05 using generator-jhipster 2.19.0
// Generated on 2015-08-06 using generator-jhipster 2.19.0
'use strict';
var fs = require('fs');

View File

@ -0,0 +1,117 @@
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A BankAccount.
*/
@Entity
@Table(name = "BANKACCOUNT")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class BankAccount implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
@Column(name = "name", nullable = false)
private String name;
@NotNull
@Column(name = "balance", precision=10, scale=2, nullable = false)
private BigDecimal balance;
@ManyToOne
private User user;
@OneToMany(mappedBy = "bankAccount")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Operation> operations = new HashSet<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getBalance() {
return balance;
}
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Set<Operation> getOperations() {
return operations;
}
public void setOperations(Set<Operation> operations) {
this.operations = operations;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BankAccount bankAccount = (BankAccount) o;
if ( ! Objects.equals(id, bankAccount.id)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "BankAccount{" +
"id=" + id +
", name='" + name + "'" +
", balance='" + balance + "'" +
'}';
}
}

View File

@ -0,0 +1,91 @@
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A Label.
*/
@Entity
@Table(name = "LABEL")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Label implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
@Size(min = 3)
@Column(name = "label", nullable = false)
private String label;
@ManyToMany(mappedBy = "labels")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Operation> operations = new HashSet<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Set<Operation> getOperations() {
return operations;
}
public void setOperations(Set<Operation> operations) {
this.operations = operations;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Label label = (Label) o;
if ( ! Objects.equals(id, label.id)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "Label{" +
"id=" + id +
", label='" + label + "'" +
'}';
}
}

View File

@ -0,0 +1,141 @@
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mycompany.myapp.domain.util.CustomDateTimeDeserializer;
import com.mycompany.myapp.domain.util.CustomDateTimeSerializer;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A Operation.
*/
@Entity
@Table(name = "OPERATION")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Operation implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
@JsonSerialize(using = CustomDateTimeSerializer.class)
@JsonDeserialize(using = CustomDateTimeDeserializer.class)
@Column(name = "date", nullable = false)
private DateTime date;
@Column(name = "description")
private String description;
@NotNull
@Column(name = "amount", precision=10, scale=2, nullable = false)
private BigDecimal amount;
@ManyToOne
private BankAccount bankAccount;
@ManyToMany
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JoinTable(name = "OPERATION_LABEL",
joinColumns = @JoinColumn(name="operations_id", referencedColumnName="ID"),
inverseJoinColumns = @JoinColumn(name="labels_id", referencedColumnName="ID"))
private Set<Label> labels = new HashSet<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public DateTime getDate() {
return date;
}
public void setDate(DateTime date) {
this.date = date;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BankAccount getBankAccount() {
return bankAccount;
}
public void setBankAccount(BankAccount bankAccount) {
this.bankAccount = bankAccount;
}
public Set<Label> getLabels() {
return labels;
}
public void setLabels(Set<Label> labels) {
this.labels = labels;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Operation operation = (Operation) o;
if ( ! Objects.equals(id, operation.id)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "Operation{" +
"id=" + id +
", date='" + date + "'" +
", description='" + description + "'" +
", amount='" + amount + "'" +
'}';
}
}

View File

@ -0,0 +1,16 @@
package com.mycompany.myapp.repository;
import com.mycompany.myapp.domain.BankAccount;
import org.springframework.data.jpa.repository.*;
import java.util.List;
/**
* Spring Data JPA repository for the BankAccount entity.
*/
public interface BankAccountRepository extends JpaRepository<BankAccount,Long> {
@Query("select bankAccount from BankAccount bankAccount where bankAccount.user.login = ?#{principal.username}")
List<BankAccount> findAllForCurrentUser();
}

View File

@ -0,0 +1,13 @@
package com.mycompany.myapp.repository;
import com.mycompany.myapp.domain.Label;
import org.springframework.data.jpa.repository.*;
import java.util.List;
/**
* Spring Data JPA repository for the Label entity.
*/
public interface LabelRepository extends JpaRepository<Label,Long> {
}

View File

@ -0,0 +1,17 @@
package com.mycompany.myapp.repository;
import com.mycompany.myapp.domain.Operation;
import org.springframework.data.jpa.repository.*;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* Spring Data JPA repository for the Operation entity.
*/
public interface OperationRepository extends JpaRepository<Operation,Long> {
@Query("select operation from Operation operation left join fetch operation.labels where operation.id =:id")
Operation findOneWithEagerRelationships(@Param("id") Long id);
}

View File

@ -0,0 +1,110 @@
package com.mycompany.myapp.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.mycompany.myapp.domain.BankAccount;
import com.mycompany.myapp.repository.BankAccountRepository;
import com.mycompany.myapp.web.rest.util.HeaderUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.inject.Inject;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing BankAccount.
*/
@RestController
@RequestMapping("/api")
public class BankAccountResource {
private final Logger log = LoggerFactory.getLogger(BankAccountResource.class);
@Inject
private BankAccountRepository bankAccountRepository;
/**
* POST /bankAccounts -> Create a new bankAccount.
*/
@RequestMapping(value = "/bankAccounts",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<BankAccount> create(@Valid @RequestBody BankAccount bankAccount) throws URISyntaxException {
log.debug("REST request to save BankAccount : {}", bankAccount);
if (bankAccount.getId() != null) {
return ResponseEntity.badRequest().header("Failure", "A new bankAccount cannot already have an ID").body(null);
}
BankAccount result = bankAccountRepository.save(bankAccount);
return ResponseEntity.created(new URI("/api/bankAccounts/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert("bankAccount", result.getId().toString()))
.body(result);
}
/**
* PUT /bankAccounts -> Updates an existing bankAccount.
*/
@RequestMapping(value = "/bankAccounts",
method = RequestMethod.PUT,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<BankAccount> update(@Valid @RequestBody BankAccount bankAccount) throws URISyntaxException {
log.debug("REST request to update BankAccount : {}", bankAccount);
if (bankAccount.getId() == null) {
return create(bankAccount);
}
BankAccount result = bankAccountRepository.save(bankAccount);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert("bankAccount", bankAccount.getId().toString()))
.body(result);
}
/**
* GET /bankAccounts -> get all the bankAccounts.
*/
@RequestMapping(value = "/bankAccounts",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public List<BankAccount> getAll() {
log.debug("REST request to get all BankAccounts");
return bankAccountRepository.findAll();
}
/**
* GET /bankAccounts/:id -> get the "id" bankAccount.
*/
@RequestMapping(value = "/bankAccounts/{id}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<BankAccount> get(@PathVariable Long id) {
log.debug("REST request to get BankAccount : {}", id);
return Optional.ofNullable(bankAccountRepository.findOne(id))
.map(bankAccount -> new ResponseEntity<>(
bankAccount,
HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
/**
* DELETE /bankAccounts/:id -> delete the "id" bankAccount.
*/
@RequestMapping(value = "/bankAccounts/{id}",
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Void> delete(@PathVariable Long id) {
log.debug("REST request to delete BankAccount : {}", id);
bankAccountRepository.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("bankAccount", id.toString())).build();
}
}

View File

@ -0,0 +1,110 @@
package com.mycompany.myapp.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.mycompany.myapp.domain.Label;
import com.mycompany.myapp.repository.LabelRepository;
import com.mycompany.myapp.web.rest.util.HeaderUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.inject.Inject;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Label.
*/
@RestController
@RequestMapping("/api")
public class LabelResource {
private final Logger log = LoggerFactory.getLogger(LabelResource.class);
@Inject
private LabelRepository labelRepository;
/**
* POST /labels -> Create a new label.
*/
@RequestMapping(value = "/labels",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Label> create(@Valid @RequestBody Label label) throws URISyntaxException {
log.debug("REST request to save Label : {}", label);
if (label.getId() != null) {
return ResponseEntity.badRequest().header("Failure", "A new label cannot already have an ID").body(null);
}
Label result = labelRepository.save(label);
return ResponseEntity.created(new URI("/api/labels/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert("label", result.getId().toString()))
.body(result);
}
/**
* PUT /labels -> Updates an existing label.
*/
@RequestMapping(value = "/labels",
method = RequestMethod.PUT,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Label> update(@Valid @RequestBody Label label) throws URISyntaxException {
log.debug("REST request to update Label : {}", label);
if (label.getId() == null) {
return create(label);
}
Label result = labelRepository.save(label);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert("label", label.getId().toString()))
.body(result);
}
/**
* GET /labels -> get all the labels.
*/
@RequestMapping(value = "/labels",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public List<Label> getAll() {
log.debug("REST request to get all Labels");
return labelRepository.findAll();
}
/**
* GET /labels/:id -> get the "id" label.
*/
@RequestMapping(value = "/labels/{id}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Label> get(@PathVariable Long id) {
log.debug("REST request to get Label : {}", id);
return Optional.ofNullable(labelRepository.findOne(id))
.map(label -> new ResponseEntity<>(
label,
HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
/**
* DELETE /labels/:id -> delete the "id" label.
*/
@RequestMapping(value = "/labels/{id}",
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Void> delete(@PathVariable Long id) {
log.debug("REST request to delete Label : {}", id);
labelRepository.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("label", id.toString())).build();
}
}

View File

@ -0,0 +1,115 @@
package com.mycompany.myapp.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.mycompany.myapp.domain.Operation;
import com.mycompany.myapp.repository.OperationRepository;
import com.mycompany.myapp.web.rest.util.HeaderUtil;
import com.mycompany.myapp.web.rest.util.PaginationUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.inject.Inject;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Operation.
*/
@RestController
@RequestMapping("/api")
public class OperationResource {
private final Logger log = LoggerFactory.getLogger(OperationResource.class);
@Inject
private OperationRepository operationRepository;
/**
* POST /operations -> Create a new operation.
*/
@RequestMapping(value = "/operations",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Operation> create(@Valid @RequestBody Operation operation) throws URISyntaxException {
log.debug("REST request to save Operation : {}", operation);
if (operation.getId() != null) {
return ResponseEntity.badRequest().header("Failure", "A new operation cannot already have an ID").body(null);
}
Operation result = operationRepository.save(operation);
return ResponseEntity.created(new URI("/api/operations/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert("operation", result.getId().toString()))
.body(result);
}
/**
* PUT /operations -> Updates an existing operation.
*/
@RequestMapping(value = "/operations",
method = RequestMethod.PUT,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Operation> update(@Valid @RequestBody Operation operation) throws URISyntaxException {
log.debug("REST request to update Operation : {}", operation);
if (operation.getId() == null) {
return create(operation);
}
Operation result = operationRepository.save(operation);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert("operation", operation.getId().toString()))
.body(result);
}
/**
* GET /operations -> get all the operations.
*/
@RequestMapping(value = "/operations",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<List<Operation>> getAll(@RequestParam(value = "page" , required = false) Integer offset,
@RequestParam(value = "per_page", required = false) Integer limit)
throws URISyntaxException {
Page<Operation> page = operationRepository.findAll(PaginationUtil.generatePageRequest(offset, limit));
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/operations", offset, limit);
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /operations/:id -> get the "id" operation.
*/
@RequestMapping(value = "/operations/{id}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Operation> get(@PathVariable Long id) {
log.debug("REST request to get Operation : {}", id);
return Optional.ofNullable(operationRepository.findOneWithEagerRelationships(id))
.map(operation -> new ResponseEntity<>(
operation,
HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
/**
* DELETE /operations/:id -> delete the "id" operation.
*/
@RequestMapping(value = "/operations/{id}",
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Void> delete(@PathVariable Long id) {
log.debug("REST request to delete Operation : {}", id);
operationRepository.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("operation", id.toString())).build();
}
}

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<property name="now" value="now()" dbms="mysql,h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="now" value="sysdate" dbms="oracle"/>
<property name="autoIncrement" value="true" dbms="mysql,h2,postgresql"/>
<property name="autoIncrement" value="false" dbms="oracle"/>
<property name="floatType" value="real" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle"/>
<!--
Added the entity BankAccount.
-->
<changeSet id="20150805124838" author="jhipster">
<createTable tableName="BANKACCOUNT">
<column name="id" type="bigint" autoIncrement="${autoIncrement}" >
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="name" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="balance" type="decimal(10,2)">
<constraints nullable="false" />
</column>
<column name="user_id" type="bigint"/>
</createTable>
<addForeignKeyConstraint baseColumnNames="user_id"
baseTableName="BANKACCOUNT"
constraintName="fk_bankaccount_user_id"
referencedColumnNames="id"
referencedTableName="JHI_USER"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<property name="now" value="now()" dbms="mysql,h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="now" value="sysdate" dbms="oracle"/>
<property name="autoIncrement" value="true" dbms="mysql,h2,postgresql"/>
<property name="autoIncrement" value="false" dbms="oracle"/>
<property name="floatType" value="real" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle"/>
<!--
Added the entity Label.
-->
<changeSet id="20150805124936" author="jhipster">
<createTable tableName="LABEL">
<column name="id" type="bigint" autoIncrement="${autoIncrement}" >
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="label" type="varchar(255)">
<constraints nullable="false" />
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<property name="now" value="now()" dbms="mysql,h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="now" value="sysdate" dbms="oracle"/>
<property name="autoIncrement" value="true" dbms="mysql,h2,postgresql"/>
<property name="autoIncrement" value="false" dbms="oracle"/>
<property name="floatType" value="real" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle"/>
<!--
Added the entity Operation.
-->
<changeSet id="20150805125054" author="jhipster">
<createTable tableName="OPERATION">
<column name="id" type="bigint" autoIncrement="${autoIncrement}" >
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="date" type="timestamp">
<constraints nullable="false" />
</column>
<column name="description" type="varchar(255)"/>
<column name="amount" type="decimal(10,2)">
<constraints nullable="false" />
</column>
<column name="bankaccount_id" type="bigint"/>
</createTable>
<dropDefaultValue tableName="OPERATION" columnName="date" columnDataType="datetime"/>
<addForeignKeyConstraint baseColumnNames="bankaccount_id"
baseTableName="OPERATION"
constraintName="fk_operation_bankaccount_id"
referencedColumnNames="id"
referencedTableName="BANKACCOUNT"/>
<createTable tableName="OPERATION_LABEL">
<column name="labels_id" type="bigint">
<constraints nullable="false"/>
</column>
<column name="operations_id" type="bigint">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="operations_id, labels_id" tableName="OPERATION_LABEL"/>
<addForeignKeyConstraint baseColumnNames="operations_id"
baseTableName="OPERATION_LABEL"
constraintName="fk_operation_label_label_id"
referencedColumnNames="id"
referencedTableName="OPERATION"/>
<addForeignKeyConstraint baseColumnNames="labels_id"
baseTableName="OPERATION_LABEL"
constraintName="fk_label_label_operation_id"
referencedColumnNames="id"
referencedTableName="LABEL"/>
</changeSet>
</databaseChangeLog>

View File

@ -5,5 +5,8 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<include file="classpath:config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
<include file="classpath:config/liquibase/changelog/20150805124838_added_entity_BankAccount.xml" relativeToChangelogFile="false"/>
<include file="classpath:config/liquibase/changelog/20150805124936_added_entity_Label.xml" relativeToChangelogFile="false"/>
<include file="classpath:config/liquibase/changelog/20150805125054_added_entity_Operation.xml" relativeToChangelogFile="false"/>
<!-- JHipster will add liquibase changelogs here -->
</databaseChangeLog>

View File

@ -0,0 +1,24 @@
{
"jhipsterApp": {
"bankAccount" : {
"home": {
"title": "BankAccounts",
"createLabel": "Create a new BankAccount",
"createOrEditLabel": "Create or edit a BankAccount"
},
"created": "A new BankAccount is created with identifier {{ param }}",
"updated": "A BankAccount is updated with identifier {{ param }}",
"deleted": "A BankAccount is deleted with identifier {{ param }}",
"delete": {
"question": "Are you sure you want to delete BankAccount {{ id }}?"
},
"detail": {
"title": "BankAccount"
},
"name": "Name",
"balance": "Balance",
"user": "user",
"operation": "operation"
}
}
}

View File

@ -6,6 +6,9 @@
"home": "Home",
"entities": {
"main": "Entities",
"bankAccount": "BankAccount",
"label": "Label",
"operation": "Operation",
"additionalEntity": "JHipster will add additional entities here (do not translate!)"
},
"account": {

View File

@ -0,0 +1,22 @@
{
"jhipsterApp": {
"label" : {
"home": {
"title": "Labels",
"createLabel": "Create a new Label",
"createOrEditLabel": "Create or edit a Label"
},
"created": "A new Label is created with identifier {{ param }}",
"updated": "A Label is updated with identifier {{ param }}",
"deleted": "A Label is deleted with identifier {{ param }}",
"delete": {
"question": "Are you sure you want to delete Label {{ id }}?"
},
"detail": {
"title": "Label"
},
"label": "Label",
"operation": "operation"
}
}
}

View File

@ -0,0 +1,25 @@
{
"jhipsterApp": {
"operation" : {
"home": {
"title": "Operations",
"createLabel": "Create a new Operation",
"createOrEditLabel": "Create or edit a Operation"
},
"created": "A new Operation is created with identifier {{ param }}",
"updated": "A Operation is updated with identifier {{ param }}",
"deleted": "A Operation is deleted with identifier {{ param }}",
"delete": {
"question": "Are you sure you want to delete Operation {{ id }}?"
},
"detail": {
"title": "Operation"
},
"date": "Date",
"description": "Description",
"amount": "Amount",
"bankAccount": "bankAccount",
"label": "label"
}
}
}

View File

@ -0,0 +1,22 @@
{
"jhipsterApp": {
"bankAccount" : {
"home": {
"title": "BankAccounts",
"createLabel": "Créer un nouveau BankAccount",
"createOrEditLabel": "Créer ou éditer un BankAccount"
},
"delete": {
"question": "Etes-vous certain de vouloir supprimer le BankAccount {{ id }} ?"
},
"detail": {
"title": "BankAccount"
},
"name": "Name",
"balance": "Balance",
"user": "user",
"operation": "operation"
}
}
}

View File

@ -6,6 +6,9 @@
"home": "Accueil",
"entities": {
"main": "Entités",
"bankAccount": "BankAccount",
"label": "Label",
"operation": "Operation",
"additionalEntity": "JHipster will add additional entities here (do not translate!)"
},
"account": {

View File

@ -0,0 +1,20 @@
{
"jhipsterApp": {
"label" : {
"home": {
"title": "Labels",
"createLabel": "Créer un nouveau Label",
"createOrEditLabel": "Créer ou éditer un Label"
},
"delete": {
"question": "Etes-vous certain de vouloir supprimer le Label {{ id }} ?"
},
"detail": {
"title": "Label"
},
"label": "Label",
"operation": "operation"
}
}
}

View File

@ -0,0 +1,23 @@
{
"jhipsterApp": {
"operation" : {
"home": {
"title": "Operations",
"createLabel": "Créer un nouveau Operation",
"createOrEditLabel": "Créer ou éditer un Operation"
},
"delete": {
"question": "Etes-vous certain de vouloir supprimer le Operation {{ id }} ?"
},
"detail": {
"title": "Operation"
},
"date": "Date",
"description": "Description",
"amount": "Amount",
"bankAccount": "bankAccount",
"label": "label"
}
}
}

View File

@ -141,6 +141,21 @@
<script src="scripts/components/auth/provider/auth.session.service.js"></script>
<script src="scripts/app/account/sessions/sessions.js"></script>
<script src="scripts/app/account/sessions/sessions.controller.js"></script>
<script src="scripts/app/entities/bankAccount/bankAccount.js"></script>
<script src="scripts/app/entities/bankAccount/bankAccount.controller.js"></script>
<script src="scripts/app/entities/bankAccount/bankAccount-dialog.controller.js"></script>
<script src="scripts/app/entities/bankAccount/bankAccount-detail.controller.js"></script>
<script src="scripts/components/entities/bankAccount/bankAccount.service.js"></script>
<script src="scripts/app/entities/label/label.js"></script>
<script src="scripts/app/entities/label/label.controller.js"></script>
<script src="scripts/app/entities/label/label-dialog.controller.js"></script>
<script src="scripts/app/entities/label/label-detail.controller.js"></script>
<script src="scripts/components/entities/label/label.service.js"></script>
<script src="scripts/app/entities/operation/operation.js"></script>
<script src="scripts/app/entities/operation/operation.controller.js"></script>
<script src="scripts/app/entities/operation/operation-dialog.controller.js"></script>
<script src="scripts/app/entities/operation/operation-detail.controller.js"></script>
<script src="scripts/components/entities/operation/operation.service.js"></script>
<!-- endbuild -->
</body>
</html>

View File

@ -0,0 +1,14 @@
'use strict';
angular.module('jhipsterApp')
.controller('BankAccountDetailController', function ($scope, $rootScope, $stateParams, entity, BankAccount, User, Operation) {
$scope.bankAccount = entity;
$scope.load = function (id) {
BankAccount.get({id: id}, function(result) {
$scope.bankAccount = result;
});
};
$rootScope.$on('jhipsterApp:bankAccountUpdate', function(event, result) {
$scope.bankAccount = result;
});
});

View File

@ -0,0 +1,46 @@
<div>
<h2><span translate="jhipsterApp.bankAccount.detail.title">BankAccount</span> {{bankAccount.id}}</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th translate="entity.detail.field">Field</th>
<th translate="entity.detail.value">Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span translate="jhipsterApp.bankAccount.name">Name</span>
</td>
<td>
<span class="form-control-static">{{bankAccount.name}}</span>
</td>
</tr>
<tr>
<td>
<span translate="jhipsterApp.bankAccount.balance">Balance</span>
</td>
<td>
<span class="form-control-static">{{bankAccount.balance}}</span>
</td>
</tr>
<tr>
<td>
<span translate="jhipsterApp.bankAccount.user">user</span>
</td>
<td>
<span class="form-control-static">{{bankAccount.user.login}}</span>
</td>
</tr>
</tbody>
</table>
</div>
<button type="submit"
ui-sref="bankAccount"
class="btn btn-info">
<span class="glyphicon glyphicon-arrow-left"></span>&nbsp;<span translate="entity.action.back"> Back</span>
</button>
</div>

View File

@ -0,0 +1,32 @@
'use strict';
angular.module('jhipsterApp').controller('BankAccountDialogController',
['$scope', '$stateParams', '$modalInstance', 'entity', 'BankAccount', 'User', 'Operation',
function($scope, $stateParams, $modalInstance, entity, BankAccount, User, Operation) {
$scope.bankAccount = entity;
$scope.users = User.query();
$scope.operations = Operation.query();
$scope.load = function(id) {
BankAccount.get({id : id}, function(result) {
$scope.bankAccount = result;
});
};
var onSaveFinished = function (result) {
$scope.$emit('jhipsterApp:bankAccountUpdate', result);
$modalInstance.close(result);
};
$scope.save = function () {
if ($scope.bankAccount.id != null) {
BankAccount.update($scope.bankAccount, onSaveFinished);
} else {
BankAccount.save($scope.bankAccount, onSaveFinished);
}
};
$scope.clear = function() {
$modalInstance.dismiss('cancel');
};
}]);

View File

@ -0,0 +1,62 @@
<form name="editForm" role="form" novalidate ng-submit="save()" show-validation>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
ng-click="clear()">&times;</button>
<h4 class="modal-title" id="myBankAccountLabel" translate="jhipsterApp.bankAccount.home.createOrEditLabel">Create or edit a BankAccount</h4>
</div>
<div class="modal-body">
<jh-alert-error></jh-alert-error>
<div class="form-group">
<label for="id" translate="global.field.id">ID</label>
<input type="text" class="form-control" id="id" name="id"
ng-model="bankAccount.id" readonly>
</div>
<div class="form-group">
<label translate="jhipsterApp.bankAccount.name" for="field_name">Name</label>
<input type="text" class="form-control" name="name" id="field_name"
ng-model="bankAccount.name"
required>
<div ng-show="editForm.name.$invalid">
<p class="help-block"
ng-show="editForm.name.$error.required" translate="entity.validation.required">
This field is required.
</p>
</div>
</div>
<div class="form-group">
<label translate="jhipsterApp.bankAccount.balance" for="field_balance">Balance</label>
<input type="number" class="form-control" name="balance" id="field_balance"
ng-model="bankAccount.balance"
required>
<div ng-show="editForm.balance.$invalid">
<p class="help-block"
ng-show="editForm.balance.$error.required" translate="entity.validation.required">
This field is required.
</p>
<p class="help-block"
ng-show="editForm.balance.$error.number" translate="entity.validation.number">
This field should be a number.
</p>
</div>
</div>
<div class="form-group">
<label translate="jhipsterApp.bankAccount.user" for="field_user">user</label>
<select class="form-control" id="field_user" name="user" ng-model="bankAccount.user.id" ng-options="user.id as user.login for user in users">
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" ng-click="clear()">
<span class="glyphicon glyphicon-ban-circle"></span>&nbsp;<span translate="entity.action.cancel">Cancel</span>
</button>
<button type="submit" ng-disabled="editForm.$invalid || editForm.$submitted" class="btn btn-primary">
<span class="glyphicon glyphicon-save"></span>&nbsp;<span translate="entity.action.save">Save</span>
</button>
</div>
</form>

View File

@ -0,0 +1,37 @@
'use strict';