diff --git a/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewController.java b/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewController.java
index 3fff0bd..a0b44fa 100644
--- a/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewController.java
+++ b/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewController.java
@@ -49,6 +49,16 @@ import jakarta.servlet.http.HttpServletRequest;
/**
* The DataViewController is used to display a data view
+ *
+ * The controller uses a cacheId provided together with the uniqueId of the
+ * dataViewDefinition in the URL. The bean reads optional cached query data form
+ * 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
+ * late uses browser history back.
+ *
+ * Note: This bean is ConversationScoped, because it uses the
+ * CustomFormController which expects conversion scope!
+ *
*
* @author rsoika
* @version 1.0
@@ -59,7 +69,11 @@ import jakarta.servlet.http.HttpServletRequest;
public class DataViewController extends ViewController {
private static final long serialVersionUID = 1L;
- private List sections;
+ private List sections = null;
+ private List viewItemDefinitions = null;
+ protected ItemCollection dataDefinition = null;
+ private ItemCollection filter;
+ private String query;
private String errorMessage;
@Inject
@@ -77,9 +91,8 @@ public class DataViewController extends ViewController {
@Inject
ViewHandler viewHandler;
- protected ItemCollection data = null;
- private ItemCollection filter;
- private String query;
+ @Inject
+ DataViewDefinitionController dataViewDefinitionController;
private static Logger logger = Logger.getLogger(DataViewController.class.getName());
@@ -118,7 +131,7 @@ public class DataViewController extends ViewController {
// alternative 'workitem=...'
uniqueid = paramMap.get("workitem");
}
- data = documentService.load(uniqueid);
+ dataDefinition = documentService.load(uniqueid);
}
logger.info("> cacheid=" + cacheid);
@@ -130,8 +143,10 @@ public class DataViewController extends ViewController {
try {
// Init new Filter....
- if (data != null) {
- filter.setItemValue("txtWorkflowEditorCustomForm", data.getItemValue("form"));
+ if (dataDefinition != null) {
+ filter.setItemValue("txtWorkflowEditorCustomForm", dataDefinition.getItemValue("form"));
+ viewItemDefinitions = DataViewDefinitionController
+ .computeDataViewItemDefinitions(dataDefinition);
customFormController.computeFieldDefinition(filter);
sections = customFormController.getSections();
@@ -151,13 +166,17 @@ public class DataViewController extends ViewController {
}
public ItemCollection getDefinition() {
- return data;
+ return dataDefinition;
}
public List getSections() {
return sections;
}
+ public List getViewItemDefinitions() {
+ return viewItemDefinitions;
+ }
+
public ItemCollection getFilter() {
return filter;
}
@@ -188,7 +207,7 @@ public class DataViewController extends ViewController {
reset();
// build new query from template
- query = data.getItemValueString("query");
+ query = dataDefinition.getItemValueString("query");
List filterItems = filter.getItemNames();
for (String itemName : filterItems) {
@@ -227,28 +246,28 @@ public class DataViewController extends ViewController {
return query;
}
- /**
- * Returns the current workItem. If no workitem is defined the method
- * Instantiates a empty ItemCollection.
- *
- * @return - current workItem or null if not set
- */
- public ItemCollection getData() {
- // do initialize an empty workItem here if null
- if (data == null) {
- reset();
- }
- return data;
- }
+ // /**
+ // * Returns the current workItem. If no workitem is defined the method
+ // * Instantiates a empty ItemCollection.
+ // *
+ // * @return - current workItem or null if not set
+ // */
+ // public ItemCollection getData() {
+ // // do initialize an empty workItem here if null
+ // if (data == null) {
+ // reset();
+ // }
+ // return data;
+ // }
- /**
- * Set the current workItem
- *
- * @param workitem - new reference or null to clear the current workItem.
- */
- public void setData(ItemCollection document) {
- this.data = document;
- }
+ // /**
+ // * Set the current workItem
+ // *
+ // * @param workitem - new reference or null to clear the current workItem.
+ // */
+ // public void setData(ItemCollection document) {
+ // this.data = document;
+ // }
/**
* This method navigates back in the page index and caches the current page
diff --git a/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewDefinitionController.java b/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewDefinitionController.java
index 1adc41b..aa80d05 100644
--- a/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewDefinitionController.java
+++ b/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewDefinitionController.java
@@ -30,17 +30,14 @@ import java.util.Map;
import java.util.logging.Logger;
import org.imixs.workflow.ItemCollection;
-import org.imixs.workflow.engine.DocumentEvent;
import org.imixs.workflow.exceptions.AccessDeniedException;
import org.imixs.workflow.faces.data.AbstractDataController;
import org.imixs.workflow.faces.data.DocumentController;
-import org.imixs.workflow.office.forms.ChildItemController;
import com.oracle.svm.core.annotate.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ConversationScoped;
-import jakarta.enterprise.event.Observes;
import jakarta.faces.context.ExternalContext;
import jakarta.faces.context.FacesContext;
import jakarta.inject.Named;
@@ -59,9 +56,6 @@ public class DataViewDefinitionController extends AbstractDataController {
protected List attributeList = null;
- @Inject
- ChildItemController childItemController;
-
@Inject
DocumentController documentController;
@@ -103,22 +97,71 @@ public class DataViewDefinitionController extends AbstractDataController {
}
/**
- * Set the current worktItem
+ * Set the current dataview definition.
+ * The method computes the attributes.
*
- * @param workitem - new reference or null to clear the current workItem.
+ * @param document - the DataView definition
*/
- public void setData(ItemCollection document) {
- this.data = document;
+ // public void setData(ItemCollection document) {
+ // this.data = document;
+ // attributeList = computeDataViewItemDefinitions(this.data);
+ // }
- attributeList = new ArrayList();
- List