diff --git a/src/main/java/info/bukova/isspst/Constants.java b/src/main/java/info/bukova/isspst/Constants.java index ab906aac..0de11b44 100644 --- a/src/main/java/info/bukova/isspst/Constants.java +++ b/src/main/java/info/bukova/isspst/Constants.java @@ -7,6 +7,7 @@ import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.services.addressbook.AdbService; import info.bukova.isspst.services.buildings.BuildingService; import info.bukova.isspst.services.munits.MUnitService; +import info.bukova.isspst.services.material.MaterialService; import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.UserService; @@ -51,12 +52,14 @@ public class Constants { public final static String MOD_ADDRESSBOOK = "ADDRESSBOOK"; public final static String MOD_BUILDINGS = "BUILDINGS"; public final static String MOD_MUNITS = "MUNITS"; + public final static String MOD_MATERIAL = "MATERIAL"; public final static Module MODULES[] = { new Module(MOD_USERS, "Uživatelé", UserService.class) , new Module(MOD_PERMISSIONS, "Práva", RoleService.class) , new Module(MOD_ADDRESSBOOK, "Dodavatelé", AdbService.class) , new Module(MOD_BUILDINGS, "Budovy", BuildingService.class) , new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class) + , new Module(MOD_MATERIAL, "Materiál", MaterialService.class) }; public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava"; diff --git a/src/main/java/info/bukova/isspst/dao/MaterialDao.java b/src/main/java/info/bukova/isspst/dao/MaterialDao.java new file mode 100644 index 00000000..b371edd9 --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/MaterialDao.java @@ -0,0 +1,7 @@ +package info.bukova.isspst.dao; + +import info.bukova.isspst.data.Material; + +public interface MaterialDao extends BaseDao { + +} diff --git a/src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java new file mode 100644 index 00000000..3edeff26 --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java @@ -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 implements MaterialDao { + + @Override + public String getEntityName() { + return Material.class.getSimpleName(); + } + + +} diff --git a/src/main/java/info/bukova/isspst/data/Material.java b/src/main/java/info/bukova/isspst/data/Material.java new file mode 100644 index 00000000..1096777d --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/Material.java @@ -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 { + + + +} diff --git a/src/main/java/info/bukova/isspst/data/RequestSubject.java b/src/main/java/info/bukova/isspst/data/RequestSubject.java new file mode 100644 index 00000000..b6e883b1 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/RequestSubject.java @@ -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; + } + +} diff --git a/src/main/java/info/bukova/isspst/filters/MaterialFilter.java b/src/main/java/info/bukova/isspst/filters/MaterialFilter.java new file mode 100644 index 00000000..971ef68c --- /dev/null +++ b/src/main/java/info/bukova/isspst/filters/MaterialFilter.java @@ -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 { + + private Material condMaterial; + + public MaterialFilter(Material condMaterial) { + this.condMaterial = condMaterial; + } + + private static class MaterialMatcher extends TypeSafeMatcher { + + 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 matchBuilding(Material material) { + return new MaterialMatcher(material); + } + } + + @Override + public MaterialMatcher matcher() { + return new MaterialMatcher(condMaterial); + } + + @Override + public String queryString() { + // TODO query string + return ""; + } + +} diff --git a/src/main/java/info/bukova/isspst/services/material/MaterialService.java b/src/main/java/info/bukova/isspst/services/material/MaterialService.java new file mode 100644 index 00000000..aa40c282 --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/material/MaterialService.java @@ -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 { + +} diff --git a/src/main/java/info/bukova/isspst/services/material/MaterialServiceImpl.java b/src/main/java/info/bukova/isspst/services/material/MaterialServiceImpl.java new file mode 100644 index 00000000..2e9a63e1 --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/material/MaterialServiceImpl.java @@ -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 + implements MaterialService { + +} diff --git a/src/main/java/info/bukova/isspst/ui/material/MaterialForm.java b/src/main/java/info/bukova/isspst/ui/material/MaterialForm.java new file mode 100644 index 00000000..2bab7210 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/material/MaterialForm.java @@ -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 { + + @Init(superclass = true) + public void init() { + + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/material/MaterialList.java b/src/main/java/info/bukova/isspst/ui/material/MaterialList.java new file mode 100644 index 00000000..b2dc9137 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/material/MaterialList.java @@ -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 { + + @WireVariable + private MaterialService materialService; + + @Init + public void init() { + service = materialService; + dataClass = Material.class; + formZul = "materialForm.zul"; + dataFilter = new MaterialFilter(getFilterTemplate()); + } + +} diff --git a/src/main/resources/ValidationMessages.properties b/src/main/resources/ValidationMessages.properties index 7f627910..d5f03ae9 100644 --- a/src/main/resources/ValidationMessages.properties +++ b/src/main/resources/ValidationMessages.properties @@ -1,2 +1,3 @@ -BuildingsFormCodeConstr=Zadejte k\u00f3d budovy... -MUnitsFormCodeConstr=Zadejte k\u00f3d m\u011brn\u00e9 jednotky... \ No newline at end of file +BuildingsFormCodeConstr = Zadejte k\u00F3d budovy... +MaterialFormCodeConstr = Zadejte k\u00F3d materi\u00E1lu... +MUnitsFormCodeConstr=Zadejte k\u00f3d m\u011brn\u00e9 jednotky... diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index 5136da4b..90d0f423 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -12,5 +12,7 @@ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index ec91fb37..199d4841 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -69,6 +69,9 @@ UsersGridColumnPersonalID=Osobní číslo UsersGridColumnFirstName=Jméno UsersGridColumnSureName=Příjmení +AgendaMaterial=Materiál +MaterialFormTitle=Materiál + ButtonStorno=Storno ButtonSave=Uložit diff --git a/src/main/webapp/WEB-INF/spring/root-context.xml b/src/main/webapp/WEB-INF/spring/root-context.xml index 13b4dbb6..89c44325 100644 --- a/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/src/main/webapp/WEB-INF/spring/root-context.xml @@ -120,6 +120,10 @@ + + + + @@ -171,5 +175,10 @@ + + + + + diff --git a/src/main/webapp/app/navigation.zul b/src/main/webapp/app/navigation.zul index 6b34b174..04b3e7c4 100644 --- a/src/main/webapp/app/navigation.zul +++ b/src/main/webapp/app/navigation.zul @@ -33,6 +33,7 @@ + diff --git a/src/main/webapp/img/material.png b/src/main/webapp/img/material.png new file mode 100644 index 00000000..0ba0c079 Binary files /dev/null and b/src/main/webapp/img/material.png differ diff --git a/src/main/webapp/material/index.zul b/src/main/webapp/material/index.zul new file mode 100644 index 00000000..b53d928b --- /dev/null +++ b/src/main/webapp/material/index.zul @@ -0,0 +1,10 @@ + + + + + String gridZul = "material.zul"; + + + + + \ No newline at end of file diff --git a/src/main/webapp/material/material.zul b/src/main/webapp/material/material.zul new file mode 100644 index 00000000..fc549c14 --- /dev/null +++ b/src/main/webapp/material/material.zul @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +
+
\ No newline at end of file diff --git a/src/main/webapp/material/materialForm.zul b/src/main/webapp/material/materialForm.zul new file mode 100644 index 00000000..0270c94b --- /dev/null +++ b/src/main/webapp/material/materialForm.zul @@ -0,0 +1,36 @@ + + + + + + + + + + + + + ${labels.code} : + + + + + + ${labels.name} : + + + + + + ${labels.description} : + + + + + + + + + + \ No newline at end of file