dataview integration
This commit is contained in:
parent
584d59cfbe
commit
65a1d4f2b7
4 changed files with 175 additions and 81 deletions
|
|
@ -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<ItemCollection> dataViewDefinitions = null;
|
||||
|
||||
private static Logger logger = Logger.getLogger(DataViewDefinitionController.class.getName());
|
||||
|
||||
/**
|
||||
|
|
@ -70,6 +73,43 @@ public class DataViewDefinitionController extends AbstractDataController {
|
|||
|
||||
}
|
||||
|
||||
public List<ItemCollection> 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<ItemCollection> findDefinitionByProcessRef(String id) {
|
||||
List<ItemCollection> 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<Map> mapItemList = new ArrayList<Map>();
|
||||
// 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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<div class="imixs-body">
|
||||
<h:dataTable id="view_body" styleClass="imixsdatatable"
|
||||
value="#{viewHandler.getData(dataViewDefinitionsController)}" var="record">
|
||||
value="#{dataViewDefinitionController.definitions}" var="record">
|
||||
|
||||
<h:column>
|
||||
<f:facet name="header">#{message.name}</f:facet>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
|
||||
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty" xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
|
||||
|
||||
<div class="imixs-portlet startprocess">
|
||||
<div class="imixs-header">
|
||||
<ul>
|
||||
<li class="active"><span class="typcn typcn-lightbulb" style="margin-right: 8px;margin-left:0;"></span>
|
||||
<h:outputText value="#{app['portlet_process']}" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- *** all process nodes where the current user is member of, or the process is public (task=300) *** -->
|
||||
<ui:repeat value="#{teamController.processList}" var="process">
|
||||
<h:panelGroup layout="block" styleClass="imixs-viewentry"
|
||||
rendered="#{(process.item['$taskid'] eq 301 || loginController.isUserInRole('org.imixs.ACCESSLEVEL.MANAGERACCESS') or process.item['isMember'])}">
|
||||
<h1>
|
||||
<!-- board -->
|
||||
<h:link outcome="/pages/notes_board?processref=#{process.item['$uniqueId']}"
|
||||
style="margin-right:10px;"><span class="typcn typcn-th-large-outline"
|
||||
style="margin-right:8px;"></span>
|
||||
<h:outputText value="#{process.item['name']}" />
|
||||
</h:link>
|
||||
<!-- extended search -->
|
||||
<h:link outcome="/pages/workitems/worklist?processref=#{process.item['$uniqueId']}"
|
||||
title="#{message['nav.search_extended']}"><span class="typcn typcn-zoom-outline"
|
||||
style="margin-left:8px;"></span></h:link>
|
||||
<!-- archive search -->
|
||||
<h:link outcome="/pages/workitems/worklist?processref=#{process.item['$uniqueId']}&archive=true"
|
||||
title="#{message['nav.search_archive']}"><span class="typcn typcn-archive" style=""></span>
|
||||
</h:link>
|
||||
<!-- reports -->
|
||||
<h:link
|
||||
rendered="#{process.item['isManager'] or loginController.isUserInRole('org.imixs.ACCESSLEVEL.MANAGERACCESS')}"
|
||||
outcome="/pages/monitoring_board?processref=#{process.item['$uniqueId']}" title="Monitoring">
|
||||
<span class="typcn typcn-chart-pie-outline"></span>
|
||||
</h:link>
|
||||
</h1>
|
||||
<p>
|
||||
<h:outputText value="#{process.item['txtdescription']}" escape="false" />
|
||||
</p>
|
||||
|
||||
<!-- *** WorkflowGroup List if user is member*** -->
|
||||
<ui:param name="isWorkflowCreator"
|
||||
value="#{!(loginController.isUserInRole('org.imixs.ACCESSLEVEL.READERACCESS') or (loginController.isUserInRole('org.imixs.ACCESSLEVEL.NOACCESS') eq true)) }" />
|
||||
<h:panelGroup rendered="#{isWorkflowCreator and !empty process.itemList['txtWorkflowList']}">
|
||||
<ul style="margin: 5px 0;">
|
||||
<ui:repeat value="#{process.itemList['txtWorkflowList']}" var="group">
|
||||
<!-- get first task by group -->
|
||||
<ui:param name="model" value="#{modelController.getModelByGroup(group)}" />
|
||||
<ui:param name="initialTask"
|
||||
value="#{(!empty model) and (!empty model.findTasksByGroup(group))?model.findTasksByGroup(group).get(0):null}" />
|
||||
|
||||
<li>
|
||||
<h:panelGroup rendered="#{! empty initialTask}">
|
||||
<h:commandLink title=" " styleClass="action-create"
|
||||
actionListener="#{workflowController.create(model.version,initialTask.item['numprocessid'],process.item['$uniqueid'])}"
|
||||
action="/pages/workitems/workitem">
|
||||
<span class="typcn typcn-folder-add"></span>
|
||||
<h:outputText value="#{group}" />
|
||||
</h:commandLink>
|
||||
<span class="imixs-tooltip">
|
||||
<h:outputText value="#{initialTask.item['rtfdescription']}" escape="false" />
|
||||
</span>
|
||||
</h:panelGroup>
|
||||
<h:outputText style="color:red" rendered="#{empty initialTask}"
|
||||
value=" Missing Model Definition: #{group}"></h:outputText>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
</ul>
|
||||
</h:panelGroup>
|
||||
|
||||
|
||||
<!-- DataViews -->
|
||||
<ui:param name="dataViews"
|
||||
value="#{dataViewDefinitionController.findDefinitionByProcessRef(process.item['$uniqueId'])}" />
|
||||
<h:panelGroup rendered="#{!empty dataViews}">
|
||||
|
||||
<ul style="margin: 5px 0;">
|
||||
<ui:repeat value="#{dataViews}" var="dataview">
|
||||
<ui:param name="dataViewDescription" value="#{dataview.item['description']}" />
|
||||
<li>
|
||||
<h:outputLink title=""
|
||||
value="#{facesContext.externalContext.requestContextPath}/pages/dataviews/data.xhtml?id=#{dataview.item['$uniqueid']}&faces-redirect=true"
|
||||
target="dataview"><span class="typcn typcn-th-menu"
|
||||
style="font-size: 1.2rem;margin-right:10px;"></span>
|
||||
<h:outputText value="#{dataview.item['name']}" />
|
||||
</h:outputLink>
|
||||
<h:panelGroup rendered="#{!empty dataViewDescription}" styleClass="imixs-tooltip"
|
||||
style="position: relative;top: 140px;">
|
||||
<h:outputText value="#{dataViewDescription}" escape="false" />
|
||||
</h:panelGroup>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
</ul>
|
||||
</h:panelGroup>
|
||||
</h:panelGroup>
|
||||
</ui:repeat>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Administration -->
|
||||
<c:choose>
|
||||
<!-- Admin Menu -->
|
||||
<c:when test="#{loginController.isUserInRole('org.imixs.ACCESSLEVEL.MANAGERACCESS')}">
|
||||
<ui:include src="/pages/portlet_admin.xhtml" />
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<c:if
|
||||
test="#{(propertyController.getProperty('admin.manager.portlet') eq 'true') and (fn:indexOf(loginController.userNameList,'{space:manager}') gt -1) or (fn:indexOf(loginController.userNameList,'{process:manager}') gt -1)}">
|
||||
<ui:include src="/pages/portlet_manager_admin.xhtml" />
|
||||
</c:if>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</ui:composition>
|
||||
Loading…
Reference in a new issue