Validace Budov.
This commit is contained in:
@@ -3,6 +3,10 @@ package info.bukova.isspst.data;
|
|||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
import org.hibernate.validator.constraints.NotEmpty;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="BUILDING")
|
@Table(name="BUILDING")
|
||||||
@@ -22,6 +26,9 @@ public class Building extends BaseData implements DataModel {
|
|||||||
/**
|
/**
|
||||||
* @return the code
|
* @return the code
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "${labels.BuildingsFormCodeConstr}")
|
||||||
|
@NotNull(message = "${labels.BuildingsFormCodeConstr}")
|
||||||
|
@NotEmpty(message = "${labels.BuildingsFormCodeConstr}")
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
package info.bukova.isspst.services;
|
package info.bukova.isspst.services.buildings;
|
||||||
|
|
||||||
import info.bukova.isspst.data.Building;
|
import info.bukova.isspst.data.Building;
|
||||||
|
import info.bukova.isspst.services.Service;
|
||||||
|
|
||||||
public interface BuildingService extends Service<Building> {
|
public interface BuildingService extends Service<Building> {
|
||||||
|
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
package info.bukova.isspst.services;
|
package info.bukova.isspst.services.buildings;
|
||||||
|
|
||||||
import info.bukova.isspst.data.Building;
|
import info.bukova.isspst.data.Building;
|
||||||
|
import info.bukova.isspst.services.AbstractService;
|
||||||
|
|
||||||
public class BuildingServiceImpl extends AbstractService<Building> implements BuildingService{
|
public class BuildingServiceImpl extends AbstractService<Building> implements BuildingService{
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package info.bukova.isspst.ui;
|
package info.bukova.isspst.ui;
|
||||||
|
|
||||||
import info.bukova.isspst.data.Building;
|
import info.bukova.isspst.data.Building;
|
||||||
import info.bukova.isspst.services.BuildingService;
|
import info.bukova.isspst.services.buildings.BuildingService;
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.Init;
|
import org.zkoss.bind.annotation.Init;
|
||||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import org.zkoss.zul.Messagebox;
|
|||||||
import org.zkoss.zul.Window;
|
import org.zkoss.zul.Window;
|
||||||
|
|
||||||
public class ListViewModel<T extends DataModel> {
|
public class ListViewModel<T extends DataModel> {
|
||||||
|
|
||||||
private boolean confirmDelete = false;
|
private boolean confirmDelete = false;
|
||||||
private boolean filter = false;
|
private boolean filter = false;
|
||||||
private Window editWin;
|
private Window editWin;
|
||||||
@@ -37,29 +37,29 @@ public class ListViewModel<T extends DataModel> {
|
|||||||
private boolean sortDesc = true;
|
private boolean sortDesc = true;
|
||||||
private boolean newRec = false;
|
private boolean newRec = false;
|
||||||
private boolean fullFill = false;
|
private boolean fullFill = false;
|
||||||
|
|
||||||
protected Service<T> service;
|
protected Service<T> service;
|
||||||
protected Class<T> dataClass;
|
protected Class<T> dataClass;
|
||||||
protected String formZul;
|
protected String formZul;
|
||||||
protected Filter<T> dataFilter;
|
protected Filter<T> dataFilter;
|
||||||
|
|
||||||
public List<T> getDataList() {
|
public List<T> getDataList() {
|
||||||
if (dataList == null) {
|
if (dataList == null) {
|
||||||
dataList = new ArrayList<T>();
|
dataList = new ArrayList<T>();
|
||||||
loadFromDbSync();
|
loadFromDbSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataBean(T data) {
|
public void setDataBean(T data) {
|
||||||
this.dataBean = data;
|
this.dataBean = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataFilter(Filter<T> dataFilter) {
|
public void setDataFilter(Filter<T> dataFilter) {
|
||||||
this.dataFilter = dataFilter;
|
this.dataFilter = dataFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getFilterTemplate() {
|
public T getFilterTemplate() {
|
||||||
if (filterTemplate == null) {
|
if (filterTemplate == null) {
|
||||||
try {
|
try {
|
||||||
@@ -70,18 +70,18 @@ public class ListViewModel<T extends DataModel> {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return filterTemplate;
|
return filterTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getDataBean() {
|
public T getDataBean() {
|
||||||
return dataBean;
|
return dataBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getConfirmDelete() {
|
public boolean getConfirmDelete() {
|
||||||
return confirmDelete;
|
return confirmDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getFilter() {
|
public boolean getFilter() {
|
||||||
return this.filter;
|
return this.filter;
|
||||||
}
|
}
|
||||||
@@ -89,21 +89,20 @@ public class ListViewModel<T extends DataModel> {
|
|||||||
public boolean getFullFill() {
|
public boolean getFullFill() {
|
||||||
return fullFill;
|
return fullFill;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void newRecMode() {
|
protected void newRecMode() {
|
||||||
newRec = true;
|
newRec = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setEditBean(T edit) {
|
protected void setEditBean(T edit) {
|
||||||
this.editBean = edit;
|
this.editBean = edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({"filter", "dataList", "dataBean"})
|
@NotifyChange({ "filter", "dataList", "dataBean" })
|
||||||
public void filter() {
|
public void filter() {
|
||||||
filter = !filter;
|
filter = !filter;
|
||||||
|
|
||||||
if (!filter) {
|
if (!filter) {
|
||||||
dataList = fullList;
|
dataList = fullList;
|
||||||
dataBean = null;
|
dataBean = null;
|
||||||
@@ -113,19 +112,19 @@ public class ListViewModel<T extends DataModel> {
|
|||||||
dataBean = null;
|
dataBean = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("dataList")
|
@NotifyChange("dataList")
|
||||||
public void doFilter() {
|
public void doFilter() {
|
||||||
if (dataFilter == null) {
|
if (dataFilter == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<T> result = service.filterList(fullList, dataFilter);
|
List<T> result = service.filterList(fullList, dataFilter);
|
||||||
selIndex = -1;
|
selIndex = -1;
|
||||||
dataList = result;
|
dataList = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
public void addNew() {
|
public void addNew() {
|
||||||
try {
|
try {
|
||||||
@@ -138,66 +137,72 @@ public class ListViewModel<T extends DataModel> {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
public void edit() {
|
public void edit() {
|
||||||
int index = dataList.indexOf(dataBean);
|
int index = dataList.indexOf(dataBean);
|
||||||
newRec = false;
|
newRec = false;
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
selIndex = index;
|
selIndex = index;
|
||||||
}
|
}
|
||||||
editBean = service.getById(dataBean.getId());
|
editBean = service.getById(dataBean.getId());
|
||||||
showForm();
|
showForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("confirmDelete")
|
@NotifyChange("confirmDelete")
|
||||||
public void delObject() {
|
public void delObject() {
|
||||||
confirmDelete = true;
|
confirmDelete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({"dataList", "dataBean"})
|
@NotifyChange({ "dataList", "dataBean" })
|
||||||
public void delete() {
|
public void delete() {
|
||||||
Messagebox.show("Opravdu smazat?", "Smazat záznam", Messagebox.YES|Messagebox.NO,
|
Messagebox.show("Opravdu smazat?", "Smazat záznam", Messagebox.YES
|
||||||
Messagebox.QUESTION, new EventListener<Event>() {
|
| Messagebox.NO, Messagebox.QUESTION,
|
||||||
|
new EventListener<Event>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event evt) throws Exception {
|
public void onEvent(Event evt) throws Exception {
|
||||||
if (((Integer)evt.getData()).intValue() == Messagebox.YES) {
|
if (((Integer) evt.getData()).intValue() == Messagebox.YES) {
|
||||||
try {
|
try {
|
||||||
service.delete(dataBean);
|
service.delete(dataBean);
|
||||||
dataList.remove(dataBean);
|
dataList.remove(dataBean);
|
||||||
dataBean = null;
|
dataBean = null;
|
||||||
BindUtils.postNotifyChange(null, null, ListViewModel.this, "dataList");
|
BindUtils.postNotifyChange(null, null,
|
||||||
BindUtils.postNotifyChange(null, null, ListViewModel.this, "dataBean");
|
ListViewModel.this, "dataList");
|
||||||
|
BindUtils.postNotifyChange(null, null,
|
||||||
|
ListViewModel.this, "dataBean");
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
Messagebox.show("Chyba při mazání záznamu", "Chyba", Messagebox.OK, Messagebox.ERROR);
|
Messagebox.show("Chyba při mazání záznamu",
|
||||||
|
"Chyba", Messagebox.OK,
|
||||||
|
Messagebox.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
confirmDelete = false;
|
confirmDelete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotifyChange({"dataList", "dataBean"})
|
@NotifyChange({ "dataList", "dataBean" })
|
||||||
private void onDelete() {
|
private void onDelete() {
|
||||||
try {
|
try {
|
||||||
service.delete(dataBean);
|
service.delete(dataBean);
|
||||||
dataList.remove(dataBean);
|
dataList.remove(dataBean);
|
||||||
dataBean = null;
|
dataBean = null;
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
Messagebox.show("Chyba při mazání záznamu", "Chyba", Messagebox.OK, Messagebox.ERROR);
|
Messagebox.show("Chyba při mazání záznamu", "Chyba", Messagebox.OK,
|
||||||
|
Messagebox.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GlobalCommand
|
@GlobalCommand
|
||||||
@NotifyChange({"dataList", "dataBean"})
|
@NotifyChange({ "dataList", "dataBean" })
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
/*if (editBean != null && !editBean.isValid()) {
|
if (editBean != null && !editBean.isValid()) {
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
if (editBean.getCreated() == null) {
|
if (editBean.getCreated() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -214,9 +219,9 @@ public class ListViewModel<T extends DataModel> {
|
|||||||
dataList.set(selIndex, editBean);
|
dataList.set(selIndex, editBean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GlobalCommand
|
@GlobalCommand
|
||||||
@NotifyChange({"dataList", "dataBean", "fullFill"})
|
@NotifyChange({ "dataList", "dataBean", "fullFill" })
|
||||||
public void reload() {
|
public void reload() {
|
||||||
dataBean = null;
|
dataBean = null;
|
||||||
dataList.clear();
|
dataList.clear();
|
||||||
@@ -229,66 +234,66 @@ public class ListViewModel<T extends DataModel> {
|
|||||||
if (editBean != null && !editBean.isValid()) {
|
if (editBean != null && !editBean.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selIndex > dataList.size() -1) {
|
if (selIndex > dataList.size() - 1) {
|
||||||
selIndex = -1;
|
selIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newRec) {
|
if (newRec) {
|
||||||
selIndex = dataList.size() -1;
|
selIndex = dataList.size() - 1;
|
||||||
newRec = false;
|
newRec = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("dataBean")
|
@NotifyChange("dataBean")
|
||||||
public void onSort(@BindingParam("column") String column) {
|
public void onSort(@BindingParam("column") String column) {
|
||||||
if (sortCol == null || this.sortCol.equals(column))
|
if (sortCol == null || this.sortCol.equals(column))
|
||||||
this.sortDesc = !this.sortDesc;
|
this.sortDesc = !this.sortDesc;
|
||||||
|
|
||||||
this.sortCol = column;
|
this.sortCol = column;
|
||||||
selIndex = -1;
|
selIndex = -1;
|
||||||
dataBean = null;
|
dataBean = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelIndex() {
|
public int getSelIndex() {
|
||||||
return this.selIndex;
|
return this.selIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({"dataList", "fullFill"})
|
@NotifyChange({ "dataList", "fullFill" })
|
||||||
public void fullFill() {
|
public void fullFill() {
|
||||||
if (fullFill && dataList.isEmpty()) {
|
if (fullFill && dataList.isEmpty()) {
|
||||||
dataList.addAll(tmpList);
|
dataList.addAll(tmpList);
|
||||||
fullList = dataList;
|
fullList = dataList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void loadFromDb() {
|
// private void loadFromDb() {
|
||||||
// Thread fillThread = new Thread(new Runnable() {
|
// Thread fillThread = new Thread(new Runnable() {
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public void run() {
|
// public void run() {
|
||||||
// tmpList = service.getAll();
|
// tmpList = service.getAll();
|
||||||
//
|
//
|
||||||
// try {
|
// try {
|
||||||
// Thread.sleep(200);
|
// Thread.sleep(200);
|
||||||
// } catch (InterruptedException e) {
|
// } catch (InterruptedException e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// fullFill = true;
|
// fullFill = true;
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
//
|
//
|
||||||
// fillThread.start();
|
// fillThread.start();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private void loadFromDbSync() {
|
private void loadFromDbSync() {
|
||||||
dataList.addAll(service.getAll());
|
dataList.addAll(service.getAll());
|
||||||
fullList = dataList;
|
fullList = dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showForm() {
|
protected void showForm() {
|
||||||
Map<String, Object> arg = new HashMap<String, Object>();
|
Map<String, Object> arg = new HashMap<String, Object>();
|
||||||
arg.put("selected", editBean);
|
arg.put("selected", editBean);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
jdbc.driverClassName=com.mysql.jdbc.Driver
|
jdbc.driverClassName=com.mysql.jdbc.Driver
|
||||||
jdbc.dialect=org.hibernate.dialect.MySQLDialect
|
jdbc.dialect=org.hibernate.dialect.MySQLDialect
|
||||||
jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst
|
jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=UTF-8
|
||||||
jdbc.username=root
|
jdbc.username=root
|
||||||
jdbc.password=xsacfgd
|
jdbc.password=xsacfgd
|
||||||
@@ -1,131 +1,117 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:security="http://www.springframework.org/schema/security" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns:p="http://www.springframework.org/schema/p"
|
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
|
||||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
|
||||||
xmlns:context="http://www.springframework.org/schema/context"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<!-- Root Context: defines shared resources visible to all other web components -->
|
<!-- Root Context: defines shared resources visible to all other web components -->
|
||||||
|
|
||||||
<context:annotation-config />
|
<context:annotation-config />
|
||||||
<context:component-scan base-package="info.bukova.isspst,org.zkoss.spring.beans.zkcomponents"></context:component-scan>
|
<context:component-scan base-package="info.bukova.isspst,org.zkoss.spring.beans.zkcomponents"></context:component-scan>
|
||||||
|
|
||||||
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
|
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" id="propertyConfigurer" p:location="/WEB-INF/jdbc.properties" />
|
||||||
id="propertyConfigurer"
|
|
||||||
p:location="/WEB-INF/jdbc.properties"/>
|
|
||||||
|
|
||||||
<!-- Database -->
|
<!-- Database -->
|
||||||
<bean id="dataSource"
|
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.databaseurl}" p:username="${jdbc.username}" p:password="${jdbc.password}"></bean>
|
||||||
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
|
|
||||||
p:driverClassName="${jdbc.driverClassName}"
|
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
|
||||||
p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
|
<property name="dataSource" ref="dataSource"></property>
|
||||||
p:password="${jdbc.password}"></bean>
|
<property name="configLocation">
|
||||||
|
<value>classpath:hibernate.cfg.xml</value>
|
||||||
<bean id="sessionFactory"
|
</property>
|
||||||
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
|
<property name="hibernateProperties">
|
||||||
<property name="dataSource" ref="dataSource"></property>
|
<props>
|
||||||
<property name="configLocation">
|
<prop key="hibernate.dialect">${jdbc.dialect}</prop>
|
||||||
<value>classpath:hibernate.cfg.xml</value>
|
<prop key="hibernate.show_sql">true</prop>
|
||||||
</property>
|
<prop key="hibernate.hbm2ddl.auto">update</prop>
|
||||||
<property name="hibernateProperties">
|
</props>
|
||||||
<props>
|
</property>
|
||||||
<prop key="hibernate.dialect">${jdbc.dialect}</prop>
|
</bean>
|
||||||
<prop key="hibernate.show_sql">true</prop>
|
|
||||||
<prop key="hibernate.hbm2ddl.auto">update</prop>
|
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||||
</props>
|
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
|
||||||
</property>
|
<property name="sessionFactory" ref="sessionFactory"></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
<!-- Security -->
|
||||||
<bean id="transactionManager"
|
<security:global-method-security secured-annotations="enabled" />
|
||||||
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
|
|
||||||
<property name="sessionFactory" ref="sessionFactory"></property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- Security -->
|
|
||||||
<security:global-method-security secured-annotations="enabled" />
|
|
||||||
|
|
||||||
<security:http auto-config="true">
|
<security:http auto-config="true">
|
||||||
<security:intercept-url pattern="/app/**" access="ROLE_USER, ROLE_ADMIN"/>
|
<security:intercept-url pattern="/app/**" access="ROLE_USER, ROLE_ADMIN" />
|
||||||
<security:intercept-url pattern="/admin/**" access="ROLE_ADMIN"/>
|
<security:intercept-url pattern="/admin/**" access="ROLE_ADMIN" />
|
||||||
<security:form-login login-page="/login.zhtml"
|
<security:form-login login-page="/login.zhtml" authentication-failure-handler-ref="loginFail" />
|
||||||
authentication-failure-handler-ref="loginFail"/>
|
<security:http-basic />
|
||||||
<security:http-basic/>
|
<security:logout invalidate-session="true" />
|
||||||
<security:logout invalidate-session="true"/>
|
|
||||||
</security:http>
|
</security:http>
|
||||||
|
|
||||||
<security:authentication-manager>
|
<security:authentication-manager>
|
||||||
<security:authentication-provider user-service-ref="userService">
|
<security:authentication-provider user-service-ref="userService">
|
||||||
<security:password-encoder ref="passwordEncoder">
|
<security:password-encoder ref="passwordEncoder">
|
||||||
<security:salt-source user-property="username"/>
|
<security:salt-source user-property="username" />
|
||||||
</security:password-encoder>
|
</security:password-encoder>
|
||||||
</security:authentication-provider>
|
</security:authentication-provider>
|
||||||
</security:authentication-manager>
|
</security:authentication-manager>
|
||||||
|
|
||||||
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
||||||
<property name="targetClass" value="org.springframework.security.core.context.SecurityContextHolder"/>
|
<property name="targetClass" value="org.springframework.security.core.context.SecurityContextHolder" />
|
||||||
<property name="targetMethod" value="setStrategyName"/>
|
<property name="targetMethod" value="setStrategyName" />
|
||||||
<property name="arguments" value="MODE_INHERITABLETHREADLOCAL"/>
|
<property name="arguments" value="MODE_INHERITABLETHREADLOCAL" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"/>
|
<bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder" />
|
||||||
|
|
||||||
<bean id="loginFail" class="info.bukova.isspst.LoginFailHandler"/>
|
<bean id="loginFail" class="info.bukova.isspst.LoginFailHandler" />
|
||||||
|
|
||||||
<!-- DAO -->
|
<!-- DAO -->
|
||||||
<bean id="userDao" class="info.bukova.isspst.dao.jpa.UserDaoJPA">
|
<bean id="userDao" class="info.bukova.isspst.dao.jpa.UserDaoJPA">
|
||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="roleDao" class="info.bukova.isspst.dao.jpa.RoleDaoJPA">
|
<bean id="roleDao" class="info.bukova.isspst.dao.jpa.RoleDaoJPA">
|
||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="buildingDao" class="info.bukova.isspst.dao.jpa.BuildingDaoJPA">
|
<bean id="buildingDao" class="info.bukova.isspst.dao.jpa.BuildingDaoJPA">
|
||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="addressDao" class="info.bukova.isspst.dao.jpa.AddressDaoJPA">
|
<bean id="addressDao" class="info.bukova.isspst.dao.jpa.AddressDaoJPA">
|
||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Business logic -->
|
<!-- Business logic -->
|
||||||
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
|
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
|
||||||
|
|
||||||
<bean id="userService" class="info.bukova.isspst.services.users.UserServiceImpl">
|
<bean id="userService" class="info.bukova.isspst.services.users.UserServiceImpl">
|
||||||
<property name="dao" ref="userDao"/>
|
<property name="dao" ref="userDao" />
|
||||||
<property name="encoder" ref="passwordEncoder"/>
|
<property name="encoder" ref="passwordEncoder" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="roleService" class="info.bukova.isspst.services.users.RoleServiceImpl">
|
<bean id="roleService" class="info.bukova.isspst.services.users.RoleServiceImpl">
|
||||||
<property name="dao" ref="roleDao"/>
|
<property name="dao" ref="roleDao" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="buildingService" class="info.bukova.isspst.services.BuildingServiceImpl">
|
<bean id="buildingService" class="info.bukova.isspst.services.buildings.BuildingServiceImpl">
|
||||||
<property name="dao" ref="buildingDao"/>
|
<property name="dao" ref="buildingDao" />
|
||||||
|
<property name="validator" ref="validator" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="adbService" class="info.bukova.isspst.services.addressbook.AdbServiceImpl">
|
<bean id="adbService" class="info.bukova.isspst.services.addressbook.AdbServiceImpl">
|
||||||
<property name="dao" ref="addressDao"/>
|
<property name="dao" ref="addressDao" />
|
||||||
<property name="validator" ref="validator"/>
|
<property name="validator" ref="validator" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="addressFinderAres" class="info.bukova.isspst.services.addressbook.AddressFinderAres">
|
<bean id="addressFinderAres" class="info.bukova.isspst.services.addressbook.AddressFinderAres">
|
||||||
<property name="aresUrl" value="http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_std.cgi"/>
|
<property name="aresUrl" value="http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_std.cgi" />
|
||||||
<property name="unmarsheller" ref="unmarshallerAres"/>
|
<property name="unmarsheller" ref="unmarshallerAres" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="addressFinderTaxID" class="info.bukova.isspst.services.addressbook.AddressFinderTaxID">
|
<bean id="addressFinderTaxID" class="info.bukova.isspst.services.addressbook.AddressFinderTaxID">
|
||||||
<property name="aresDicUrl" value="http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_bas.cgi"/>
|
<property name="aresDicUrl" value="http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_bas.cgi" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="xmlCtxAres" class="org.castor.spring.xml.XMLContextFactoryBean">
|
<bean id="xmlCtxAres" class="org.castor.spring.xml.XMLContextFactoryBean">
|
||||||
<property name="mappingLocations">
|
<property name="mappingLocations">
|
||||||
<list>
|
<list>
|
||||||
@@ -133,9 +119,9 @@
|
|||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="unmarshallerAres" class="org.castor.spring.xml.CastorUnmarshallerFactoryBean">
|
<bean id="unmarshallerAres" class="org.castor.spring.xml.CastorUnmarshallerFactoryBean">
|
||||||
<property name="xmlContext" ref="xmlCtxAres"/>
|
<property name="xmlContext" ref="xmlCtxAres" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
<?page title="buttons" contentType="text/html;charset=UTF-8"?>
|
<?page title="buttons" contentType="text/html;charset=UTF-8"?>
|
||||||
<zk>
|
<zk>
|
||||||
<button image="/img/save.png" label="Uložit" onClick="@command('save', window=editWin) @global-command('refresh')" sclass="nicebutton" /><button image="~./zul/img/misc/drag-disallow.png" label="Zrušit" onClick="editWin.detach()" sclass="nicebutton"/>
|
<vlayout>
|
||||||
|
<div hflex="max" align="right">
|
||||||
|
<button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="editWin.detach()" sclass="nicebutton" />
|
||||||
|
<button image="/img/save.png" label="${labels.ButtonSave}" onClick="@command('save', window=editWin) @global-command('refresh')" sclass="nicebutton" />
|
||||||
|
</div>
|
||||||
|
</vlayout>
|
||||||
</zk>
|
</zk>
|
||||||
@@ -8,12 +8,16 @@
|
|||||||
<columns>
|
<columns>
|
||||||
<column align="right" hflex="min" />
|
<column align="right" hflex="min" />
|
||||||
<column />
|
<column />
|
||||||
|
<column />
|
||||||
</columns>
|
</columns>
|
||||||
<rows>
|
<rows>
|
||||||
<row>
|
<row>
|
||||||
<cell sclass="row-title">${labels.BuildingsFormCode} :</cell>
|
<cell sclass="row-title">${labels.BuildingsFormCode} :</cell>
|
||||||
<cell>
|
<cell>
|
||||||
<textbox constraint="no empty: ${labels.BuildingsFormCodeConstr}" width="200px" value="@bind(vm.dataBean.code)" />
|
<textbox width="200px" value="@bind(vm.dataBean.code)" />
|
||||||
|
</cell>
|
||||||
|
<cell>
|
||||||
|
<label visible="true" value="@load(vm.errMessages['code'])" style="color:red" />
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -30,7 +34,7 @@
|
|||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<include src="/app/formButtons.zul"/>
|
<include src="/app/formButtons.zul" />
|
||||||
</vlayout>
|
</vlayout>
|
||||||
</window>
|
</window>
|
||||||
</zk>
|
</zk>
|
||||||
Reference in New Issue
Block a user