From 8db25ecdda09a79474176b014da0b0d7f85f8dcd Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sat, 7 Jun 2014 21:57:10 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99idan=C3=A1=20agenda=20materi=C3=A1l.=20c?= =?UTF-8?q?loses=20#94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/info/bukova/isspst/Constants.java | 5 +- .../info/bukova/isspst/dao/MaterialDao.java | 7 +++ .../bukova/isspst/dao/jpa/MaterialDaoJPA.java | 14 +++++ .../info/bukova/isspst/data/Material.java | 12 ++++ .../bukova/isspst/data/RequestSubject.java | 43 +++++++++++++ .../bukova/isspst/filters/MaterialFilter.java | 56 +++++++++++++++++ .../services/material/MaterialService.java | 8 +++ .../material/MaterialServiceImpl.java | 9 +++ .../isspst/ui/material/MaterialForm.java | 15 +++++ .../isspst/ui/material/MaterialList.java | 24 ++++++++ .../resources/ValidationMessages.properties | 5 +- src/main/resources/hibernate.cfg.xml | 2 + .../WEB-INF/locales/zk-label.properties | 3 + .../webapp/WEB-INF/spring/root-context.xml | 9 +++ src/main/webapp/app/navigation.zul | 1 + src/main/webapp/img/material.png | Bin 0 -> 3453 bytes src/main/webapp/material/index.zul | 10 +++ src/main/webapp/material/material.zul | 58 ++++++++++++++++++ src/main/webapp/material/materialForm.zul | 36 +++++++++++ 19 files changed, 315 insertions(+), 2 deletions(-) create mode 100644 src/main/java/info/bukova/isspst/dao/MaterialDao.java create mode 100644 src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java create mode 100644 src/main/java/info/bukova/isspst/data/Material.java create mode 100644 src/main/java/info/bukova/isspst/data/RequestSubject.java create mode 100644 src/main/java/info/bukova/isspst/filters/MaterialFilter.java create mode 100644 src/main/java/info/bukova/isspst/services/material/MaterialService.java create mode 100644 src/main/java/info/bukova/isspst/services/material/MaterialServiceImpl.java create mode 100644 src/main/java/info/bukova/isspst/ui/material/MaterialForm.java create mode 100644 src/main/java/info/bukova/isspst/ui/material/MaterialList.java create mode 100644 src/main/webapp/img/material.png create mode 100644 src/main/webapp/material/index.zul create mode 100644 src/main/webapp/material/material.zul create mode 100644 src/main/webapp/material/materialForm.zul diff --git a/src/main/java/info/bukova/isspst/Constants.java b/src/main/java/info/bukova/isspst/Constants.java index 93a4599d..e784f5db 100644 --- a/src/main/java/info/bukova/isspst/Constants.java +++ b/src/main/java/info/bukova/isspst/Constants.java @@ -6,6 +6,7 @@ import info.bukova.isspst.reporting.Report; 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.material.MaterialService; import info.bukova.isspst.services.users.RoleService; 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_ADDRESSBOOK = "ADDRESSBOOK"; public final static String MOD_BUILDINGS = "BUILDINGS"; + 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_BUILDINGS, "Budovy", BuildingService.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 ebe76fac..0b7179b9 100644 --- a/src/main/resources/ValidationMessages.properties +++ b/src/main/resources/ValidationMessages.properties @@ -1 +1,4 @@ -BuildingsFormCodeConstr=Zadejte k\u00f3d budovy... \ No newline at end of file +#Generated by Eclipse Messages Editor (Eclipse Babel) + +BuildingsFormCodeConstr = Zadejte k\u00F3d budovy... +MaterialFormCodeConstr = Zadejte k\u00F3d materi\u00E1lu... diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index a50d30e6..ebbe8a10 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -11,5 +11,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 a7df6ea1..13c4643a 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -60,6 +60,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 d49e645c..421b4a3b 100644 --- a/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/src/main/webapp/WEB-INF/spring/root-context.xml @@ -115,6 +115,10 @@ + + + + @@ -161,5 +165,10 @@ + + + + + diff --git a/src/main/webapp/app/navigation.zul b/src/main/webapp/app/navigation.zul index 39cfd208..ddfdec8e 100644 --- a/src/main/webapp/app/navigation.zul +++ b/src/main/webapp/app/navigation.zul @@ -32,6 +32,7 @@ + diff --git a/src/main/webapp/img/material.png b/src/main/webapp/img/material.png new file mode 100644 index 0000000000000000000000000000000000000000..0ba0c079b0f61f34a38d2aa031839b845959542f GIT binary patch literal 3453 zcmV-@4TAECP)|O6Vj@M2cNSp+sBnnid5>To(34s;`RRx+>r7A&G zEwmM=LR6_hw3SL*8VRCCh_(=#QYGLPg;L&bOaque5@W}YwY~AKcV}O-^SqDq`1Ow+ zyNe-hq$DH#G*@$H&V0`I_q<2(BD~)D&Ufx;Hk&uqM@Q#X7_N%g?oBtpX7Ij0c#nIo z-yA-CSlxW{&GP@PtzHbkyY9N{bElp;`s;i5?JMFaE(9@3snyon#zGJV->Ou~-yds? zJoENveja zE^#TrqcM3-5Jl+Ce==I>MIDB78ab!5I*kg>RVtNlA2@K}_|IBDe4&6F8{MnN>h&@2 z9o`F##x~|=XW2Ego0&aVaO&hq!Z1WcKoNfKgCMAR=TIoo zC`3GnCkR8VwJHq4Yf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==26; z>E=eY-W>l+aZI<@rl;=HqNdwQmas@CX`BL6aj4fH&p95?};QLNlJLYd*1M_Cz;tfjxB8isZnMF=Nt#0>htE;R%NLKpD9{b%Qa+C{+W#^^}7 z*Tf_NP6||1r`H`&~E4lDA(yE1k(%Idx^%pZ86&B@82_f`C9NtX0I-ZLG@_9J)|A=TTUcD7*r#Hv6s;kM}~F z=PHRKms#~xyPtlw-A@bP8Q?sy40MNZ7BE}kF3f{55CLZPdk@VWc=(G`nX0mDvc_b+ z1kMm@PpCCP9I<0^J30u_dUMp$2+_zit8R)$u*x?deV8B!SXpaRAFHyuk@D2Zg+u>v z;PDRwePA8v4P99b!7i8^PImu$asecO|MNe7>xZtn`pVaT>ucW#7iN!f(rpWLj_-q3P3n*W3`t(_H>+opKF08V)(qv+!eA&e0 z_UPE`;^RPji)zIdu%Ck43OKUR?40@6e?NGrP~p?+UeeZl2qJ zJna|6Qo_JcVtZk6Hn3X}yAWfN{U!vVwLn~ovrN!L&RasnEP_=5pvAK;OeC|J= zy6?$n&OHh=hgn(-f$R|KXTn`@adl`@z+PY)7z0Ko#_Qv^-1zbxmrpfz-g48v$%Wb3 zdJ@Q}F?rN!_gU{++U+(U{^*DJ@zE2^o;o2bi;F7MN>+O2q z_2EV;Q=wfna#;hd|~M7#ZH% f8f)@=PBQ)ny&5=_-gdyu00000NkvXXu0mjfV_B$Z literal 0 HcmV?d00001 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