-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from apeps/shop-entity
issue #4
- Loading branch information
Showing
59 changed files
with
3,870 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"fluentMethods": true, | ||
"relationships": [ | ||
{ | ||
"relationshipType": "one-to-many", | ||
"relationshipName": "item", | ||
"otherEntityName": "item", | ||
"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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "customer", | ||
"otherEntityName": "customer", | ||
"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": "infinite-scroll", | ||
"service": "serviceClass", | ||
"jpaMetamodelFiltering": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() + "'" + | ||
"}"; | ||
} | ||
} |
Oops, something went wrong.