update data views

This commit is contained in:
Ralph Soika 2025-05-12 18:34:58 +02:00
parent 65a1d4f2b7
commit e987a30053
8 changed files with 49 additions and 27 deletions

View file

@ -58,8 +58,8 @@ import jakarta.servlet.http.HttpServletRequest;
/** /**
* The DataViewController is used to display a data view * The DataViewController is used to display a data view
* <p> * <p>
* The controller uses a cacheId provided together with the uniqueId of the * The controller uses the uniqueId from the URL to load the definition.
* dataViewDefinition in the URL. The bean reads optional cached query data form * The bean reads optional cached query data form
* a session scoped cache EJB and reloads the last state. This is useful for * a session scoped cache EJB and reloads the last state. This is useful for
* situations where the user navigates to a new page (e.g. open a workitem) and * situations where the user navigates to a new page (e.g. open a workitem) and
* late uses browser history back. * late uses browser history back.
@ -128,7 +128,7 @@ public class DataViewController extends ViewController {
* This method loads the custom form sections * This method loads the custom form sections
*/ */
public void onLoad() { public void onLoad() {
String cacheid = null; String uniqueid = null;
// Important: start a new conversation beause of the usage of the // Important: start a new conversation beause of the usage of the
// CustomFormController! // CustomFormController!
@ -140,8 +140,7 @@ public class DataViewController extends ViewController {
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
Map<String, String> paramMap = fc.getExternalContext().getRequestParameterMap(); Map<String, String> paramMap = fc.getExternalContext().getRequestParameterMap();
// try to extract the uniqueid form the query string... // try to extract the uniqueid form the query string...
cacheid = paramMap.get("cacheid"); uniqueid = paramMap.get("id");
String uniqueid = paramMap.get("id");
if (uniqueid == null || uniqueid.isEmpty()) { if (uniqueid == null || uniqueid.isEmpty()) {
// alternative 'workitem=...' // alternative 'workitem=...'
uniqueid = paramMap.get("workitem"); uniqueid = paramMap.get("workitem");
@ -149,9 +148,8 @@ public class DataViewController extends ViewController {
dataDefinition = documentService.load(uniqueid); dataDefinition = documentService.load(uniqueid);
} }
logger.finest("> cacheid=" + cacheid); if (uniqueid != null && !uniqueid.isEmpty()) {
if (cacheid != null && !cacheid.isEmpty()) { filter = dataViewCache.get(uniqueid);
filter = dataViewCache.get(cacheid);
} else { } else {
filter = new ItemCollection(); filter = new ItemCollection();
} }
@ -227,6 +225,7 @@ public class DataViewController extends ViewController {
* @throws QueryException * @throws QueryException
*/ */
public void run() throws QueryException { public void run() throws QueryException {
reset(); reset();
// build new query from template // build new query from template
@ -257,6 +256,8 @@ public class DataViewController extends ViewController {
// Prefetch data to update total count and page count // Prefetch data to update total count and page count
viewHandler.getData(this); viewHandler.getData(this);
// cache filter
dataViewCache.put(dataDefinition.getUniqueID(), filter);
} }

View file

@ -131,9 +131,8 @@ public class DataViewDefinitionController extends AbstractDataController {
* *
* @return * @return
*/ */
public String getViewURI() { public String getViewURI(ItemCollection dataDef) {
return "/pages/dataviews/data.xhtml?id=" + data.getUniqueID() + "&cacheid=" + System.currentTimeMillis() return "/pages/dataviews/data.xhtml?id=" + dataDef.getUniqueID() + "&faces-redirect=true";
+ "&faces-redirect=true";
} }
@Override @Override

View file

@ -34,3 +34,14 @@
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
} }
.dataview .align-right {
text-align: right;
}
.dataview .align-center {
text-align: center;
}
.dataview td {
padding: 5px 10px !important;
}

View file

@ -44,7 +44,7 @@
<h1><span class="typcn typcn-edit"></span> Query Definition <h1><span class="typcn typcn-edit"></span> Query Definition
<span style="font-size: 1rem;margin-left:20px;"> <span style="font-size: 1rem;margin-left:20px;">
<h:outputLink <h:outputLink
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.viewURI}" value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataViewDefinitionController.data)}"
target="dataview"><span class="typcn typcn-camera-outline" target="dataview"><span class="typcn typcn-camera-outline"
style="font-size: 1.2rem;"></span> Test View style="font-size: 1.2rem;"></span> Test View
</h:outputLink> </h:outputLink>
@ -223,7 +223,7 @@
<h1><span class="typcn typcn-th-list-outline"></span> Form Definition<span <h1><span class="typcn typcn-th-list-outline"></span> Form Definition<span
style="font-size: 1rem;margin-left:20px;"> style="font-size: 1rem;margin-left:20px;">
<h:outputLink <h:outputLink
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.viewURI}" value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataViewDefinitionController.data)}"
target="dataview"><span class="typcn typcn-camera-outline" target="dataview"><span class="typcn typcn-camera-outline"
style="font-size: 1.2rem;"></span> Test View style="font-size: 1.2rem;"></span> Test View
</h:outputLink> </h:outputLink>
@ -254,7 +254,7 @@
<h1><span class="typcn typcn-news"></span> Template<span <h1><span class="typcn typcn-news"></span> Template<span
style="font-size: 1rem;margin-left:20px;"> style="font-size: 1rem;margin-left:20px;">
<h:outputLink <h:outputLink
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.viewURI}" value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataViewDefinitionController.data)}"
target="dataview"><span class="typcn typcn-camera-outline" target="dataview"><span class="typcn typcn-camera-outline"
style="font-size: 1.2rem;"></span> Test View style="font-size: 1.2rem;"></span> Test View
</h:outputLink> </h:outputLink>
@ -296,7 +296,6 @@
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt> <dt>
Source File : Source File :
@ -305,13 +304,8 @@
<i:imixsFileUpload showattachments="true" <i:imixsFileUpload showattachments="true"
workitem="#{dataViewDefinitionController.data}" workitem="#{dataViewDefinitionController.data}"
context_url="#{facesContext.externalContext.requestContextPath}/api/snapshot/#{dataViewDefinitionController.data.item['$uniqueid']}" /> context_url="#{facesContext.externalContext.requestContextPath}/api/snapshot/#{dataViewDefinitionController.data.item['$uniqueid']}" />
</dd> </dd>
</dl> </dl>
</div> </div>
</div> </div>
</div> </div>
@ -319,8 +313,8 @@
<div class="imixs-footer"> <div class="imixs-footer">
<h:commandButton action="/pages/admin/dataViewDefinitions?faces-redirect=true" <h:commandButton actionListener="#{dataViewDefinitionController.save()}"
actionListener="#{dataViewDefinitionController.save()}" value="#{message.save}" /> value="#{message.save}" />
<h:commandButton value="Open View" <h:commandButton value="Open View"
action="#{dataViewDefinitionController.openTestView()}" /> action="#{dataViewDefinitionController.openTestView()}" />

View file

@ -133,7 +133,7 @@
<div class="imixs-form-section"> <div class="imixs-form-section">
<h:dataTable id="view_body" styleClass="imixsdatatable" value="#{searchResult}" <h:dataTable id="view_body" styleClass="imixsdatatable dataview" value="#{searchResult}"
var="record"> var="record">
@ -156,7 +156,8 @@
<h:outputText value="#{record.item[columnDef.item['item.name']]}" /> <h:outputText value="#{record.item[columnDef.item['item.name']]}" />
</h:column> </h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:date'}"> <h:column rendered="#{columnDef.item['item.type'] eq 'xs:date'}"
styleClass="align-center">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet> <f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}"> <h:outputText value="#{record.item[columnDef.item['item.name']]}">
<f:convertDateTime timeZone="#{message.timeZone}" type="both" <f:convertDateTime timeZone="#{message.timeZone}" type="both"
@ -165,6 +166,22 @@
</h:column> </h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:double'}"
styleClass="align-right">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText>
</h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:float'}"
styleClass="align-right">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText>
</h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:dateTime'}"> <h:column rendered="#{columnDef.item['item.type'] eq 'xs:dateTime'}">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet> <f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}"> <h:outputText value="#{record.item[columnDef.item['item.name']]}">

View file

@ -82,7 +82,7 @@
<ui:param name="dataViewDescription" value="#{dataview.item['description']}" /> <ui:param name="dataViewDescription" value="#{dataview.item['description']}" />
<li> <li>
<h:outputLink title="" <h:outputLink title=""
value="#{facesContext.externalContext.requestContextPath}/pages/dataviews/data.xhtml?id=#{dataview.item['$uniqueid']}&amp;faces-redirect=true" value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataview)}"
target="dataview"><span class="typcn typcn-th-menu" target="dataview"><span class="typcn typcn-th-menu"
style="font-size: 1.2rem;margin-right:10px;"></span> style="font-size: 1.2rem;margin-right:10px;"></span>
<h:outputText value="#{dataview.item['name']}" /> <h:outputText value="#{dataview.item['name']}" />

Binary file not shown.