Přidaná agenda materiál.

closes #94
multitenant
Josef Rokos 11 years ago
parent e304e25872
commit 8db25ecdda

@ -6,6 +6,7 @@ import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.services.addressbook.AdbService; import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.buildings.BuildingService; import info.bukova.isspst.services.buildings.BuildingService;
import info.bukova.isspst.services.material.MaterialService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
@ -49,11 +50,13 @@ public class Constants {
public final static String MOD_PERMISSIONS = "PERMISSIONS"; public final static String MOD_PERMISSIONS = "PERMISSIONS";
public final static String MOD_ADDRESSBOOK = "ADDRESSBOOK"; public final static String MOD_ADDRESSBOOK = "ADDRESSBOOK";
public final static String MOD_BUILDINGS = "BUILDINGS"; public final static String MOD_BUILDINGS = "BUILDINGS";
public final static String MOD_MATERIAL = "MATERIAL";
public final static Module MODULES[] = { public final static Module MODULES[] = {
new Module(MOD_USERS, "Uživatelé", UserService.class), new Module(MOD_USERS, "Uživatelé", UserService.class),
new Module(MOD_PERMISSIONS, "Práva", RoleService.class), new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
new Module(MOD_ADDRESSBOOK, "Dodavatelé", AdbService.class), new Module(MOD_ADDRESSBOOK, "Dodavatelé", AdbService.class),
new Module(MOD_BUILDINGS, "Budovy", BuildingService.class) new Module(MOD_BUILDINGS, "Budovy", BuildingService.class),
new Module(MOD_MATERIAL, "Materiál", MaterialService.class)
}; };
public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava"; public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava";

@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.Material;
public interface MaterialDao extends BaseDao<Material> {
}

@ -0,0 +1,14 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.MaterialDao;
import info.bukova.isspst.data.Material;
public class MaterialDaoJPA extends BaseDaoJPA<Material> implements MaterialDao {
@Override
public String getEntityName() {
return Material.class.getSimpleName();
}
}

@ -0,0 +1,12 @@
package info.bukova.isspst.data;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name="MATERIAL")
public class Material extends RequestSubject {
}

@ -0,0 +1,43 @@
package info.bukova.isspst.data;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import org.hibernate.validator.constraints.NotEmpty;
@MappedSuperclass
public class RequestSubject extends BaseData {
@Column(name = "CODE", unique = true)
private String code;
@Column(name = "NAME")
private String name;
@Column(name = "DESCRIPTION")
private String description;
@NotEmpty(message = "{MaterialFormCodeConstr}")
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

@ -0,0 +1,56 @@
package info.bukova.isspst.filters;
import static info.bukova.isspst.StringUtils.nullStr;
import info.bukova.isspst.data.Material;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class MaterialFilter implements Filter<Material> {
private Material condMaterial;
public MaterialFilter(Material condMaterial) {
this.condMaterial = condMaterial;
}
private static class MaterialMatcher extends TypeSafeMatcher<Material> {
private Material condMaterial;
public MaterialMatcher(Material cond) {
this.condMaterial = cond;
}
@Override
public void describeTo(Description desc) {
desc.appendText("material matches");
}
@Override
public boolean matchesSafely(Material item) {
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMaterial.getCode()).toLowerCase())
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condMaterial.getName()).toLowerCase())
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMaterial.getDescription()).toLowerCase());
}
@Factory
public static Matcher<Material> matchBuilding(Material material) {
return new MaterialMatcher(material);
}
}
@Override
public MaterialMatcher matcher() {
return new MaterialMatcher(condMaterial);
}
@Override
public String queryString() {
// TODO query string
return "";
}
}

@ -0,0 +1,8 @@
package info.bukova.isspst.services.material;
import info.bukova.isspst.data.Material;
import info.bukova.isspst.services.Service;
public interface MaterialService extends Service<Material> {
}

@ -0,0 +1,9 @@
package info.bukova.isspst.services.material;
import info.bukova.isspst.data.Material;
import info.bukova.isspst.services.AbstractOwnedService;
public class MaterialServiceImpl extends AbstractOwnedService<Material>
implements MaterialService {
}

@ -0,0 +1,15 @@
package info.bukova.isspst.ui.material;
import org.zkoss.bind.annotation.Init;
import info.bukova.isspst.data.Material;
import info.bukova.isspst.ui.FormViewModel;
public class MaterialForm extends FormViewModel<Material> {
@Init(superclass = true)
public void init() {
}
}

@ -0,0 +1,24 @@
package info.bukova.isspst.ui.material;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.Material;
import info.bukova.isspst.filters.MaterialFilter;
import info.bukova.isspst.services.material.MaterialService;
import info.bukova.isspst.ui.ListViewModel;
public class MaterialList extends ListViewModel<Material> {
@WireVariable
private MaterialService materialService;
@Init
public void init() {
service = materialService;
dataClass = Material.class;
formZul = "materialForm.zul";
dataFilter = new MaterialFilter(getFilterTemplate());
}
}

