diff --git a/src/main/java/info/bukova/isspst/Constants.java b/src/main/java/info/bukova/isspst/Constants.java index 3c88315f..e1f6f665 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.munits.MUnitService; import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.UserService; @@ -49,12 +50,14 @@ 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_MUNITS = "MUNITS"; 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_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) + }; public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava"; public final static ReportMapping REPORTS[] = { diff --git a/src/main/java/info/bukova/isspst/dao/MUnitDao.java b/src/main/java/info/bukova/isspst/dao/MUnitDao.java new file mode 100644 index 00000000..833b406f --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/MUnitDao.java @@ -0,0 +1,7 @@ +package info.bukova.isspst.dao; + +import info.bukova.isspst.data.MUnit; + +public interface MUnitDao extends BaseDao { + +} \ No newline at end of file diff --git a/src/main/java/info/bukova/isspst/dao/jpa/MUnitDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/MUnitDaoJPA.java new file mode 100644 index 00000000..d91e95ac --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/jpa/MUnitDaoJPA.java @@ -0,0 +1,12 @@ +package info.bukova.isspst.dao.jpa; + +import info.bukova.isspst.dao.MUnitDao; +import info.bukova.isspst.data.MUnit; + +public class MUnitDaoJPA extends BaseDaoJPA implements MUnitDao { + + @Override + public String getEntityName() { + return "MUnit"; + } +} diff --git a/src/main/java/info/bukova/isspst/data/MUnit.java b/src/main/java/info/bukova/isspst/data/MUnit.java new file mode 100644 index 00000000..8cdb5da9 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/MUnit.java @@ -0,0 +1,67 @@ +package info.bukova.isspst.data; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +import org.hibernate.validator.constraints.NotBlank; + +@Entity +@Table(name = "MUNIT") +public class MUnit extends BaseData implements DataModel { + + @Column(name = "CODE", unique = true) + private String code; + + @Column(name = "NAME") + private String name; + + @Column(name = "DESCRIPTION") + private String description; + + /** + * @return the code + */ + @NotBlank(message = "{MUnitsFormCodeConstr}") + public String getCode() { + return code; + } + + /** + * @param code + * the code to set + */ + public void setCode(String code) { + this.code = code; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } +} diff --git a/src/main/java/info/bukova/isspst/filters/MUnitFilter.java b/src/main/java/info/bukova/isspst/filters/MUnitFilter.java new file mode 100644 index 00000000..55857dd2 --- /dev/null +++ b/src/main/java/info/bukova/isspst/filters/MUnitFilter.java @@ -0,0 +1,56 @@ +package info.bukova.isspst.filters; + +import static info.bukova.isspst.StringUtils.nullStr; +import info.bukova.isspst.data.MUnit; + +import org.hamcrest.Description; +import org.hamcrest.Factory; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +public class MUnitFilter implements Filter { + + private MUnit condMUnit; + + public MUnitFilter(MUnit condMUnit) { + this.condMUnit = condMUnit; + } + + private static class MUnitMatcher extends TypeSafeMatcher { + + private MUnit condMUnit; + + public MUnitMatcher(MUnit cond) { + this.condMUnit = cond; + } + + @Override + public void describeTo(Description desc) { + desc.appendText("munits matches"); + } + + @Override + public boolean matchesSafely(MUnit item) { + return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMUnit.getCode()).toLowerCase()) + && nullStr(item.getName()).toLowerCase().contains(nullStr(condMUnit.getName()).toLowerCase()) + && nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMUnit.getDescription()).toLowerCase()); + } + + @Factory + public static Matcher matchMUnit(MUnit munit) { + return new MUnitMatcher(munit); + } + } + + @Override + public MUnitMatcher matcher() { + return new MUnitMatcher(condMUnit); + } + + @Override + public String queryString() { + // TODO query string + return ""; + } + +} diff --git a/src/main/java/info/bukova/isspst/services/munits/MUnitService.java b/src/main/java/info/bukova/isspst/services/munits/MUnitService.java new file mode 100644 index 00000000..7b8d2947 --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/munits/MUnitService.java @@ -0,0 +1,8 @@ +package info.bukova.isspst.services.munits; + +import info.bukova.isspst.data.MUnit; +import info.bukova.isspst.services.Service; + +public interface MUnitService extends Service { + +} diff --git a/src/main/java/info/bukova/isspst/services/munits/MUnitServiceImpl.java b/src/main/java/info/bukova/isspst/services/munits/MUnitServiceImpl.java new file mode 100644 index 00000000..e929663d --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/munits/MUnitServiceImpl.java @@ -0,0 +1,8 @@ +package info.bukova.isspst.services.munits; + +import info.bukova.isspst.data.MUnit; +import info.bukova.isspst.services.AbstractService; + +public class MUnitServiceImpl extends AbstractService implements MUnitService{ + +} diff --git a/src/main/java/info/bukova/isspst/ui/BuildingForm.java b/src/main/java/info/bukova/isspst/ui/buildings/BuildingForm.java similarity index 70% rename from src/main/java/info/bukova/isspst/ui/BuildingForm.java rename to src/main/java/info/bukova/isspst/ui/buildings/BuildingForm.java index 8f2d0907..d0a4c0de 100644 --- a/src/main/java/info/bukova/isspst/ui/BuildingForm.java +++ b/src/main/java/info/bukova/isspst/ui/buildings/BuildingForm.java @@ -1,6 +1,7 @@ -package info.bukova.isspst.ui; +package info.bukova.isspst.ui.buildings; import info.bukova.isspst.data.Building; +import info.bukova.isspst.ui.FormViewModel; import org.zkoss.bind.annotation.Init; diff --git a/src/main/java/info/bukova/isspst/ui/BuildingList.java b/src/main/java/info/bukova/isspst/ui/buildings/BuildingList.java similarity index 86% rename from src/main/java/info/bukova/isspst/ui/BuildingList.java rename to src/main/java/info/bukova/isspst/ui/buildings/BuildingList.java index aadc1384..73233a03 100644 --- a/src/main/java/info/bukova/isspst/ui/BuildingList.java +++ b/src/main/java/info/bukova/isspst/ui/buildings/BuildingList.java @@ -1,8 +1,9 @@ -package info.bukova.isspst.ui; +package info.bukova.isspst.ui.buildings; import info.bukova.isspst.data.Building; import info.bukova.isspst.filters.BuildingFilter; import info.bukova.isspst.services.buildings.BuildingService; +import info.bukova.isspst.ui.ListViewModel; import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.select.annotation.WireVariable; diff --git a/src/main/java/info/bukova/isspst/ui/munits/MUnitsForm.java b/src/main/java/info/bukova/isspst/ui/munits/MUnitsForm.java new file mode 100644 index 00000000..bac42f0a --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/munits/MUnitsForm.java @@ -0,0 +1,14 @@ +package info.bukova.isspst.ui.munits; + +import info.bukova.isspst.data.MUnit; +import info.bukova.isspst.ui.FormViewModel; + +import org.zkoss.bind.annotation.Init; + +public class MUnitsForm extends FormViewModel { + + @Init(superclass = true) + public void init() { + + } +} diff --git a/src/main/java/info/bukova/isspst/ui/munits/MUnitsList.java b/src/main/java/info/bukova/isspst/ui/munits/MUnitsList.java new file mode 100644 index 00000000..3217ee08 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/munits/MUnitsList.java @@ -0,0 +1,23 @@ +package info.bukova.isspst.ui.munits; + +import info.bukova.isspst.data.MUnit; +import info.bukova.isspst.filters.MUnitFilter; +import info.bukova.isspst.services.munits.MUnitService; +import info.bukova.isspst.ui.ListViewModel; + +import org.zkoss.bind.annotation.Init; +import org.zkoss.zk.ui.select.annotation.WireVariable; + +public class MUnitsList extends ListViewModel { + + @WireVariable + private MUnitService munitService; + + @Init + public void init() { + service = munitService; + dataClass = MUnit.class; + formZul = "munitsForm.zul"; + dataFilter = new MUnitFilter(getFilterTemplate()); + } +} diff --git a/src/main/resources/ValidationMessages.properties b/src/main/resources/ValidationMessages.properties index ebe76fac..7f627910 100644 --- a/src/main/resources/ValidationMessages.properties +++ b/src/main/resources/ValidationMessages.properties @@ -1 +1,2 @@ -BuildingsFormCodeConstr=Zadejte k\u00f3d budovy... \ No newline at end of file +BuildingsFormCodeConstr=Zadejte k\u00f3d budovy... +MUnitsFormCodeConstr=Zadejte k\u00f3d m\u011brn\u00e9 jednotky... \ No newline at end of file diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index a50d30e6..5136da4b 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/ckez-bind-lang-addon.xml b/src/main/webapp/WEB-INF/lang-addons/ckez-bind-lang-addon.xml similarity index 100% rename from src/main/webapp/WEB-INF/ckez-bind-lang-addon.xml rename to src/main/webapp/WEB-INF/lang-addons/ckez-bind-lang-addon.xml diff --git a/src/main/webapp/WEB-INF/mapa-lang-addon.xml b/src/main/webapp/WEB-INF/lang-addons/mapa-lang-addon.xml similarity index 100% rename from src/main/webapp/WEB-INF/mapa-lang-addon.xml rename to src/main/webapp/WEB-INF/lang-addons/mapa-lang-addon.xml diff --git a/src/main/webapp/WEB-INF/spring/root-context.xml b/src/main/webapp/WEB-INF/spring/root-context.xml index d49e645c..13b4dbb6 100644 --- a/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/src/main/webapp/WEB-INF/spring/root-context.xml @@ -66,6 +66,7 @@ + @@ -107,6 +108,10 @@ + + + + @@ -132,6 +137,11 @@ + + + + + diff --git a/src/main/webapp/WEB-INF/zk-label.properties b/src/main/webapp/WEB-INF/zk-label.properties index 19c972fd..a7461dcf 100644 --- a/src/main/webapp/WEB-INF/zk-label.properties +++ b/src/main/webapp/WEB-INF/zk-label.properties @@ -1,6 +1,15 @@ # Default file AppName=Objednávkový systém SPŠ Třebíč +AgendaMUnits=Měrné jednotky +MUnitsFormTitle=Měrná jednotka +MUnitsFormCode=Kód +MUnitsFormName=Název +MUnitsFormDescription=Popis +MUnitsGridColumnCode=Kód +MUnitsGridColumnName=Název +MUnitsGridColumnDescription=Popis + AgendaBuildings=Budovy BuildingsFormTitle=Budova BuildingsFormCode=Kód diff --git a/src/main/webapp/WEB-INF/zk.xml b/src/main/webapp/WEB-INF/zk.xml index 57f1355d..1f1e39fb 100644 --- a/src/main/webapp/WEB-INF/zk.xml +++ b/src/main/webapp/WEB-INF/zk.xml @@ -19,8 +19,8 @@ - /WEB-INF/mapa-lang-addon.xml - /WEB-INF/ckez-bind-lang-addon.xml + /WEB-INF/lang-addons/mapa-lang-addon.xml + /WEB-INF/lang-addons/ckez-bind-lang-addon.xml /WEB-INF/lang-addons/CzechSortListheader.xml diff --git a/src/main/webapp/app/navigation.zul b/src/main/webapp/app/navigation.zul index 39cfd208..6b34b174 100644 --- a/src/main/webapp/app/navigation.zul +++ b/src/main/webapp/app/navigation.zul @@ -20,7 +20,8 @@ - + + @@ -30,7 +31,7 @@ - + diff --git a/src/main/webapp/buildings/building.zul b/src/main/webapp/buildings/building.zul index 11e2ac86..de6af063 100644 --- a/src/main/webapp/buildings/building.zul +++ b/src/main/webapp/buildings/building.zul @@ -1,7 +1,7 @@ - + diff --git a/src/main/webapp/buildings/buildingForm.zul b/src/main/webapp/buildings/buildingForm.zul index 72352c31..11bc4d0c 100644 --- a/src/main/webapp/buildings/buildingForm.zul +++ b/src/main/webapp/buildings/buildingForm.zul @@ -1,6 +1,6 @@ - + diff --git a/src/main/webapp/img/munits.png b/src/main/webapp/img/munits.png new file mode 100644 index 00000000..bc56ed73 Binary files /dev/null and b/src/main/webapp/img/munits.png differ diff --git a/src/main/webapp/munits/index.zul b/src/main/webapp/munits/index.zul new file mode 100644 index 00000000..f4754530 --- /dev/null +++ b/src/main/webapp/munits/index.zul @@ -0,0 +1,10 @@ + + + + + String gridZul = "munitsGrid.zul"; + + + + + \ No newline at end of file diff --git a/src/main/webapp/munits/munitsForm.zul b/src/main/webapp/munits/munitsForm.zul new file mode 100644 index 00000000..f76ec269 --- /dev/null +++ b/src/main/webapp/munits/munitsForm.zul @@ -0,0 +1,35 @@ + + + + + + + + + + + + + ${labels.MUnitsFormCode} : + + + + + + ${labels.MUnitsFormName} : + + + + + + ${labels.MUnitsFormDescription} : + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/munits/munitsGrid.zul b/src/main/webapp/munits/munitsGrid.zul new file mode 100644 index 00000000..04947096 --- /dev/null +++ b/src/main/webapp/munits/munitsGrid.zul @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +
+
\ No newline at end of file