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 44a9477..b1030ba 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 @@ -31,13 +31,14 @@ import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.exceptions.AccessDeniedException; +import org.imixs.workflow.exceptions.QueryException; import org.imixs.workflow.faces.data.AbstractDataController; import org.imixs.workflow.faces.data.DocumentController; import com.oracle.svm.core.annotate.Inject; import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.ConversationScoped; +import jakarta.enterprise.context.SessionScoped; import jakarta.faces.context.ExternalContext; import jakarta.faces.context.FacesContext; import jakarta.inject.Named; @@ -49,7 +50,7 @@ import jakarta.inject.Named; * @version 1.0 */ @Named -@ConversationScoped +@SessionScoped public class DataViewDefinitionController extends AbstractDataController { private static final long serialVersionUID = 1L; @@ -59,6 +60,8 @@ public class DataViewDefinitionController extends AbstractDataController { @Inject DocumentController documentController; + protected List dataViewDefinitions = null; + private static Logger logger = Logger.getLogger(DataViewDefinitionController.class.getName()); /** @@ -70,6 +73,43 @@ public class DataViewDefinitionController extends AbstractDataController { } + public List getDefinitions() { + if (dataViewDefinitions == null) { + // lazy loading + String quuery = "(type:\"dataview\")"; + try { + dataViewDefinitions = this.getDocumentService().find(quuery, 999, 0, "name", false); + } catch (QueryException e) { + logger.severe("Failed to load DataView definition list: " + e.getMessage()); + } + + } + + return dataViewDefinitions; + + } + + /** + * Finds all dataview definitions assigned to a process by its name + * + * @param name + * @return + */ + public List findDefinitionByProcessRef(String id) { + List result = new ArrayList<>(); + if (id == null) { + return result; + } + + getDefinitions(); + for (ItemCollection def : dataViewDefinitions) { + if (id.equals(def.getItemValueString("process.ref"))) { + result.add(def); + } + } + return result; + } + /** * Returns the current workItem. If no workitem is defined the method * Instantiates a empty ItemCollection. @@ -96,17 +136,6 @@ public class DataViewDefinitionController extends AbstractDataController { + "&faces-redirect=true"; } - /** - * Set the current dataview definition. - * The method computes the attributes. - * - * @param document - the DataView definition - */ - // public void setData(ItemCollection document) { - // this.data = document; - // attributeList = computeDataViewItemDefinitions(this.data); - // } - @Override public void load(String uniqueid) { @@ -198,6 +227,9 @@ public class DataViewDefinitionController extends AbstractDataController { } data = this.getDocumentService().save(data); + // reset view + dataViewDefinitions = null; + } public String openTestView() { @@ -212,41 +244,6 @@ public class DataViewDefinitionController extends AbstractDataController { return attributeList; } - /** - * Load/Update attribute list - * - * - */ - // public void onEvent(@Observes DocumentEvent event) { - - // if (event == null || event.getDocument() == null || - // !"dataview".equals(event.getDocument().getType())) { - // return; - // } - // // update attribute list - // if (event.getEventType() == DocumentEvent.ON_DOCUMENT_SAVE) { - - // // convert the option ItemCollection elements into a List of Map - // if (attributeList != null) { - // List mapItemList = new ArrayList(); - // logger.fine("Convert option items into Map..."); - // // iterate over all items.. - // for (ItemCollection attrItem : attributeList) { - // ItemCollection ding = (ItemCollection) attrItem.clone(); - // mapItemList.add(ding.getAllItems()); - // } - // event.getDocument().replaceItemValue("dataview.items", mapItemList); - - // } - // } - - // // update attribute list - // if (event.getEventType() == DocumentEvent.ON_DOCUMENT_LOAD) { - - // } - - // } - /** * Adds a new attribute object. */ diff --git a/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewDefinitionsController.java b/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewDefinitionsController.java deleted file mode 100644 index 6a2f8b4..0000000 --- a/office-alexander-logistics-app/src/main/java/org/imixs/workflow/office/dataview/DataViewDefinitionsController.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.imixs.workflow.office.dataview; - -import org.eclipse.microprofile.config.inject.ConfigProperty; -import org.imixs.workflow.faces.data.ViewController; - -import jakarta.annotation.PostConstruct; -import jakarta.faces.view.ViewScoped; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -@ViewScoped -public class DataViewDefinitionsController extends ViewController { - - private static final long serialVersionUID = 1L; - - @Inject - @ConfigProperty(name = "admin.view.entries.max", defaultValue = "999") - transient int adminViewPageSize; - - @Override - @PostConstruct - public void init() { - super.init(); - this.setQuery("(type:\"dataview\")"); - this.setSortBy("name"); - this.setSortReverse(false); - this.setPageSize(adminViewPageSize); - this.setLoadStubs(false); - } - -} diff --git a/office-alexander-logistics-app/src/main/webapp/pages/admin/dataViewDefinitions.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/admin/dataViewDefinitions.xhtml index 9a75653..65bd31e 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/admin/dataViewDefinitions.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/admin/dataViewDefinitions.xhtml @@ -19,7 +19,7 @@
+ value="#{dataViewDefinitionController.definitions}" var="record"> #{message.name} diff --git a/office-alexander-logistics-app/src/main/webapp/pages/portlet_startprocess.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/portlet_startprocess.xhtml new file mode 100644 index 0000000..c2dc626 --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/portlet_startprocess.xhtml @@ -0,0 +1,129 @@ + + +
+
+
    +
  • + +
  • +
+
+ + + +

+ + + + + + + + + + + + + +

+

+ +

+ + + + +
    + + + + + +
  • + + + + + + + + + + +
  • +
    +
+
+ + + + + + +
    + + +
  • + + + + + + +
  • +
    +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
\ No newline at end of file