From 33ca1ca7f925b860ed9548626456d2776c85b3af Mon Sep 17 00:00:00 2001 From: sockenklaus Date: Fri, 29 May 2020 19:41:39 +0200 Subject: [PATCH] Added cross references, cleaned the persistence config, added default tab view for Article and order. --- i18n/Babydatenbank-labels_de.properties | 42 ++++---- persistence/META-INF/persistence.xml | 17 +--- properties/xava.properties | 4 +- .../babydatenbank/model/Article.java | 9 +- .../babydatenbank/model/Brand.java | 10 +- .../babydatenbank/model/Category.java | 87 ++++++++++------- .../babydatenbank/model/Condition.java | 92 +++++++++--------- .../babydatenbank/model/Pattern.java | 88 ++++++++++------- .../yourcompany/babydatenbank/model/Size.java | 74 +++++++------- web/META-INF/context.xml | 2 +- web/WEB-INF/lib/addons.jar | Bin 42572 -> 42577 bytes web/WEB-INF/lib/openxava.jar | Bin 1675008 -> 1675013 bytes 12 files changed, 225 insertions(+), 200 deletions(-) diff --git a/i18n/Babydatenbank-labels_de.properties b/i18n/Babydatenbank-labels_de.properties index 8ae4570..f7aec0c 100644 --- a/i18n/Babydatenbank-labels_de.properties +++ b/i18n/Babydatenbank-labels_de.properties @@ -1,19 +1,23 @@ -# Module -Article.module=Artikel -Brand.module=Marken -Condition.module=Zustand -Pattern.module=Muster -Size.module=Größen -Category.module=Kategorien - -# Fields -buyPrice=Einkaufspreis -sellPrice=Verkaufspreis -originalPrice=Originalpreis -buyAndSell=Kaufen und Verkaufen -buyDate=Kaufdatum -sellDate=Verkaufsdatum -pattern=Muster -brand=Marke -condition=Zustand -size=Größe \ No newline at end of file +# Module +Article.module=Artikel +Brand.module=Marken +Condition.module=Zustand +Pattern.module=Muster +Size.module=Größen +Category.module=Kategorien + +# Fields +buyPrice=Einkaufspreis +sellPrice=Verkaufspreis +originalPrice=Originalpreis +buyAndSell=Kaufen und Verkaufen +buyDate=Kaufdatum +sellDate=Verkaufsdatum +pattern=Muster +brand=Marke +condition=Zustand +size=Größe + +# ??? +Cards=Karten +and=und \ No newline at end of file diff --git a/persistence/META-INF/persistence.xml b/persistence/META-INF/persistence.xml index 7a8d090..aae6fc7 100644 --- a/persistence/META-INF/persistence.xml +++ b/persistence/META-INF/persistence.xml @@ -8,22 +8,15 @@ org.hibernate.jpa.HibernatePersistenceProvider + java://comp/env/jdbc/BabydatenbankDS org.openxava.session.GalleryImage org.openxava.web.editors.DiscussionComment - - - - + + + - - - - - - - - + diff --git a/properties/xava.properties b/properties/xava.properties index ad2620d..35c452e 100644 --- a/properties/xava.properties +++ b/properties/xava.properties @@ -45,12 +45,12 @@ smtpStartTLSEnable=false # This affects only if Java logging is used (usually in Tomcat and WebSphere). # It does not affect log4j configuration (usually in JBoss or if you use log4j in your app). # Default value is INFO -javaLoggingLevel=FINE +javaLoggingLevel=WARNING # LOGGING LEVEL FOR HIBERNATE ENGINE # Possibles values are: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL, OFF # Default value is INFO -#hibernateJavaLoggingLevel=FINEST +hibernateJavaLoggingLevel=WARNING # help #helpAvailable=false diff --git a/src/com/yourcompany/babydatenbank/model/Article.java b/src/com/yourcompany/babydatenbank/model/Article.java index de3be5a..7136548 100644 --- a/src/com/yourcompany/babydatenbank/model/Article.java +++ b/src/com/yourcompany/babydatenbank/model/Article.java @@ -18,11 +18,12 @@ import java.time.*; "#buyDate, sellDate];" + "remarks" ) +@Tab(properties="name, photo, category.description, brand.description, pattern.description, size.description, condition.description, remarks", defaultOrder="${name} asc") public class Article { - @Id @Hidden @GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1) - @GenericGenerator(name="system-uuid", strategy = "uuid") - @Column(length=32) + @Id @Hidden @GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1) + @GenericGenerator(name="system-uuid2", strategy = "uuid2") + @Column(length=36) private String oid; @Column(length=32) @@ -42,7 +43,7 @@ public class Article { @DescriptionsList private Pattern pattern; - @ManyToOne(optional=true, fetch = FetchType.EAGER) + @ManyToOne @NoModify @DescriptionsList private Category category; diff --git a/src/com/yourcompany/babydatenbank/model/Brand.java b/src/com/yourcompany/babydatenbank/model/Brand.java index 9e9e772..48a9707 100644 --- a/src/com/yourcompany/babydatenbank/model/Brand.java +++ b/src/com/yourcompany/babydatenbank/model/Brand.java @@ -10,16 +10,16 @@ public class Brand { @Id @Hidden - @GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1) - @GenericGenerator(name="system-uuid", strategy = "uuid") - @Column(length=32) + @GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1) + @GenericGenerator(name="system-uuid2", strategy = "uuid2") + @Column(length=36) private String oid; @Column(length=20) private String description; - @OneToMany(mappedBy="brand", fetch = FetchType.EAGER) - @ListProperties("name, category.description") + @OneToMany(mappedBy="brand") + @ListProperties("name, category.description, pattern.description, size.description, condition.description") private Collection
articles; public String getOid() { diff --git a/src/com/yourcompany/babydatenbank/model/Category.java b/src/com/yourcompany/babydatenbank/model/Category.java index eb4677f..426875a 100644 --- a/src/com/yourcompany/babydatenbank/model/Category.java +++ b/src/com/yourcompany/babydatenbank/model/Category.java @@ -1,37 +1,50 @@ -package com.yourcompany.babydatenbank.model; - -import javax.persistence.*; - -import org.hibernate.annotations.GenericGenerator; -import org.openxava.annotations.*; - -@Entity -public class Category { - @Id - @Hidden - @GeneratedValue(generator="system-uuid") - @GenericGenerator(name="system-uuid", strategy = "uuid") - @Column(length=32) - private String oid; - - @Column(length=20) - private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getOid() { - return oid; - } - - public void setOid(String oid) { - this.oid = oid; - } - - -} +package com.yourcompany.babydatenbank.model; + +import javax.persistence.*; +import java.util.*; +import org.hibernate.annotations.GenericGenerator; +import org.openxava.annotations.*; + +@Entity +public class Category { + @Id + @Hidden + @GeneratedValue(generator="system-uuid2") + @GenericGenerator(name="system-uuid2", strategy = "uuid2") + @Column(length=36) + private String oid; + + @Column(length=20) + private String description; + + @OneToMany(mappedBy="category") + @ListProperties("name, brand.description, pattern.description, size.description, condition.description") + private Collection
articles; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOid() { + return oid; + } + + public void setOid(String oid) { + this.oid = oid; + } + + public Collection
getArticles() { + return articles; + } + + public void setArticles(Collection
articles) { + this.articles = articles; + } + + + +} diff --git a/src/com/yourcompany/babydatenbank/model/Condition.java b/src/com/yourcompany/babydatenbank/model/Condition.java index 4af022e..e8436e4 100644 --- a/src/com/yourcompany/babydatenbank/model/Condition.java +++ b/src/com/yourcompany/babydatenbank/model/Condition.java @@ -1,46 +1,46 @@ -package com.yourcompany.babydatenbank.model; - -import javax.persistence.*; -import org.hibernate.annotations.GenericGenerator; -import org.openxava.annotations.*; - -@Entity -public class Condition { - @Id - @Hidden - @GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1) - @GenericGenerator(name="system-uuid", strategy = "uuid") - @Column(length=32) - private String oid; - - @Column(length=4) - private int number; - - @Column(length=32) - private String description; - - public String getOid() { - return oid; - } - - public void setOid(String oid) { - this.oid = oid; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getNumber() { - return this.number; - } - - public void setNumber(int number) { - this.number = number; - } - -} +package com.yourcompany.babydatenbank.model; + +import javax.persistence.*; +import org.hibernate.annotations.GenericGenerator; +import org.openxava.annotations.*; + +@Entity +public class Condition { + @Id + @Hidden + @GeneratedValue(generator="system-uuid2") + @GenericGenerator(name="system-uuid2", strategy = "uuid2") + @Column(length=36) + private String oid; + + @Column(length=4) + private int number; + + @Column(length=32) + private String description; + + public String getOid() { + return oid; + } + + public void setOid(String oid) { + this.oid = oid; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getNumber() { + return this.number; + } + + public void setNumber(int number) { + this.number = number; + } + +} diff --git a/src/com/yourcompany/babydatenbank/model/Pattern.java b/src/com/yourcompany/babydatenbank/model/Pattern.java index faef908..68e38ec 100644 --- a/src/com/yourcompany/babydatenbank/model/Pattern.java +++ b/src/com/yourcompany/babydatenbank/model/Pattern.java @@ -1,37 +1,51 @@ -package com.yourcompany.babydatenbank.model; - -import javax.persistence.*; -import org.hibernate.annotations.GenericGenerator; -import org.openxava.annotations.*; - -@Entity -public class Pattern { - - @Id - @Hidden - @GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1) - @GenericGenerator(name="system-uuid", strategy = "uuid") - @Column(length=32) - private String oid; - - @Column(length=20) - private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getOid() { - return oid; - } - - public void setOid(String oid) { - this.oid = oid; - } - - -} +package com.yourcompany.babydatenbank.model; + +import javax.persistence.*; +import org.hibernate.annotations.GenericGenerator; +import org.openxava.annotations.*; +import java.util.*; + +@Entity +public class Pattern { + + @Id + @Hidden + @GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1) + @GenericGenerator(name="system-uuid2", strategy = "uuid2") + @Column(length=36) + private String oid; + + @Column(length=20) + private String description; + + @OneToMany(mappedBy="pattern") + @ListProperties("name, brand.description, category.description, size.description, condition.description") + private Collection
articles; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOid() { + return oid; + } + + public void setOid(String oid) { + this.oid = oid; + } + + public Collection
getArticles() { + return articles; + } + + public void setArticles(Collection
articles) { + this.articles = articles; + } + + + +} diff --git a/src/com/yourcompany/babydatenbank/model/Size.java b/src/com/yourcompany/babydatenbank/model/Size.java index 35971c4..641c2b5 100644 --- a/src/com/yourcompany/babydatenbank/model/Size.java +++ b/src/com/yourcompany/babydatenbank/model/Size.java @@ -1,37 +1,37 @@ -package com.yourcompany.babydatenbank.model; - -import javax.persistence.*; -import org.openxava.annotations.*; -import org.hibernate.annotations.GenericGenerator; - -@Entity -public class Size { - - @Id - @Hidden - @GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1) - @GenericGenerator(name="system-uuid", strategy = "uuid") - @Column(length=32) - private String oid; - - @Column(length=20) - private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getOid() { - return oid; - } - - public void setOid(String oid) { - this.oid = oid; - } - - -} +package com.yourcompany.babydatenbank.model; + +import javax.persistence.*; +import org.openxava.annotations.*; +import org.hibernate.annotations.GenericGenerator; + +@Entity +public class Size { + + @Id + @Hidden + @GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1) + @GenericGenerator(name="system-uuid2", strategy = "uuid2") + @Column(length=36) + private String oid; + + @Column(length=20) + private String description; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOid() { + return oid; + } + + public void setOid(String oid) { + this.oid = oid; + } + + +} diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml index f1b4438..eb36b84 100644 --- a/web/META-INF/context.xml +++ b/web/META-INF/context.xml @@ -29,7 +29,7 @@ + url="jdbc:mysql://localhost:3306/?serverTimezone=Europe/Berlin&useUnicode=true&characterEncoding=UTF-8"/>