Commit 1d28b4f7 authored by vagrant's avatar vagrant

jdl

parent 5827d8d3
Pipeline #10378 failed
{
"name": "Campaign",
"fields": [
{
"fieldName": "name",
"fieldType": "String"
},
{
"fieldName": "state",
"fieldType": "State",
"fieldValues": "STARTED,FINISHED,COMING_SOON"
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"relationshipName": "offer",
"otherEntityName": "offer",
"otherEntityRelationshipName": "campaign"
},
{
"relationshipType": "many-to-one",
"relationshipName": "user",
"otherEntityName": "user",
"otherEntityField": "id"
},
{
"relationshipType": "one-to-one",
"relationshipName": "analysis",
"otherEntityName": "campaignAnalysis",
"ownerSide": false,
"otherEntityRelationshipName": "campaignAnalysis"
}
],
"changelogDate": "20190124134238",
"entityTableName": "campaign",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
{
"name": "CampaignAnalysis",
"fields": [
{
"fieldName": "views",
"fieldType": "Integer"
},
{
"fieldName": "shares",
"fieldType": "Integer"
},
{
"fieldName": "likes",
"fieldType": "Integer"
},
{
"fieldName": "orders",
"fieldType": "Integer"
}
],
"relationships": [
{
"relationshipType": "one-to-one",
"relationshipName": "campaign",
"otherEntityName": "campaign",
"otherEntityField": "id",
"ownerSide": true,
"otherEntityRelationshipName": "analysis"
}
],
"changelogDate": "20190124134241",
"entityTableName": "campaign_analysis",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
{
"name": "Offer",
"fields": [
{
"fieldName": "promotionCode",
"fieldType": "String"
},
{
"fieldName": "hashtag",
"fieldType": "String"
},
{
"fieldName": "name",
"fieldType": "String"
}
],
"relationships": [
{
"relationshipType": "one-to-one",
"relationshipName": "product",
"otherEntityName": "product",
"otherEntityField": "id",
"ownerSide": true,
"otherEntityRelationshipName": "offer"
},
{
"relationshipType": "many-to-one",
"relationshipName": "brand",
"otherEntityName": "user",
"otherEntityField": "id"
},
{
"relationshipType": "many-to-one",
"relationshipName": "campaign",
"otherEntityName": "campaign",
"otherEntityField": "id"
}
],
"changelogDate": "20190124134239",
"entityTableName": "offer",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
{
"name": "Product",
"fields": [
{
"fieldName": "name",
"fieldType": "String"
},
{
"fieldName": "category",
"fieldType": "String"
},
{
"fieldName": "type",
"fieldType": "String"
},
{
"fieldName": "price",
"fieldType": "String"
},
{
"fieldName": "description",
"fieldType": "String"
},
{
"fieldName": "image",
"fieldType": "byte[]",
"fieldTypeBlobContent": "any"
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"relationshipName": "brand",
"otherEntityName": "user",
"otherEntityField": "id"
}
],
"changelogDate": "20190124134240",
"entityTableName": "product",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
entity Campaign {
name String,
state State
}
enum State{
STARTED, FINISHED, COMING_SOON
}
entity Offer {
promotionCode String
hashtag String
name String
}
entity Product {
name String
category String
type String
price String
description String
image Blob
}
entity CampaignAnalysis {
views Integer
shares Integer
likes Integer
orders Integer
}
relationship OneToOne {
CampaignAnalysis to Campaign{analysis}
}
relationship OneToOne {
Offer{product} to Product
}
relationship OneToMany {
Campaign{offer} to Offer{campaign}
}
relationship ManyToOne {
Campaign to User
}
relationship ManyToOne {
Product{brand} to User
}
relationship ManyToOne {
Offer{brand} to User
}
......@@ -38,6 +38,11 @@ public class CacheConfiguration {
cm.createCache(com.mycompany.myapp.domain.User.class.getName(), jcacheConfiguration);
cm.createCache(com.mycompany.myapp.domain.Authority.class.getName(), jcacheConfiguration);
cm.createCache(com.mycompany.myapp.domain.User.class.getName() + ".authorities", jcacheConfiguration);
cm.createCache(com.mycompany.myapp.domain.Campaign.class.getName(), jcacheConfiguration);
cm.createCache(com.mycompany.myapp.domain.Campaign.class.getName() + ".offers", jcacheConfiguration);
cm.createCache(com.mycompany.myapp.domain.Offer.class.getName(), jcacheConfiguration);
cm.createCache(com.mycompany.myapp.domain.Product.class.getName(), jcacheConfiguration);
cm.createCache(com.mycompany.myapp.domain.CampaignAnalysis.class.getName(), jcacheConfiguration);
// jhipster-needle-ehcache-add-entry
};
}
......
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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;
import com.mycompany.myapp.domain.enumeration.State;
/**
* A Campaign.
*/
@Entity
@Table(name = "campaign")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Campaign implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "name")
private String name;
@Enumerated(EnumType.STRING)
@Column(name = "state")
private State state;
@OneToMany(mappedBy = "campaign")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Offer> offers = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties("")
private User user;
@OneToOne(mappedBy = "campaignAnalysis")
@JsonIgnore
private CampaignAnalysis analysis;
// 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 Campaign name(String name) {
this.name = name;
return this;
}
public void setName(String name) {
this.name = name;
}
public State getState() {
return state;
}
public Campaign state(State state) {
this.state = state;
return this;
}
public void setState(State state) {
this.state = state;
}
public Set<Offer> getOffers() {
return offers;
}
public Campaign offers(Set<Offer> offers) {
this.offers = offers;
return this;
}
public Campaign addOffer(Offer offer) {
this.offers.add(offer);
offer.setCampaign(this);
return this;
}
public Campaign removeOffer(Offer offer) {
this.offers.remove(offer);
offer.setCampaign(null);
return this;
}
public void setOffers(Set<Offer> offers) {
this.offers = offers;
}
public User getUser() {
return user;
}
public Campaign user(User user) {
this.user = user;
return this;
}
public void setUser(User user) {
this.user = user;
}
public CampaignAnalysis getAnalysis() {
return analysis;
}
public Campaign analysis(CampaignAnalysis campaignAnalysis) {
this.analysis = campaignAnalysis;
return this;
}
public void setAnalysis(CampaignAnalysis campaignAnalysis) {
this.analysis = campaignAnalysis;
}
// 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;
}
Campaign campaign = (Campaign) o;
if (campaign.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), campaign.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Campaign{" +
"id=" + getId() +
", name='" + getName() + "'" +
", state='" + getState() + "'" +
"}";
}
}
package com.mycompany.myapp.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A CampaignAnalysis.
*/
@Entity
@Table(name = "campaign_analysis")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CampaignAnalysis implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "views")
private Integer views;
@Column(name = "shares")
private Integer shares;
@Column(name = "likes")
private Integer likes;
@Column(name = "orders")
private Integer orders;
@OneToOne @JoinColumn(unique = true)
private Campaign campaign;
// 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 Integer getViews() {
return views;
}
public CampaignAnalysis views(Integer views) {
this.views = views;
return this;
}
public void setViews(Integer views) {
this.views = views;
}
public Integer getShares() {
return shares;
}
public CampaignAnalysis shares(Integer shares) {
this.shares = shares;
return this;
}
public void setShares(Integer shares) {
this.shares = shares;
}
public Integer getLikes() {
return likes;
}
public CampaignAnalysis likes(Integer likes) {
this.likes = likes;
return this;
}
public void setLikes(Integer likes) {
this.likes = likes;
}
public Integer getOrders() {
return orders;
}
public CampaignAnalysis orders(Integer orders) {
this.orders = orders;
return this;
}
public void setOrders(Integer orders) {
this.orders = orders;
}
public Campaign getCampaign() {
return campaign;
}
public CampaignAnalysis campaign(Campaign campaign) {
this.campaign = campaign;
return this;
}
public void setCampaign(Campaign campaign) {
this.campaign = campaign;
}
// 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;
}
CampaignAnalysis campaignAnalysis = (CampaignAnalysis) o;
if (campaignAnalysis.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), campaignAnalysis.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "CampaignAnalysis{" +
"id=" + getId() +
", views=" + getViews() +
", shares=" + getShares() +
", likes=" + getLikes() +
", orders=" + getOrders() +
"}";
}
}
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A Offer.
*/
@Entity
@Table(name = "offer")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Offer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "promotion_code")
private String promotionCode;
@Column(name = "hashtag")
private String hashtag;
@Column(name = "name")
private String name;
@OneToOne @JoinColumn(unique = true)
private Product product;
@ManyToOne
@JsonIgnoreProperties("")
private User brand;
@ManyToOne
@JsonIgnoreProperties("offers")
private Campaign campaign;
// 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 getPromotionCode() {
return promotionCode;
}
public Offer promotionCode(String promotionCode) {
this.promotionCode = promotionCode;
return this;
}
public void setPromotionCode(String promotionCode) {
this.promotionCode = promotionCode;
}
public String getHashtag() {
return hashtag;
}
public Offer hashtag(String hashtag) {
this.hashtag = hashtag;
return this;
}
public void setHashtag(String hashtag) {
this.hashtag = hashtag;
}
public String getName() {
return name;
}
public Offer name(String name) {
this.name = name;
return this;
}
public void setName(String name) {
this.name = name;
}
public Product getProduct() {
return product;
}
public Offer product(Product product) {