This commit is contained in:
Ralph Soika 2025-05-12 16:16:11 +02:00
parent 6cfea74397
commit 584d59cfbe
5 changed files with 45 additions and 21 deletions

View file

@ -72,7 +72,6 @@ import jakarta.servlet.http.HttpServletRequest;
* @version 1.0
*/
@Named
// @SessionScoped
@ConversationScoped
public class DataViewController extends ViewController {

View file

@ -164,6 +164,14 @@ public class DataViewDefinitionController extends AbstractDataController {
return result;
}
/**
* creates an empty new dataview definition
*/
public void create() {
data = new ItemCollection();
data.setType("dataview");
}
/**
* This method saves the current document.
*
@ -171,21 +179,23 @@ public class DataViewDefinitionController extends AbstractDataController {
*/
public void save() throws AccessDeniedException {
// save definition ...
data.setType("dataview");
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext externalContext = context
.getExternalContext();
String sUser = externalContext.getRemoteUser();
data.replaceItemValue("$editor", sUser);
List<Map> mapItemList = new ArrayList<Map>();
logger.fine("Convert attribute items into Map...");
// implode attributes
for (ItemCollection attrItem : attributeList) {
ItemCollection ding = (ItemCollection) attrItem.clone();
mapItemList.add(ding.getAllItems());
if (attributeList != null) {
List<Map> mapItemList = new ArrayList<Map>();
logger.fine("Convert attribute items into Map...");
for (ItemCollection attrItem : attributeList) {
ItemCollection ding = (ItemCollection) attrItem.clone();
mapItemList.add(ding.getAllItems());
}
data.replaceItemValue("dataview.items", mapItemList);
}
data.replaceItemValue("dataview.items", mapItemList);
data = this.getDocumentService().save(data);
}
@ -196,6 +206,9 @@ public class DataViewDefinitionController extends AbstractDataController {
}
public List<ItemCollection> getAttributeList() {
if (attributeList == null) {
attributeList = new ArrayList<>();
}
return attributeList;
}

View file

@ -23,7 +23,7 @@ public class DataViewDefinitionsController extends ViewController {
public void init() {
super.init();
this.setQuery("(type:\"dataview\")");
this.setSortBy("txtname");
this.setSortBy("name");
this.setSortReverse(false);
this.setPageSize(adminViewPageSize);
this.setLoadStubs(false);

View file

@ -64,6 +64,22 @@
value="#{dataViewDefinitionController.data.item['Name']}" />
</dd>
</dl>
<dl>
<dt>
Process:
</dt>
<dd>
<h:selectOneMenu
value="#{dataViewDefinitionController.data.item['process.ref']}">
<f:selectItem itemLabel=""></f:selectItem>
<c:forEach items="#{teamController.processList}" var="process">
<f:selectItem itemLabel="#{process.item['name']}"
itemValue="#{process.item['$UniqueID']}">
</f:selectItem>
</c:forEach>
</h:selectOneMenu>
</dd>
</dl>
</div>
<div class="imixs-form-section">
<dl>
@ -81,7 +97,7 @@
</dt>
<dd>
<h:inputTextarea
<h:inputTextarea required="true"
value="#{dataViewDefinitionController.data.item['query']}"
style="height: 14em; font-family: 'Courier New', Courier, monospace; autocomplete: off;" />
</dd>
@ -93,7 +109,7 @@
Sort By:
</dt>
<dd>
<h:inputText required="true"
<h:inputText required="false"
value="#{dataViewDefinitionController.data.item['sort.by']}" />
</dd>
</dl>

View file

@ -32,6 +32,11 @@
</h:column>
<h:column>
<f:facet name="header">Process</f:facet>
#{teamController.getProcessById(record.item['process.ref']).getItemValueString('name')}
</h:column>
<h:column>
<f:facet name="header">Description</f:facet>
<pre>#{record.item['description']}</pre>
@ -76,19 +81,10 @@
<h:messages styleClass="messages" id="errorMessages" layout="table" />
</p>
</c:if>
<div style="clear: left;" />
<h:commandButton value="#{message.add}" action="/pages/admin/dataViewDefinition"
actionListener="#{documentController.create}">
<f:setPropertyActionListener target="#{documentController.document.item['type']}"
value="dataview" />
actionListener="#{dataViewDefinitionController.create}">
</h:commandButton>
<h:commandButton action="home" value="#{message.close}">
</h:commandButton>
</div>