-
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.
- Loading branch information
1 parent
98345c9
commit 7ed39a6
Showing
40 changed files
with
2,327 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,45 @@ | ||
{ | ||
"fluentMethods": true, | ||
"relationships": [ | ||
{ | ||
"relationshipType": "one-to-many", | ||
"relationshipName": "prices", | ||
"otherEntityName": "price", | ||
"otherEntityRelationshipName": "offering" | ||
}, | ||
{ | ||
"relationshipName": "offering", | ||
"otherEntityName": "offering", | ||
"relationshipType": "many-to-one", | ||
"otherEntityField": "id" | ||
}, | ||
{ | ||
"relationshipType": "one-to-many", | ||
"relationshipName": "childs", | ||
"otherEntityName": "offering", | ||
"otherEntityRelationshipName": "offering" | ||
} | ||
], | ||
"fields": [ | ||
{ | ||
"fieldName": "name", | ||
"fieldType": "String", | ||
"fieldValidateRules": [ | ||
"required" | ||
] | ||
}, | ||
{ | ||
"fieldName": "description", | ||
"fieldType": "String", | ||
"fieldValidateRules": [ | ||
"required" | ||
] | ||
} | ||
], | ||
"changelogDate": "20171118114136", | ||
"entityTableName": "offering", | ||
"dto": "no", | ||
"pagination": "no", | ||
"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,26 @@ | ||
{ | ||
"fluentMethods": true, | ||
"relationships": [ | ||
{ | ||
"relationshipName": "offering", | ||
"otherEntityName": "offering", | ||
"relationshipType": "many-to-one", | ||
"otherEntityField": "id" | ||
} | ||
], | ||
"fields": [ | ||
{ | ||
"fieldName": "value", | ||
"fieldType": "Double", | ||
"fieldValidateRules": [ | ||
"required" | ||
] | ||
} | ||
], | ||
"changelogDate": "20171118114137", | ||
"entityTableName": "price", | ||
"dto": "no", | ||
"pagination": "no", | ||
"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
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,177 @@ | ||
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 Offering. | ||
*/ | ||
@Entity | ||
@Table(name = "offering") | ||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | ||
public class Offering 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; | ||
|
||
@NotNull | ||
@Column(name = "description", nullable = false) | ||
private String description; | ||
|
||
@OneToMany(mappedBy = "offering") | ||
@JsonIgnore | ||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | ||
private Set<Price> prices = new HashSet<>(); | ||
|
||
@ManyToOne | ||
private Offering offering; | ||
|
||
@OneToMany(mappedBy = "offering") | ||
@JsonIgnore | ||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | ||
private Set<Offering> childs = new HashSet<>(); | ||
|
||
// 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 Offering name(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public Offering description(String description) { | ||
this.description = description; | ||
return this; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public Set<Price> getPrices() { | ||
return prices; | ||
} | ||
|
||
public Offering prices(Set<Price> prices) { | ||
this.prices = prices; | ||
return this; | ||
} | ||
|
||
public Offering addPrices(Price price) { | ||
this.prices.add(price); | ||
price.setOffering(this); | ||
return this; | ||
} | ||
|
||
public Offering removePrices(Price price) { | ||
this.prices.remove(price); | ||
price.setOffering(null); | ||
return this; | ||
} | ||
|
||
public void setPrices(Set<Price> prices) { | ||
this.prices = prices; | ||
} | ||
|
||
public Offering getOffering() { | ||
return offering; | ||
} | ||
|
||
public Offering offering(Offering offering) { | ||
this.offering = offering; | ||
return this; | ||
} | ||
|
||
public void setOffering(Offering offering) { | ||
this.offering = offering; | ||
} | ||
|
||
public Set<Offering> getChilds() { | ||
return childs; | ||
} | ||
|
||
public Offering childs(Set<Offering> offerings) { | ||
this.childs = offerings; | ||
return this; | ||
} | ||
|
||
public Offering addChilds(Offering offering) { | ||
this.childs.add(offering); | ||
offering.setOffering(this); | ||
return this; | ||
} | ||
|
||
public Offering removeChilds(Offering offering) { | ||
this.childs.remove(offering); | ||
offering.setOffering(null); | ||
return this; | ||
} | ||
|
||
public void setChilds(Set<Offering> offerings) { | ||
this.childs = offerings; | ||
} | ||
// 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; | ||
} | ||
Offering offering = (Offering) o; | ||
if (offering.getId() == null || getId() == null) { | ||
return false; | ||
} | ||
return Objects.equals(getId(), offering.getId()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(getId()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Offering{" + | ||
"id=" + getId() + | ||
", name='" + getName() + "'" + | ||
", description='" + getDescription() + "'" + | ||
"}"; | ||
} | ||
} |
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,96 @@ | ||
package org.apeps.firstapp.domain; | ||
|
||
import org.hibernate.annotations.Cache; | ||
import org.hibernate.annotations.CacheConcurrencyStrategy; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.*; | ||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
/** | ||
* A Price. | ||
*/ | ||
@Entity | ||
@Table(name = "price") | ||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | ||
public class Price implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") | ||
@SequenceGenerator(name = "sequenceGenerator") | ||
private Long id; | ||
|
||
@NotNull | ||
@Column(name = "jhi_value", nullable = false) | ||
private Double value; | ||
|
||
@ManyToOne | ||
private Offering offering; | ||
|
||
// 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 Double getValue() { | ||
return value; | ||
} | ||
|
||
public Price value(Double value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
public void setValue(Double value) { | ||
this.value = value; | ||
} | ||
|
||
public Offering getOffering() { | ||
return offering; | ||
} | ||
|
||
public Price offering(Offering offering) { | ||
this.offering = offering; | ||
return this; | ||
} | ||
|
||
public void setOffering(Offering offering) { | ||
this.offering = offering; | ||
} | ||
// 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; | ||
} | ||
Price price = (Price) o; | ||
if (price.getId() == null || getId() == null) { | ||
return false; | ||
} | ||
return Objects.equals(getId(), price.getId()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(getId()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Price{" + | ||
"id=" + getId() + | ||
", value='" + getValue() + "'" + | ||
"}"; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/org/apeps/firstapp/repository/OfferingRepository.java
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,16 @@ | ||
package org.apeps.firstapp.repository; | ||
|
||
import org.apeps.firstapp.domain.Offering; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import org.springframework.data.jpa.repository.*; | ||
|
||
|
||
/** | ||
* Spring Data JPA repository for the Offering entity. | ||
*/ | ||
@SuppressWarnings("unused") | ||
@Repository | ||
public interface OfferingRepository extends JpaRepository<Offering, Long> { | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/org/apeps/firstapp/repository/PriceRepository.java
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,16 @@ | ||
package org.apeps.firstapp.repository; | ||
|
||
import org.apeps.firstapp.domain.Price; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import org.springframework.data.jpa.repository.*; | ||
|
||
|
||
/** | ||
* Spring Data JPA repository for the Price entity. | ||
*/ | ||
@SuppressWarnings("unused") | ||
@Repository | ||
public interface PriceRepository extends JpaRepository<Price, Long> { | ||
|
||
} |
Oops, something went wrong.