diff --git a/pom.xml b/pom.xml
index 0f1d7929..69d4df31 100644
--- a/pom.xml
+++ b/pom.xml
@@ -229,7 +229,12 @@
hibernate-search
4.4.6.Final
-
+
+ org.hibernate
+ hibernate-ehcache
+ 4.2.8.Final
+
+
org.zkoss.zk
diff --git a/src/main/java/info/bukova/isspst/data/BaseData.java b/src/main/java/info/bukova/isspst/data/BaseData.java
index 8977fba5..b36b38d5 100644
--- a/src/main/java/info/bukova/isspst/data/BaseData.java
+++ b/src/main/java/info/bukova/isspst/data/BaseData.java
@@ -1,6 +1,9 @@
package info.bukova.isspst.data;
-import java.util.Date;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.Column;
import javax.persistence.FetchType;
@@ -10,9 +13,7 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
-
-import org.hibernate.search.annotations.Indexed;
-import org.hibernate.search.annotations.IndexedEmbedded;
+import java.util.Date;
@MappedSuperclass
@Indexed
@@ -29,10 +30,12 @@ public abstract class BaseData implements OwnedDataModel {
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="OWNED_BY_ID")
@IndexedEmbedded
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private User ownedBy;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="MODIFIED_BY_ID")
@IndexedEmbedded
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private User modifiedBy;
@Transient
private boolean valid;
diff --git a/src/main/java/info/bukova/isspst/data/JobMapping.java b/src/main/java/info/bukova/isspst/data/JobMapping.java
index 811002bd..7478b885 100644
--- a/src/main/java/info/bukova/isspst/data/JobMapping.java
+++ b/src/main/java/info/bukova/isspst/data/JobMapping.java
@@ -1,5 +1,8 @@
package info.bukova.isspst.data;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@@ -11,6 +14,7 @@ import javax.persistence.Table;
@Entity
@Table(name = "JOBMAPPING")
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class JobMapping {
@Id
@@ -19,9 +23,11 @@ public class JobMapping {
private int id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "MEMBER_ID")
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Member member;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "ROLE_ID")
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Role role;
public JobMapping() {
diff --git a/src/main/java/info/bukova/isspst/data/Member.java b/src/main/java/info/bukova/isspst/data/Member.java
index ad976e3d..47383876 100644
--- a/src/main/java/info/bukova/isspst/data/Member.java
+++ b/src/main/java/info/bukova/isspst/data/Member.java
@@ -1,8 +1,9 @@
package info.bukova.isspst.data;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -15,12 +16,13 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Transient;
-
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyCollectionOption;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public abstract class Member implements DataModel {
@Id
@@ -33,6 +35,7 @@ public abstract class Member implements DataModel {
@ManyToMany
@LazyCollection(LazyCollectionOption.TRUE)
@JoinTable(name="MEMBER_PARENT", joinColumns={@JoinColumn(name="MEMBER_ID")}, inverseJoinColumns={@JoinColumn(name="PARENT_ID")})
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List parents;
@Transient
private boolean valid;
diff --git a/src/main/java/info/bukova/isspst/data/Permission.java b/src/main/java/info/bukova/isspst/data/Permission.java
index a56619f1..d2ff07e4 100644
--- a/src/main/java/info/bukova/isspst/data/Permission.java
+++ b/src/main/java/info/bukova/isspst/data/Permission.java
@@ -1,6 +1,9 @@
package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.springframework.security.core.GrantedAuthority;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -8,10 +11,9 @@ import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
-import org.springframework.security.core.GrantedAuthority;
-
@Entity
@Table(name="PERMISSION")
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Permission extends BaseSimpleData implements GrantedAuthority {
/**
diff --git a/src/main/java/info/bukova/isspst/data/Requirement.java b/src/main/java/info/bukova/isspst/data/Requirement.java
index 1aa97a38..565fbe99 100644
--- a/src/main/java/info/bukova/isspst/data/Requirement.java
+++ b/src/main/java/info/bukova/isspst/data/Requirement.java
@@ -1,9 +1,7 @@
package info.bukova.isspst.data;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -11,9 +9,10 @@ import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-
-import org.hibernate.search.annotations.Indexed;
-import org.hibernate.search.annotations.IndexedEmbedded;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
@Entity
@Table(name = "REQUIREMENT")
diff --git a/src/main/java/info/bukova/isspst/data/RequirementBase.java b/src/main/java/info/bukova/isspst/data/RequirementBase.java
index a7e60f59..6451f5d4 100644
--- a/src/main/java/info/bukova/isspst/data/RequirementBase.java
+++ b/src/main/java/info/bukova/isspst/data/RequirementBase.java
@@ -1,6 +1,8 @@
package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.Analyze;
@@ -24,6 +26,7 @@ import java.util.List;
@MappedSuperclass
@Indexed
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class RequirementBase extends BaseData implements FilterableRequirement, SeasonsAware {
@ManyToOne(fetch = FetchType.LAZY)
@@ -43,9 +46,11 @@ public class RequirementBase extends BaseData implements FilterableRequirement,
private String description;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "CENTRE_ID")
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Workgroup centre;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "WORKGROUP_ID")
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Workgroup workgroup;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@LazyCollection(LazyCollectionOption.TRUE)
@@ -56,6 +61,7 @@ public class RequirementBase extends BaseData implements FilterableRequirement,
private RequirementState state;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "SEASON_ID")
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Season season;
public RequirementBase() {
diff --git a/src/main/java/info/bukova/isspst/data/Role.java b/src/main/java/info/bukova/isspst/data/Role.java
index ad7876cd..6a14fb03 100644
--- a/src/main/java/info/bukova/isspst/data/Role.java
+++ b/src/main/java/info/bukova/isspst/data/Role.java
@@ -1,9 +1,11 @@
package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
-
-import java.util.ArrayList;
-import java.util.List;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
+import org.springframework.security.core.GrantedAuthority;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -11,13 +13,12 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
-
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyCollectionOption;
-import org.springframework.security.core.GrantedAuthority;
+import java.util.ArrayList;
+import java.util.List;
@Entity
@Table(name="ROLE")
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Role extends BaseSimpleData implements GrantedAuthority, DataModel {
/**
@@ -32,6 +33,7 @@ public class Role extends BaseSimpleData implements GrantedAuthority, DataModel
@ManyToMany
@LazyCollection(LazyCollectionOption.FALSE)
@JoinTable(name="ROLE_PERMISSION", joinColumns={@JoinColumn(name="ROLE_ID")}, inverseJoinColumns={@JoinColumn(name="PERMISSION_ID")})
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List permissions;
@Column(name = "WORKGROUP")
private boolean workgroup;
diff --git a/src/main/java/info/bukova/isspst/data/Season.java b/src/main/java/info/bukova/isspst/data/Season.java
index b7e99e9e..de9eb515 100644
--- a/src/main/java/info/bukova/isspst/data/Season.java
+++ b/src/main/java/info/bukova/isspst/data/Season.java
@@ -1,5 +1,8 @@
package info.bukova.isspst.data;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@@ -10,6 +13,7 @@ import java.util.Date;
*/
@Entity
@Table(name = "SEASON")
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Season extends BaseData {
@Column(name = "DESCRIPTION")
private String description;
diff --git a/src/main/java/info/bukova/isspst/data/TripBill.java b/src/main/java/info/bukova/isspst/data/TripBill.java
index 6db8d6d3..20957fc4 100644
--- a/src/main/java/info/bukova/isspst/data/TripBill.java
+++ b/src/main/java/info/bukova/isspst/data/TripBill.java
@@ -2,6 +2,8 @@ package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.storage.EntityWithAttachment;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.Analyze;
@@ -31,6 +33,7 @@ public class TripBill extends BaseData implements EntityWithAttachment, SeasonsA
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "REQUIREMENT_ID")
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private TripRequirement requirement;
@Column(name = "RESULT_MESSAGE_DATE")
private Date resultMessageDate;
@@ -72,6 +75,7 @@ public class TripBill extends BaseData implements EntityWithAttachment, SeasonsA
private Date paidDate;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "SEASON_ID")
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Season season;
public TripBill() {
diff --git a/src/main/java/info/bukova/isspst/data/TripRequirement.java b/src/main/java/info/bukova/isspst/data/TripRequirement.java
index d40af017..a3f4098a 100644
--- a/src/main/java/info/bukova/isspst/data/TripRequirement.java
+++ b/src/main/java/info/bukova/isspst/data/TripRequirement.java
@@ -1,11 +1,13 @@
package info.bukova.isspst.data;
import info.bukova.isspst.storage.EntityWithAttachment;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
+import org.hibernate.search.annotations.Analyze;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -16,14 +18,10 @@ import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyCollectionOption;
-import org.hibernate.search.annotations.Analyze;
-import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.Index;
-import org.hibernate.search.annotations.Indexed;
-import org.hibernate.search.annotations.IndexedEmbedded;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
@Entity
@Table(name = "TRIPREQUIREMENT")
diff --git a/src/main/java/info/bukova/isspst/data/User.java b/src/main/java/info/bukova/isspst/data/User.java
index 144a2b7f..aa42455b 100644
--- a/src/main/java/info/bukova/isspst/data/User.java
+++ b/src/main/java/info/bukova/isspst/data/User.java
@@ -1,9 +1,13 @@
package info.bukova.isspst.data;
import info.bukova.isspst.StringUtils;
-
-import java.util.ArrayList;
-import java.util.List;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.search.annotations.Analyze;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
+import org.springframework.security.core.userdetails.UserDetails;
import javax.persistence.Column;
import javax.persistence.Embedded;
@@ -13,16 +17,13 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
-
-import org.hibernate.search.annotations.Analyze;
-import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.Index;
-import org.hibernate.search.annotations.Indexed;
-import org.springframework.security.core.userdetails.UserDetails;
+import java.util.ArrayList;
+import java.util.List;
@Entity
@Table(name="USER")
@Indexed
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class User extends Member implements UserDetails, DataModel {
/**
@@ -50,6 +51,7 @@ public class User extends Member implements UserDetails, DataModel {
private boolean notify;
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name="USER_ROLE", joinColumns={@JoinColumn(name="USER_ID")}, inverseJoinColumns={@JoinColumn(name="ROLE_ID")})
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List authorities;
@Column(name="SETTINGS", length=1048576)
private String settings;
diff --git a/src/main/java/info/bukova/isspst/data/Workgroup.java b/src/main/java/info/bukova/isspst/data/Workgroup.java
index b2efd95e..7954d083 100644
--- a/src/main/java/info/bukova/isspst/data/Workgroup.java
+++ b/src/main/java/info/bukova/isspst/data/Workgroup.java
@@ -1,11 +1,10 @@
package info.bukova.isspst.data;
import info.bukova.isspst.StringUtils;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -17,12 +16,14 @@ import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
-
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyCollectionOption;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
@Entity
@Table(name = "WORKGROUP")
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Workgroup extends Member implements OwnedDataModel, Serializable {
/**
@@ -37,6 +38,7 @@ public class Workgroup extends Member implements OwnedDataModel, Serializable {
@ManyToMany(cascade = {CascadeType.ALL})
@LazyCollection(LazyCollectionOption.TRUE)
@JoinTable(name="WORKGROUP_MEMBER", joinColumns={@JoinColumn(name="WORKGROUP_ID")}, inverseJoinColumns={@JoinColumn(name="JOBMAPPING_ID")})
+ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List members;
@Column(name = "CENTRE")
private boolean centre;
diff --git a/src/main/java/info/bukova/isspst/ui/ListViewModel.java b/src/main/java/info/bukova/isspst/ui/ListViewModel.java
index ab00cce5..bfa8f70a 100644
--- a/src/main/java/info/bukova/isspst/ui/ListViewModel.java
+++ b/src/main/java/info/bukova/isspst/ui/ListViewModel.java
@@ -23,6 +23,7 @@ import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.select.annotation.WireVariable;
+import org.zkoss.zul.Listheader;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window;
@@ -48,6 +49,7 @@ public class ListViewModel extends DocumentViewModel
private boolean sortDesc = true;
private boolean newRec = false;
private boolean fullFill = false;
+ private Listheader sortHeader;
@WireVariable
private SeasonService seasonService;
@@ -280,9 +282,13 @@ public class ListViewModel extends DocumentViewModel
dataList.set(selIndex, editBean);
}
}
-
+
BindUtils.postGlobalCommand(null, null, "reloadRelated", null);
-
+
+ if (sortHeader != null) {
+ sortHeader.setSortDirection("natural");
+ }
+
}
@GlobalCommand
@@ -334,13 +340,13 @@ public class ListViewModel extends DocumentViewModel
}
}
}
-
+
if (selIndex > -1) {
this.setDataBean(dataList.get(selIndex));
afterSelect();
}
}
-
+
protected void beforeSelectViaUrl() {
}
@@ -360,6 +366,14 @@ public class ListViewModel extends DocumentViewModel
dataBean = null;
}
+ @Command
+ @NotifyChange({"dataBean", "canApprove"})
+ public void onSortHeader(@BindingParam("header") Listheader header) {
+ sortHeader = header;
+ selIndex = -1;
+ dataBean = null;
+ }
+
public int getSelIndex() {
return this.selIndex;
}
diff --git a/src/main/webapp/WEB-INF/jdbc.properties b/src/main/webapp/WEB-INF/jdbc.properties
index 4e3ec948..35db1872 100644
--- a/src/main/webapp/WEB-INF/jdbc.properties
+++ b/src/main/webapp/WEB-INF/jdbc.properties
@@ -1,5 +1,5 @@
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.dialect=org.hibernate.dialect.MySQLDialect
-jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=latin2&autoReconnect=true
+jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst-ostra?characterEncoding=latin2&autoReconnect=true
jdbc.username=isspst
jdbc.password=xsacfgd
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/spring/root-context.xml b/src/main/webapp/WEB-INF/spring/root-context.xml
index cc08388d..943a3190 100644
--- a/src/main/webapp/WEB-INF/spring/root-context.xml
+++ b/src/main/webapp/WEB-INF/spring/root-context.xml
@@ -58,6 +58,10 @@
filesystem
${storage.fulltextIndex}
org.apache.lucene.analysis.cz.CzechAnalyzer
+ true
+ true
+ true
+ org.hibernate.cache.ehcache.EhCacheRegionFactory
diff --git a/src/main/webapp/app/template.zhtml b/src/main/webapp/app/template.zhtml
index 7db51024..62b24e51 100644
--- a/src/main/webapp/app/template.zhtml
+++ b/src/main/webapp/app/template.zhtml
@@ -51,6 +51,6 @@
-
+