Skip to content

Commit

Permalink
Merge branch 'dev' into master-merged
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/apeps/firstapp/config/CacheConfiguration.java
#	src/main/resources/config/liquibase/master.xml
#	src/main/webapp/app/layouts/navbar/navbar.html
#	src/main/webapp/index.html
  • Loading branch information
yalynnyk committed Dec 8, 2017
2 parents 7ed39a6 + d8f3df8 commit ba45dae
Show file tree
Hide file tree
Showing 77 changed files with 4,961 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .jhipster/Cart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"fluentMethods": true,
"relationships": [
{
"relationshipType": "one-to-many",
"relationshipName": "item",
"otherEntityName": "item",
"otherEntityRelationshipName": "cart"
},
{
"relationshipType": "one-to-one",
"relationshipName": "customer",
"otherEntityName": "customer",
"ownerSide": false,
"otherEntityRelationshipName": "cart"
}
],
"fields": [],
"changelogDate": "20171208125341",
"entityTableName": "cart",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false
}
32 changes: 32 additions & 0 deletions .jhipster/Category.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"fluentMethods": true,
"relationships": [
{
"relationshipType": "one-to-many",
"relationshipName": "item",
"otherEntityName": "item",
"otherEntityRelationshipName": "category"
},
{
"relationshipType": "many-to-one",
"relationshipName": "parent",
"otherEntityName": "category",
"otherEntityField": "id"
}
],
"fields": [
{
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
}
],
"changelogDate": "20171118104227",
"entityTableName": "category",
"dto": "no",
"pagination": "pagination",
"service": "serviceClass",
"jpaMetamodelFiltering": false
}
37 changes: 37 additions & 0 deletions .jhipster/Customer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"fluentMethods": true,
"relationships": [
{
"relationshipType": "one-to-one",
"relationshipName": "cart",
"otherEntityName": "cart",
"otherEntityField": "id",
"ownerSide": true,
"otherEntityRelationshipName": "customer"
}
],
"fields": [
{
"fieldName": "firstName",
"fieldType": "String"
},
{
"fieldName": "lastName",
"fieldType": "String"
},
{
"fieldName": "email",
"fieldType": "String"
},
{
"fieldName": "telephone",
"fieldType": "String"
}
],
"changelogDate": "20171118104228",
"entityTableName": "customer",
"dto": "no",
"pagination": "pagination",
"service": "no",
"jpaMetamodelFiltering": false
}
40 changes: 40 additions & 0 deletions .jhipster/Item.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"fluentMethods": true,
"relationships": [
{
"relationshipType": "many-to-one",
"relationshipName": "category",
"otherEntityName": "category",
"otherEntityField": "id"
},
{
"relationshipName": "cart",
"otherEntityName": "cart",
"relationshipType": "many-to-one",
"otherEntityField": "id"
}
],
"fields": [
{
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "description",
"fieldType": "String"
},
{
"fieldName": "price",
"fieldType": "Integer"
}
],
"changelogDate": "20171118104226",
"entityTableName": "item",
"dto": "no",
"pagination": "pagination",
"service": "serviceClass",
"jpaMetamodelFiltering": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public JCacheManagerCustomizer cacheManagerCustomizer() {
cm.createCache(org.apeps.firstapp.domain.Offering.class.getName() + ".prices", jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Offering.class.getName() + ".childs", jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Price.class.getName(), jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Item.class.getName(), jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Category.class.getName(), jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Category.class.getName() + ".items", jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Customer.class.getName(), jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Customer.class.getName() + ".items", jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Cart.class.getName(), jcacheConfiguration);
cm.createCache(org.apeps.firstapp.domain.Cart.class.getName() + ".items", jcacheConfiguration);

// jhipster-needle-ehcache-add-entry
};
}
Expand Down
111 changes: 111 additions & 0 deletions src/main/java/org/apeps/firstapp/domain/Cart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package org.apeps.firstapp.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;

/**
* A Cart.
*/
@Entity
@Table(name = "cart")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Cart implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;

@OneToMany(mappedBy = "cart")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Item> items = new HashSet<>();

@OneToOne(mappedBy = "cart")
@JsonIgnore
private Customer customer;

// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}

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

public Set<Item> getItems() {
return items;
}

public Cart items(Set<Item> items) {
this.items = items;
return this;
}

public Cart addItem(Item item) {
this.items.add(item);
item.setCart(this);
return this;
}

public Cart removeItem(Item item) {
this.items.remove(item);
item.setCart(null);
return this;
}

public void setItems(Set<Item> items) {
this.items = items;
}

public Customer getCustomer() {
return customer;
}

public Cart customer(Customer customer) {
this.customer = customer;
return this;
}

public void setCustomer(Customer customer) {
this.customer = customer;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Cart cart = (Cart) o;
if (cart.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), cart.getId());
}

@Override
public int hashCode() {
return Objects.hashCode(getId());
}

@Override
public String toString() {
return "Cart{" +
"id=" + getId() +
"}";
}
}
129 changes: 129 additions & 0 deletions src/main/java/org/apeps/firstapp/domain/Category.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package org.apeps.firstapp.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 Category.
*/
@Entity
@Table(name = "category")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Category implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;

@NotNull
@Column(name = "name", nullable = false)
private String name;

@OneToMany(mappedBy = "category")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Item> items = new HashSet<>();

@ManyToOne
private Category parent;

// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}

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

public String getName() {
return name;
}

public Category name(String name) {
this.name = name;
return this;
}

public void setName(String name) {
this.name = name;
}

public Set<Item> getItems() {
return items;
}

public Category items(Set<Item> items) {
this.items = items;
return this;
}

public Category addItem(Item item) {
this.items.add(item);
item.setCategory(this);
return this;
}

public Category removeItem(Item item) {
this.items.remove(item);
item.setCategory(null);
return this;
}

public void setItems(Set<Item> items) {
this.items = items;
}

public Category getParent() {
return parent;
}

public Category parent(Category category) {
this.parent = category;
return this;
}

public void setParent(Category category) {
this.parent = category;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
if (category.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), category.getId());
}

@Override
public int hashCode() {
return Objects.hashCode(getId());
}

@Override
public String toString() {
return "Category{" +
"id=" + getId() +
", name='" + getName() + "'" +
"}";
}
}
Loading

0 comments on commit ba45dae

Please sign in to comment.