From 06891a9c792349b59ce92a95961c07538f39f988 Mon Sep 17 00:00:00 2001 From: Timo Rupp Date: Fri, 23 Jun 2023 07:44:15 +0200 Subject: [PATCH] Remove unused code, remove irrelevant features, remove partial translation, streamline CMS naming --- master-detail-demo/cms/cms_de.yaml | 28 - master-detail-demo/cms/cms_en.yaml | 12 +- .../masterdetail/dao/DaoServiceRegistry.java | 8 - .../masterdetail/dao/ProductDatabaseDAO.java | 29 - .../masterdetail/service/TestDataService.java | 6 - .../ui/ProductDatabaseLazyDataModel.java | 513 ------------------ .../ui/ProductRepoLazyDataModel.java | 4 +- .../ProductDetail/ProductDetail.xhtml | 34 +- .../ProductList/ProductDetail.xhtml | 38 +- .../ProductList/ProductList.xhtml | 260 ++------- .../ProductList/ProductListProcess.p.json | 122 +---- 11 files changed, 97 insertions(+), 957 deletions(-) delete mode 100644 master-detail-demo/cms/cms_de.yaml delete mode 100644 master-detail-demo/src/com/axonivy/demo/masterdetail/dao/ProductDatabaseDAO.java delete mode 100644 master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductDatabaseLazyDataModel.java diff --git a/master-detail-demo/cms/cms_de.yaml b/master-detail-demo/cms/cms_de.yaml deleted file mode 100644 index 2a95c7f..0000000 --- a/master-detail-demo/cms/cms_de.yaml +++ /dev/null @@ -1,28 +0,0 @@ -Dialogs: - com: - axonivy: - demo: - statefuldatatable: - ui: - StatefulDatatable: - addNewBusiness: Add new Product - allUsers: Alle Nutzer - cancel: Abbrechen - columns: Spalten - copy: Copy - deleteProfileHeader: Löschen des Profils bestätigen - deleteProfileMessage: Möchten Sie dieses Profil wirklich löschen? - multichange: Multichange - onlyMe: Nur ich - privateProfiles: Privates Profil - productDetail: Produktdetail - profilType: Profiltyp - profileName: Profilname - publicProfiles: Öffentliches Profil - save: Speichern - saveProfile: Profil speichern -Labels: - cancel: Abbrechen - 'no': Nein - ok: Ok - 'yes': Ja diff --git a/master-detail-demo/cms/cms_en.yaml b/master-detail-demo/cms/cms_en.yaml index ca1777c..284df99 100644 --- a/master-detail-demo/cms/cms_en.yaml +++ b/master-detail-demo/cms/cms_en.yaml @@ -1,7 +1,7 @@ com: axonivy: demo: - statefuldatatable: + masterdetail: enums: Availability: IN_ORDER: @@ -32,9 +32,9 @@ Dialogs: com: axonivy: demo: - statefuldatatable: + masterdetail: ui: - StatefulDatatable: + ProductList: Error: deliveryDateBeforeOrderDate: Delivery date cannot be before Order date actions: Actions @@ -46,8 +46,6 @@ Dialogs: copy: Copy copyProduct: Copy Product delete: Delete - deleteProfileHeader: Profile Deletion - deleteProfileMessage: Are you sure you want to delete this profile? deleteSelected: Delete selected deletionHeader: Deleting products deletionMessage: Do you want to delete all the selected products? @@ -64,14 +62,10 @@ Dialogs: productDetail: Product Detail productName: Product Name products: List of products - profilType: Profile Type - profileName: Profilname - publicProfiles: Public Profiles quality: Quality quantity: Quantity required: 'Required:' save: Save - saveProfile: Save Profile state: State title: Stateful Datatable validThrough: Valid Through diff --git a/master-detail-demo/src/com/axonivy/demo/masterdetail/dao/DaoServiceRegistry.java b/master-detail-demo/src/com/axonivy/demo/masterdetail/dao/DaoServiceRegistry.java index a7348ef..589ec26 100644 --- a/master-detail-demo/src/com/axonivy/demo/masterdetail/dao/DaoServiceRegistry.java +++ b/master-detail-demo/src/com/axonivy/demo/masterdetail/dao/DaoServiceRegistry.java @@ -3,7 +3,6 @@ public class DaoServiceRegistry { private static ProductRepoDAO productRepoDAO = null; - private static ProductDatabaseDAO productDatabaseDAO = null; public static ProductRepoDAO getProductRepoDAO() { if(productRepoDAO == null) { @@ -11,11 +10,4 @@ public static ProductRepoDAO getProductRepoDAO() { } return productRepoDAO; } - - public static ProductDatabaseDAO getProductDatabaseDAO() { - if(productDatabaseDAO == null) { - productDatabaseDAO = new ProductDatabaseDAO(); - } - return productDatabaseDAO; - } } diff --git a/master-detail-demo/src/com/axonivy/demo/masterdetail/dao/ProductDatabaseDAO.java b/master-detail-demo/src/com/axonivy/demo/masterdetail/dao/ProductDatabaseDAO.java deleted file mode 100644 index 604f84b..0000000 --- a/master-detail-demo/src/com/axonivy/demo/masterdetail/dao/ProductDatabaseDAO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.axonivy.demo.masterdetail.dao; - -import java.util.List; - -import javax.persistence.criteria.CriteriaBuilder; - -import com.axonivy.demo.masterdetail.entity.Product; - -public class ProductDatabaseDAO extends AbstractEntityDAO implements IProductDAO { - @Override - public Class getType() { - return Product.class; - } - - @Override - public CriteriaBuilder getCriteriaBuilder() { - return super.getCriteriaBuilder(); - } - - @Override - public long getQueryRowCount(ch.ivyteam.ivy.business.data.store.search.Query query) { - return 0; - } - - @Override - public List callQueryWithLimit(ch.ivyteam.ivy.business.data.store.search.Query query, int first, int pageSize) { - return null; - } -} diff --git a/master-detail-demo/src/com/axonivy/demo/masterdetail/service/TestDataService.java b/master-detail-demo/src/com/axonivy/demo/masterdetail/service/TestDataService.java index ec971b7..7f02e3e 100644 --- a/master-detail-demo/src/com/axonivy/demo/masterdetail/service/TestDataService.java +++ b/master-detail-demo/src/com/axonivy/demo/masterdetail/service/TestDataService.java @@ -74,10 +74,4 @@ public static void createAndSaveBusinessTestData() throws ParseException { DaoServiceRegistry.getProductRepoDAO().save(product); } } - - public static void createAndSaveDatabaseTestData() throws ParseException { - for(Product product : createTestData()) { - DaoServiceRegistry.getProductDatabaseDAO().save(product); - } - } } diff --git a/master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductDatabaseLazyDataModel.java b/master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductDatabaseLazyDataModel.java deleted file mode 100644 index 7a94c81..0000000 --- a/master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductDatabaseLazyDataModel.java +++ /dev/null @@ -1,513 +0,0 @@ -package com.axonivy.demo.masterdetail.ui; - -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.el.ValueExpression; -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.primefaces.component.datatable.DataTable; -import org.primefaces.event.ToggleEvent; -import org.primefaces.model.FilterMeta; -import org.primefaces.model.LazyDataModel; -import org.primefaces.model.SortMeta; -import org.primefaces.model.SortOrder; -import org.primefaces.model.Visibility; -import org.primefaces.model.filter.FilterConstraint; - -import com.axonivy.demo.masterdetail.dao.DaoServiceRegistry; -import com.axonivy.demo.masterdetail.entity.Product; -import com.axonivy.demo.masterdetail.enums.ProductStatus; -import com.axonivy.demo.masterdetail.enums.Quality; -import com.axonivy.demo.masterdetail.service.DateService; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import ch.ivyteam.ivy.environment.Ivy; -import ch.ivyteam.ivy.scripting.objects.DateTime; -import ch.ivyteam.ivy.security.IUser; -/** - * This is the Lazy Data Model used in the primefaces datatable. The model has additional fields to store sorting and visibility data. - * There are also filters that are set for the first time when the datatable will load. After each load the sorting, filtering and visibility data are saved - * into IUser data. - * - * @author david.merunko - * - */ -public class ProductDatabaseLazyDataModel extends LazyDataModel implements ProductLazyDataModel { - private static final long serialVersionUID = 1L; - public static final String TABLE_LAZY_PREFIX = "form:productTable:"; - public static final String TABLE_UI_PATH = "form:productTable"; - //Adding Column STEP 3 - //Dropdown filters - public static final String QUALITY_FILTER = "quality"; - public static final String BUSINESS_OBJECT_STATUS_FILTER = "productStatus"; - public static final String AVAILABILITY_FILTER = "availability"; - //Date filters - public static final String VALID_THROUGH_FILTER = "validThrough"; - public static final String ORDER_DATE_FILTER = "orderDate"; - public static final String DELIVERY_DATE_FILTER = "deliveryDate"; - //Number range filter - public static final String QUANTITY_FILTER = "quantity"; - //Text filter - public static final String PRODUCT_NAME_FILTER = "productName"; - //Boolean filter - public static final String ON_SALE_FILTER = "onSale"; - - - //Map that holds the initial filters loaded from IUser - private Map filtersFromIUser; - //List that holds the sorting data - private List sortBy = new ArrayList<>(); - //Map that holds the visibility of columns - private Map columnVisibility = new HashMap<>(); - private int tableRows; - - private boolean useSavedFilters = true; - private boolean useSavedSorting = true; - private boolean showNotApplicable = true; - private boolean tableDefault = true; - - @Override - public Product getRowData(String rowKey) { - return DaoServiceRegistry.getProductDatabaseDAO().getById(rowKey); - } - - @Override - public String getRowKey(Product product) { - return String.valueOf(product.getId()); - } - - /** - * Get filter Text from IUser filter data to show up in the UI - */ - public Map getFilterText() { - Map filterFromIUserMap = new HashMap<>(); - if (filtersFromIUser != null) { - //For each filter from the IUser we set the value of the column filter to its value. To work correctly we need the full DOM path - for (Entry filter : filtersFromIUser.entrySet()) { - filterFromIUserMap.put(filter.getKey(), filter.getValue().getFilterValue()); - } - } - - return filterFromIUserMap; - } - - @Override - public int count(Map filterBy) { - // TODO Auto-generated method stub - return 0; - } - - /** - * Main load method for the lazy data model. At the begining we set the filters from IUser the first time tabl is loaded. At the end, we save - * filter and sorting. - */ - @Override - public List load(int first, int pageSize, Map sortBy, Map filterBy) { - if (filterBy.isEmpty() && sortBy.size() == 2 && !columnVisibility.containsValue(false) - && sortBy.get(PRODUCT_NAME_FILTER) != null - && sortBy.get(PRODUCT_NAME_FILTER).getOrder() == SortOrder.DESCENDING - && sortBy.get(VALID_THROUGH_FILTER) != null - && sortBy.get(VALID_THROUGH_FILTER).getOrder() == SortOrder.DESCENDING) { - tableDefault = true; - } else { - tableDefault = false; - } - - //First time the table is loaded, we use the filters from IUser - if(useSavedFilters && filtersFromIUser != null) { - filterBy = filtersFromIUser; - useSavedFilters = false; - } - - if(this.sortBy != null && useSavedSorting) { - sortBy.clear(); - for(SortMeta sortMeta : this.sortBy) { - sortBy.put(sortMeta.getField(), sortMeta); - } - useSavedSorting = false; - } - - //Setup for database query - CriteriaBuilder cb = DaoServiceRegistry.getProductDatabaseDAO().getCriteriaBuilder(); - CriteriaQuery cr = cb.createQuery(Product.class); - Root root = cr.from(Product.class); - List predicates = new ArrayList<>(); - - //Adding Column STEP 4 - //Filtering based on the table columns - addStringContainsQueryFilter(predicates, cb, root, PRODUCT_NAME_FILTER, filterBy); - - addNumberRangeQueryFilter(predicates, cb, root, QUANTITY_FILTER, filterBy); - - addDateRangeQueryFilter(predicates, cb, root, VALID_THROUGH_FILTER, filterBy, false); - addDateRangeQueryFilter(predicates, cb, root, ORDER_DATE_FILTER, filterBy, false); - addDateRangeQueryFilter(predicates, cb, root, DELIVERY_DATE_FILTER, filterBy, false); - - addSelectOneMenuQueryFilter(predicates, cb, root, AVAILABILITY_FILTER, filterBy); - addSelectOneMenuQueryFilter(predicates, cb, root, QUALITY_FILTER, filterBy); - addSelectOneMenuQueryFilter(predicates, cb, root, BUSINESS_OBJECT_STATUS_FILTER, filterBy); - - addBooleanQueryFilter(predicates, cb, root, ON_SALE_FILTER, filterBy); - - List orderList = new ArrayList<>(); - //Ordering with Sort Meta - if(sortBy != null) { - for(Entry sortMeta : sortBy.entrySet()) { - if(sortMeta.getValue().getOrder() == SortOrder.DESCENDING) { - orderList.add(cb.desc(root.get(sortMeta.getValue().getField()))); - } else { - orderList.add(cb.asc(root.get(sortMeta.getValue().getField()))); - } - } - } - - cr.select(root).where(predicates.toArray(new Predicate[0])).orderBy(orderList); - List result = DaoServiceRegistry.getProductDatabaseDAO().getByCriteriaQuery(cr, first, pageSize); - setRowCount(DaoServiceRegistry.getProductDatabaseDAO().getByCriteriaQuery(cr).size()); - //setRowCount(10); - //Saving the filters and sorting - saveFilterStateAndvalueIntoIUser(filterBy); - saveSortMetaIntoIUser(sortBy); - saveTableRowsIntoIUser(); - - filtersFromIUser = filterBy; - for(Entry sortMeta : sortBy.entrySet()) { - this.sortBy.add(sortMeta.getValue()); - } - - return result; - } - - public Product updateProduct(Product product, List newObjects, - String field) throws InterruptedException { - //Adding Column STEP 5 - if (field.contains("productName")) { - product.setProductName((String) newObjects.get(0)); - } else if (field.contains("productStatus")) { - product.setProductStatus((ProductStatus) newObjects.get(0)); - } else if (field.contains("validThrough")) { - DateTime dateTime = (DateTime) newObjects.get(0); - product.setValidThrough(dateTime.toJavaDate()); - } else if (field.contains("orderDate")) { - DateTime dateTime = (DateTime) newObjects.get(0); - //Example validation - if(dateTime.toJavaDate().after(product.getDeliveryDate())) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, Ivy.cms().co("/Dialogs/com/axonivy/demo/statefuldatatable/ui/StatefulDatatable/Error/deliveryDateBeforeOrderDate"), null)); - return product; - } - product.setOrderDate(dateTime.toJavaDate()); - } else if (field.contains("deliveryDate")) { - DateTime dateTime = (DateTime) newObjects.get(0); - //Example validation - if(dateTime.toJavaDate().before(product.getOrderDate())) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, Ivy.cms().co("/Dialogs/com/axonivy/demo/statefuldatatable/ui/StatefulDatatable/Error/deliveryDateBeforeOrderDate"), null)); - return product; - } - product.setDeliveryDate(dateTime.toJavaDate()); - } else if (field.contains("quantity")) { - product.setQuantity((Integer) newObjects.get(0)); - } else if (field.contains("quality")) { - product.setQuality((Quality) newObjects.get(0)); - } else if (field.contains("onSale")) { - product.setOnSale((Boolean) newObjects.get(0)); - } - - DaoServiceRegistry.getProductDatabaseDAO().save(product); - - Thread.sleep(1000); - - return product; - } - - public void deleteOrder(Product product) { - DaoServiceRegistry.getProductDatabaseDAO().delete(product); - } - - public void saveProduct(Product product) { - DaoServiceRegistry.getProductDatabaseDAO().save(product); - } - - private void addSelectOneMenuQueryFilter(List predicates, CriteriaBuilder cb, Root root, String filterName, Map filters) { - if(filters.get(filterName) != null) { - if(filters.get(filterName).getFilterValue() instanceof ArrayList) { - ArrayList statusArray = (ArrayList) filters.get(filterName).getFilterValue(); - if(!statusArray.isEmpty()) { - predicates.add(cb.in(root.get(filterName)).value(statusArray)); - } - } - if(filters.get(filterName).getFilterValue() instanceof Object[]) { - Object[] statusArray = (Object[]) filters.get(filterName).getFilterValue(); - - if(statusArray.length != 0 && statusArray[0] != null) { - predicates.add(root.get(filterName).in(statusArray)); - } - } - - } - } - - private void addBooleanQueryFilter(List predicates, CriteriaBuilder cb, Root root, String filterName, Map filters) { - if(filters.get(filterName) != null) { - if(filters.get(filterName).getFilterValue() instanceof Object[]) { - Object[] statusArray = (Object[]) filters.get(filterName).getFilterValue(); - if(statusArray.length != 0 && statusArray[0] != null) { - predicates.add(root.get(filterName).in(statusArray)); - } - } - } - } - - private void addNumberRangeQueryFilter(List predicates, CriteriaBuilder cb, Root root, String filterName, Map filters) { - if(filters.get(filterName) != null) { - String[] amounts = filters.get(filterName).getFilterValue().toString().split("-"); - if(amounts.length > 1 && amounts[0].length() > 0 && amounts[1].length() > 0) { - Double amountFrom = Double.parseDouble(amounts[0]); - Double amountTo = Double.parseDouble(amounts[1]); - predicates.add(cb.and(cb.ge(root.get(filterName), amountFrom), cb.le(root.get(filterName), amountTo))); - } else { - try { - Double number = Double.parseDouble(filters.get(filterName).getFilterValue().toString().replace("-", "")); - predicates.add(cb.between(root.get(filterName), number-0.01, number+0.01)); - } catch(NumberFormatException e) { - Ivy.log().error("Filterwert ist keine Zahl"); - } - } - } - } - - private void addStringContainsQueryFilter(List predicates, CriteriaBuilder cb, Root root, String filterName, Map filters) { - if(filters.get(filterName) != null) { - predicates.add(cb.like(root.get(filterName), "%" + filters.get(filterName).getFilterValue().toString() + "%")); - } - } - - private void addDateRangeQueryFilter(List predicates, CriteriaBuilder cb, Root root, String filterName, Map filters, boolean checkStatus) { - if(filters.get(filterName) != null) { - List dateRange = (ArrayList) filters.get(filterName).getFilterValue(); - if(dateRange.size() > 1) { - predicates.add(cb.and(cb.greaterThanOrEqualTo(root.get(filterName), DateService.setTimeZero(dateRange.get(0))), cb.lessThanOrEqualTo(root.get(filterName), DateService.setTimeMidnight(dateRange.get(1))))); - } - } - } - - /** - * Save column visibility Values into IUser as JSON - */ - public void saveColumnVisibilityToIUser(ToggleEvent e) { - if(e != null) { - DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent(TABLE_UI_PATH); - columnVisibility.put(dataTable.getColumns().get((Integer) e.getData()).getColumnKey().replace(TABLE_LAZY_PREFIX, ""), e.getVisibility() == Visibility.VISIBLE); - } - - Gson objGson = new GsonBuilder().setPrettyPrinting().create(); - String visibilityToJson = objGson.toJson(columnVisibility); - - IUser currentUser = Ivy.session().getSessionUser(); - currentUser.setProperty("COLUMN_VISIBILITY", visibilityToJson); - } - - public abstract class FilterMixin { - @JsonIgnore - ValueExpression filterBy; - - @JsonIgnore - FilterConstraint constraint; - - @JsonIgnore - abstract boolean isActive(); - - @JsonIgnore - abstract boolean isGlobalFilter(); - } - - /** - * Save filter values into IUser as JSON - */ - private void saveFilterStateAndvalueIntoIUser(Map filters) { - Map> searchFilterMap = new HashMap<>(); - searchFilterMap.put("searchFilters", filters); - - ObjectMapper mapper = new ObjectMapper(); - mapper.registerModule(new JavaTimeModule()); - mapper.addMixIn(FilterMeta.class, FilterMixin.class); - JsonNode jsonNode = mapper.valueToTree(filters); - String mapToJson = ""; - - try { - mapToJson = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode); - } catch (JsonProcessingException e) { - Ivy.log().error("Couldn't parse filter map to json"); - } - - IUser currentUser = Ivy.session().getSessionUser(); - currentUser.setProperty("FILTER_SEARCH", mapToJson); - } - - /** - * Save rows number into IUser as property - */ - private void saveTableRowsIntoIUser() { - IUser currentUser = Ivy.session().getSessionUser(); - currentUser.setProperty("TABLE_ROWS", "" + tableRows); - } - - public abstract class SortMixin { - @JsonIgnore - ValueExpression sortBy; - - @JsonIgnore - abstract boolean isActive(); - } - - /** - * Save sorting values into IUser as JSON - */ - private void saveSortMetaIntoIUser(Map multiSortMeta) { - Map> sortMap = new HashMap<>(); - sortMap.put("searchSort", multiSortMeta); - - ObjectMapper mapper = new ObjectMapper(); - mapper.registerModule(new JavaTimeModule()); - mapper.addMixIn(SortMeta.class, SortMixin.class); - JsonNode jsonNode = mapper.valueToTree(multiSortMeta); - String mapToJson = ""; - - try { - mapToJson = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode); - } catch (JsonProcessingException e) { - Ivy.log().error("Couldn't parse filter map to json"); - } - - IUser currentUser = Ivy.session().getSessionUser(); - currentUser.setProperty("SORT_SEARCH", mapToJson); - } - - /** - * @return the defaultFilter - */ - public Map getFiltersFromIUser() { - return filtersFromIUser; - } - - /** - * @param filtersFromIUser the defaultFilter to set - */ - public void setFiltersFromIUser(Map filtersFromIUser) { - this.filtersFromIUser = filtersFromIUser; - } - - /** - * @return the sortBy - */ - public List getSortBy() { - return sortBy; - } - - /** - * @param sortBy the sortBy to set - */ - public void setSortBy(List sortBy) { - this.sortBy = sortBy; - } - - /** - * @return the columnVisibility - */ - public Map getColumnVisibility() { - return columnVisibility; - } - - /** - * @param columnVisibility the columnVisibility to set - */ - public void setColumnVisibility(Map columnVisibility) { - this.columnVisibility = columnVisibility; - } - - /** - * @return the useSavedFilters - */ - public boolean isUseSavedFilters() { - return useSavedFilters; - } - - /** - * @param useSavedFilters the useSavedFilters to set - */ - public void setUseSavedFilters(boolean useSavedFilters) { - this.useSavedFilters = useSavedFilters; - } - - /** - * @return the useSavedSorting - */ - public boolean isUseSavedSorting() { - return useSavedSorting; - } - - /** - * @param useSavedSorting the useSavedSorting to set - */ - public void setUseSavedSorting(boolean useSavedSorting) { - this.useSavedSorting = useSavedSorting; - } - - /** - * @return the showNotApplicable - */ - public boolean isShowNotApplicable() { - return showNotApplicable; - } - - /** - * @param showNotApplicable the showNotApplicable to set - */ - public void setShowNotApplicable(boolean showNotApplicable) { - this.showNotApplicable = showNotApplicable; - } - - /** - * @return the tableDefault - */ - public boolean isTableDefault() { - return tableDefault; - } - - /** - * @param tableDefault the tableDefault to set - */ - public void setTableDefault(boolean tableDefault) { - this.tableDefault = tableDefault; - } - - /** - * @return the tableRows - */ - public int getTableRows() { - return tableRows; - } - - /** - * @param tableRows the tableRows to set - */ - public void setTableRows(int tableRows) { - this.tableRows = tableRows; - } -} diff --git a/master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductRepoLazyDataModel.java b/master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductRepoLazyDataModel.java index 7f10285..de3fa03 100644 --- a/master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductRepoLazyDataModel.java +++ b/master-detail-demo/src/com/axonivy/demo/masterdetail/ui/ProductRepoLazyDataModel.java @@ -207,7 +207,7 @@ public Product updateProduct(Product product, List newObjects, DateTime dateTime = (DateTime) newObjects.get(0); //Example validation if(dateTime.toJavaDate().after(product.getDeliveryDate())) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, Ivy.cms().co("/Dialogs/com/axonivy/demo/statefuldatatable/ui/StatefulDatatable/Error/deliveryDateBeforeOrderDate"), null)); + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, Ivy.cms().co("/Dialogs/com/axonivy/demo/masterdetail/ui/ProductList/Error/deliveryDateBeforeOrderDate"), null)); return product; } product.setOrderDate(dateTime.toJavaDate()); @@ -215,7 +215,7 @@ public Product updateProduct(Product product, List newObjects, DateTime dateTime = (DateTime) newObjects.get(0); //Example validation if(dateTime.toJavaDate().before(product.getOrderDate())) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, Ivy.cms().co("/Dialogs/com/axonivy/demo/statefuldatatable/ui/StatefulDatatable/Error/deliveryDateBeforeOrderDate"), null)); + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, Ivy.cms().co("/Dialogs/com/axonivy/demo/masterdetail/ui/ProductList/Error/deliveryDateBeforeOrderDate"), null)); return product; } product.setDeliveryDate(dateTime.toJavaDate()); diff --git a/master-detail-demo/src_hd/com/axonivy/demo/masterdetail/ProductDetail/ProductDetail.xhtml b/master-detail-demo/src_hd/com/axonivy/demo/masterdetail/ProductDetail/ProductDetail.xhtml index d75f8c1..8765c25 100644 --- a/master-detail-demo/src_hd/com/axonivy/demo/masterdetail/ProductDetail/ProductDetail.xhtml +++ b/master-detail-demo/src_hd/com/axonivy/demo/masterdetail/ProductDetail/ProductDetail.xhtml @@ -7,7 +7,7 @@ xmlns:pe="http://primefaces.org/ui/extensions"> - #{ivy.cms.co('/Dialogs/com/axonivy/demo/statefuldatatable/ui/StatefulDatatable/productDetail')} + #{ivy.cms.co('/Dialogs/com/axonivy/demo/masterdetail/ui/ProductList/productDetail')}