@ -1 +1,4 @@
BuildingsFormCodeConstr=Zadejte k\u00f3d budovy... #Generated by Eclipse Messages Editor (Eclipse Babel)
BuildingsFormCodeConstr = Zadejte k\u00F3d budovy...
MaterialFormCodeConstr = Zadejte k\u00F3d materi\u00E1lu...

@ -11,5 +11,7 @@
<mapping class="info.bukova.isspst.data.BaseData"></mapping> <mapping class="info.bukova.isspst.data.BaseData"></mapping>
<mapping class="info.bukova.isspst.data.Address"></mapping> <mapping class="info.bukova.isspst.data.Address"></mapping>
<mapping class="info.bukova.isspst.data.Building"></mapping> <mapping class="info.bukova.isspst.data.Building"></mapping>
<mapping class="info.bukova.isspst.data.Material"></mapping>
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>

@ -60,6 +60,9 @@ UsersGridColumnPersonalID=Osobní číslo
UsersGridColumnFirstName=Jméno UsersGridColumnFirstName=Jméno
UsersGridColumnSureName=Příjmení UsersGridColumnSureName=Příjmení
AgendaMaterial=Materiál
MaterialFormTitle=Materiál
ButtonStorno=Storno ButtonStorno=Storno
ButtonSave=Uložit ButtonSave=Uložit

@ -115,6 +115,10 @@
<property name="sessionFactory" ref="sessionFactory"/> <property name="sessionFactory" ref="sessionFactory"/>
</bean> </bean>
<bean id="materialDao" class="info.bukova.isspst.dao.jpa.MaterialDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Business logic --> <!-- Business logic -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
@ -161,5 +165,10 @@
<bean id="permissionService" class="info.bukova.isspst.services.users.PermissionServiceImpl"> <bean id="permissionService" class="info.bukova.isspst.services.users.PermissionServiceImpl">
<property name="dao" ref="permissionDao"/> <property name="dao" ref="permissionDao"/>
</bean> </bean>
<bean id="materialService" class="info.bukova.isspst.services.material.MaterialServiceImpl">
<property name="dao" ref="materialDao"/>
<property name="validator" ref="validator"/>
</bean>
</beans> </beans>

@ -32,6 +32,7 @@
<menuitem label="Střediska" href="/admin/users" disabled="${not sec:isAllGranted('ROLE_ADMIN')}"/> <menuitem label="Střediska" href="/admin/users" disabled="${not sec:isAllGranted('ROLE_ADMIN')}"/>
<menuitem label="${labels.AgendaBuildings}" href="/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}"/> <menuitem label="${labels.AgendaBuildings}" href="/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}"/>
<menuitem label="Místnosti" href="/admin/users"/> <menuitem label="Místnosti" href="/admin/users"/>
<menuitem label="${labels.AgendaMaterial}" href="/material" disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}"/>
<menuitem label="Dodavatelé" href="/admin/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/> <menuitem label="Dodavatelé" href="/admin/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/>
</menubar> </menubar>
</tabpanel> </tabpanel>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

@ -0,0 +1,10 @@
<?page title="${labels.AgendaMaterial}" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
String gridZul = "material.zul";
</zscript>
<include src="/app/template.zhtml"/>
</zk>

@ -0,0 +1,58 @@
<?page title="${labels.AgendaMaterial}" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.material.MaterialList')">
<caption zclass="form-caption" label="${labels.AgendaMaterial}" />
<include src="/app/toolbar.zul" />
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" height="500px">
<listhead menupopup="auto">
<listheader label="${labels.code}" sort="czech(code)" width="10%" />
<listheader label="${labels.name}" sort="czech(name)" width="30%" />
<listheader label="${labels.description}" sort="czech(description)" width="60%" />
</listhead>
<auxhead sclass="category-center" visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.code)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.name)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.description)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.description)" />
</listitem>
</template>
</listbox>
</window>
</zk>

@ -0,0 +1,36 @@
<?page title="${labels.MaterialFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.material.MaterialForm')">
<caption src="/img/material.png" zclass="form-caption" label="${labels.MaterialFormTitle}" />
<vlayout>
<grid hflex="min">
<columns>
<column align="right" hflex="min" />
<column />
</columns>
<rows>
<row>
<cell sclass="row-title">${labels.code} :</cell>
<cell>
<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.code)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.name} :</cell>
<cell>
<textbox id="name" width="200px" value="@bind(vm.dataBean.name)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.description} :</cell>
<cell>
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
</cell>
</row>
</rows>
</grid>
<include src="/app/formButtons.zul" />
</vlayout>
</window>
</zk>
Loading…
Cancel
Save