reporting feature
This commit is contained in:
parent
d47518224f
commit
c1f123215a
5 changed files with 569 additions and 0 deletions
|
|
@ -0,0 +1,144 @@
|
|||
/*******************************************************************************
|
||||
* Imixs Workflow Technology
|
||||
* Copyright (C) 2003, 2008 Imixs Software Solutions GmbH,
|
||||
* http://www.imixs.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You can receive a copy of the GNU General Public
|
||||
* License at http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Contributors:
|
||||
* Imixs Software Solutions GmbH - initial API and implementation
|
||||
* Ralph Soika
|
||||
*
|
||||
*******************************************************************************/
|
||||
package org.imixs.workflow.office.reporting;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.imixs.workflow.ItemCollection;
|
||||
import org.imixs.workflow.engine.DocumentEvent;
|
||||
import org.imixs.workflow.engine.DocumentService;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.ejb.EJB;
|
||||
import jakarta.enterprise.context.SessionScoped;
|
||||
import jakarta.enterprise.event.Observes;
|
||||
import jakarta.inject.Named;
|
||||
|
||||
/**
|
||||
* The ReportingConfigController is used to configure a reporting definition
|
||||
*
|
||||
* @author rsoika
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@Named
|
||||
@SessionScoped
|
||||
public class ReportingController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected List<ItemCollection> attributeList = null;
|
||||
|
||||
@EJB
|
||||
DocumentService documentService;
|
||||
|
||||
private static Logger logger = Logger.getLogger(ReportingController.class.getName());
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
public void setAttributeList(List<ItemCollection> attributeList) {
|
||||
this.attributeList = attributeList;
|
||||
}
|
||||
|
||||
public List<ItemCollection> getAttributeList() {
|
||||
return attributeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load/Update attribute list
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void onEvent(@Observes DocumentEvent event) {
|
||||
|
||||
if (event == null || event.getDocument() == null || !"reporting".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) {
|
||||
mapItemList.add(attrItem.getAllItems());
|
||||
}
|
||||
event.getDocument().replaceItemValue("attributes", mapItemList);
|
||||
}
|
||||
}
|
||||
|
||||
// update attribute list
|
||||
if (event.getEventType() == DocumentEvent.ON_DOCUMENT_LOAD) {
|
||||
attributeList = new ArrayList<ItemCollection>();
|
||||
List<Object> mapItems = event.getDocument().getItemValue("attributes");
|
||||
for (Object mapOderItem : mapItems) {
|
||||
if (mapOderItem instanceof Map) {
|
||||
ItemCollection itemCol = new ItemCollection((Map) mapOderItem);
|
||||
attributeList.add(itemCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new attribute object.
|
||||
*/
|
||||
public void addAttribute() {
|
||||
if (attributeList == null) {
|
||||
attributeList = new ArrayList<ItemCollection>();
|
||||
}
|
||||
ItemCollection source = new ItemCollection();
|
||||
attributeList.add(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an attribute item from the list
|
||||
*
|
||||
* @param name - name of attribute
|
||||
*/
|
||||
public void removeAttribute(String name) {
|
||||
if (name != null && attributeList != null) {
|
||||
for (ItemCollection dbtr : attributeList) {
|
||||
if (name.equals(dbtr.getItemValueString("name"))) {
|
||||
attributeList.remove(dbtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package org.imixs.workflow.office.views;
|
||||
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.imixs.workflow.faces.data.ViewController;
|
||||
import org.imixs.workflow.faces.util.LoginController;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.faces.view.ViewScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
|
||||
@Named
|
||||
@ViewScoped
|
||||
public class ReportingViewController extends ViewController {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Inject
|
||||
LoginController loginController;
|
||||
|
||||
@Inject
|
||||
@ConfigProperty(name = "admin.view.entries.max", defaultValue = "999")
|
||||
transient int adminViewPageSize;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init();
|
||||
this.setQuery("(type:\"reporting\")");
|
||||
this.setSortBy("txtname");
|
||||
this.setSortReverse(false);
|
||||
this.setPageSize(adminViewPageSize);
|
||||
this.setLoadStubs(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,6 +14,10 @@
|
|||
<li>
|
||||
<h:link outcome="/pages/admin/analyse_invoicing">Analyse Rechnungseingang</h:link>
|
||||
</li>
|
||||
<li>
|
||||
<h:link outcome="/pages/admin/reportingDefinitions">Reportings</h:link>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<h:link outcome="/pages/admin/excel_export_rechnungsausgang">Excel Export Rechnungsausgang</h:link>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,284 @@
|
|||
<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"
|
||||
template="/layout/template.xhtml">
|
||||
|
||||
|
||||
|
||||
<f:metadata>
|
||||
<f:viewAction action="#{documentController.onLoad()}" />
|
||||
</f:metadata>
|
||||
|
||||
<ui:define name="content">
|
||||
|
||||
<f:view>
|
||||
<h:form id="textblock_form_id" pt:autocomplete="on" enctype="multipart/form-data">
|
||||
|
||||
<div class="imixs-form">
|
||||
<div class="imixs-header">
|
||||
<h1>
|
||||
<h:outputText value="View Definition: " />
|
||||
<h:outputText value="#{documentController.document.item['name']} " />
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="imixs-body">
|
||||
<div class="imixs-tabs">
|
||||
<ul>
|
||||
<li><a href="#tab-1">Query</a></li>
|
||||
<li><a href="#tab-2">Form</a></li>
|
||||
<li><a href="#tab-3">Excel</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div id="tab-1">
|
||||
|
||||
|
||||
|
||||
<div class="imixs-form-panel">
|
||||
|
||||
<div class="imixs-form-section-2">
|
||||
<h1>Query Definition</h1>
|
||||
<p>
|
||||
A Query Defintion defines a custom data list based on the
|
||||
<a href="https://www.imixs.org/doc/engine/queries.html"
|
||||
target="_blank">Lucene Search Query syntax</a>.
|
||||
</p>
|
||||
<dl>
|
||||
<dt>
|
||||
Name:<span class="imixs-required"> *
|
||||
|
||||
</span>
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
<h:inputText required="true" id="txtname_id"
|
||||
value="#{documentController.document.item['Name']}" />
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="imixs-form-section">
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Description:
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
<h:inputTextarea
|
||||
value="#{documentController.document.item['description']}" />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>
|
||||
Query:<span class="imixs-required"> *</span>
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
<h:inputTextarea value="#{documentController.document.item['query']}"
|
||||
style="height: 14em;" />
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h:panelGroup layout="block" styleClass="imixs-form-section" id="attributelist"
|
||||
binding="#{attributelistContainer}">
|
||||
<h1>Attributes </h1>
|
||||
<p>
|
||||
<span class="typcn typcn-lightbulb"></span>
|
||||
Optional attribute definition for the report result. A attributes reduces
|
||||
the size of a report result and can adapt single item values. Each item of
|
||||
the attribute list can define an optional label, converter, format and
|
||||
aggregator.
|
||||
|
||||
</p>
|
||||
<f:ajax render="attributelist" onevent="updateSepaList">
|
||||
<table class="imixsdatatable imixs-orderitems">
|
||||
<tr>
|
||||
<th style="width: 140px">ID</th>
|
||||
<th style="">Bank<span class="imixs-required">
|
||||
*</span></th>
|
||||
<th style="width: 250px;">IBAN</th>
|
||||
<th style="width: 150px;">BIC</th>
|
||||
<th style="width: 150px;">Report (optional)</th>
|
||||
<th style="width: 50px">
|
||||
<!-- delete -->
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<ui:repeat var="attribute" value="#{reportingController.attributeList}">
|
||||
<tr>
|
||||
<!-- ID -->
|
||||
<td>
|
||||
<h:inputText value="#{attribute.item['name']}"
|
||||
style="width:100%;" />
|
||||
</td>
|
||||
|
||||
<!-- attribute.name -->
|
||||
<td>
|
||||
<h:inputText value="#{attribute.item['attribute.name']}"
|
||||
style="width:100%;" />
|
||||
</td>
|
||||
|
||||
<!-- attribute.iban -->
|
||||
<td>
|
||||
<h:inputText value="#{attribute.item['attribute.iban']}"
|
||||
style="width:100%;" />
|
||||
</td>
|
||||
|
||||
<!-- attribute.bic -->
|
||||
<td>
|
||||
<h:inputText value="#{attribute.item['attribute.bic']}"
|
||||
style="width:100%;" />
|
||||
</td>
|
||||
<!-- attribute.bic -->
|
||||
<td>
|
||||
<h:inputText value="#{attribute.item['report']}"
|
||||
style="width:100%;" />
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<h:commandLink
|
||||
actionListener="#{reportingController.removeattribute(attribute.item['name'])}">
|
||||
<span class="typcn typcn-trash imixs-state-info"></span>
|
||||
<f:ajax render="#{attributelistContainer.clientId}"
|
||||
onevent="updateSepaList" />
|
||||
</h:commandLink>
|
||||
</td>
|
||||
</tr>
|
||||
</ui:repeat>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<!-- add button -->
|
||||
<h:commandButton value="#{message.add}" pt:data-id="addposbutton_id"
|
||||
actionListener="#{reportingController.addAttribute}">
|
||||
</h:commandButton>
|
||||
</f:ajax>
|
||||
</h:panelGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="tab-2">
|
||||
|
||||
<div class="imixs-form-panel">
|
||||
<h1>Form Definition</h1>
|
||||
<p>
|
||||
The Form Definition defines query and filter parameters.
|
||||
</p>
|
||||
<div class="imixs-form-section-1">
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Form:<span class="imixs-required"> *
|
||||
<h:message for="_subject" />
|
||||
</span>
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
<h:inputTextarea value="#{documentController.document.item['form']}"
|
||||
style="height: 27em;" />
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="tab-3">
|
||||
|
||||
|
||||
|
||||
<div class="imixs-form-panel">
|
||||
|
||||
<div class="imixs-form-section-1">
|
||||
|
||||
<h1>Template</h1>
|
||||
<dl>
|
||||
<dt>#{message['form.minutes.description']}:</dt>
|
||||
<dd>
|
||||
|
||||
<h:panelGroup styleClass="textblock-html-input" id="text_input">
|
||||
<h:inputTextarea class="imixs-editor-basic"
|
||||
rendered="#{documentController.document.item['txtmode'] eq 'HTML'}"
|
||||
value="#{documentController.document.item['txtcontent']}" />
|
||||
</h:panelGroup>
|
||||
|
||||
<h:panelGroup styleClass="textblock-text-input" id="html_input">
|
||||
<h:inputTextarea
|
||||
rendered="#{documentController.document.item['txtmode'] ne 'HTML'}"
|
||||
value="#{documentController.document.item['txtcontent']}" />
|
||||
</h:panelGroup>
|
||||
|
||||
<div class="textblock-file-input" style="width: 50%;">
|
||||
<i:imixsFileUpload showattachments="true"
|
||||
workitem="#{documentController.document}"
|
||||
context_url="#{facesContext.externalContext.requestContextPath}/api/snapshot/#{documentController.document.item['$uniqueid']}" />
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="imixs-footer">
|
||||
<h:commandButton action="/pages/admin/reportingDefinitions?faces-redirect=true"
|
||||
actionListener="#{documentController.save()}" value="#{message.save}" />
|
||||
|
||||
<h:commandButton value="Open View"
|
||||
action="/pages/admin/reportingDefinitions?faces-redirect=true"
|
||||
actionListener="#{documentController.close()}" />
|
||||
|
||||
<h:commandButton value="#{message.close}" immediate="true"
|
||||
action="/pages/admin/reportingDefinitions?faces-redirect=true"
|
||||
actionListener="#{documentController.close()}" />
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</h:form>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Init script -->
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
||||
</f:view>
|
||||
</ui:define>
|
||||
|
||||
|
||||
|
||||
</ui:composition>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
<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"
|
||||
template="/layout/template.xhtml">
|
||||
|
||||
|
||||
<ui:define name="content">
|
||||
|
||||
<f:view>
|
||||
<h:form>
|
||||
<div class="imixs-view">
|
||||
<!-- *** Header **** -->
|
||||
<div class="imixs-header">
|
||||
<h1>
|
||||
<h:outputText value="#{message['report.view']}" />
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="imixs-body">
|
||||
<h:dataTable id="view_body" styleClass="imixsdatatable"
|
||||
value="#{viewHandler.getData(reportingViewController)}" var="record">
|
||||
|
||||
<h:column>
|
||||
<f:facet name="header">#{message.name}</f:facet>
|
||||
<h:link outcome="/pages/admin/reportingDefinition?faces-redirect=true"
|
||||
styleClass="imixs-viewentry-main-link">
|
||||
<h:outputText value="#{record.item['Name']}" />
|
||||
<h:outputText rendered="#{empty record.item['Name']}" value=" - no name - " />
|
||||
<f:param name="id" value="#{record.item['$uniqueid']}" />
|
||||
</h:link>
|
||||
</h:column>
|
||||
|
||||
|
||||
|
||||
<h:column>
|
||||
<f:facet name="header">#{message.modified}</f:facet>
|
||||
<h:outputText value="#{record.item['$modified']}">
|
||||
<f:convertDateTime timeZone="#{message.timeZone}" type="both"
|
||||
pattern="#{message.dateTimePattern}" />
|
||||
</h:outputText>
|
||||
|
||||
</h:column>
|
||||
|
||||
<h:column>
|
||||
<f:facet name="header">#{message.action}</f:facet>
|
||||
|
||||
|
||||
<!-- Edit -->
|
||||
<h:link outcome="/pages/admin/reportingDefinition?faces-redirect=true"
|
||||
styleClass="imixs-viewentry-main-link">
|
||||
<span class="typcn typcn-pencil imixs-state-info"></span>#{message.open}
|
||||
<f:param name="id" value="#{record.item['$uniqueid']}" />
|
||||
</h:link>
|
||||
|
||||
|
||||
<!-- Delete -->
|
||||
<h:commandLink title="#{message.delete}"
|
||||
rendered="#{loginController.isUserInRole('org.imixs.ACCESSLEVEL.MANAGERACCESS')}"
|
||||
action="/pages/admin/reportingDefinitions?faces-redirect=true"
|
||||
actionListener="#{documentController.delete(record.item['$UniqueID'])}"
|
||||
onclick="if (!confirm('#{message.help_delete}')) return false;">
|
||||
<span class="typcn typcn-trash imixs-state-error"></span>#{message.delete}
|
||||
</h:commandLink>
|
||||
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="imixs-footer">
|
||||
|
||||
<!-- Error Messages -->
|
||||
<c:if test="#{! empty facesContext.maximumSeverity}">
|
||||
<p>
|
||||
<h:messages styleClass="messages" id="errorMessages" layout="table" />
|
||||
</p>
|
||||
</c:if>
|
||||
|
||||
|
||||
|
||||
<div style="clear: left;" />
|
||||
<h:commandButton value="#{message.add}" action="/pages/admin/reportingDefinition"
|
||||
actionListener="#{documentController.create}">
|
||||
<f:setPropertyActionListener target="#{documentController.document.item['type']}"
|
||||
value="reporting" />
|
||||
|
||||
</h:commandButton>
|
||||
|
||||
|
||||
|
||||
<h:commandButton action="home" value="#{message.close}">
|
||||
</h:commandButton>
|
||||
</div>
|
||||
</div>
|
||||
</h:form>
|
||||
</f:view>
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
Loading…
Reference in a new issue