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 * @version 1.0
*/ */
@Named @Named
// @SessionScoped
@ConversationScoped @ConversationScoped
public class DataViewController extends ViewController { public class DataViewController extends ViewController {

View file

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

View file

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

View file

@ -64,6 +64,22 @@
value="#{dataViewDefinitionController.data.item['Name']}" /> value="#{dataViewDefinitionController.data.item['Name']}" />
</dd> </dd>
</dl> </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>
<div class="imixs-form-section"> <div class="imixs-form-section">
<dl> <dl>
@ -81,7 +97,7 @@
</dt> </dt>
<dd> <dd>
<h:inputTextarea <h:inputTextarea required="true"
value="#{dataViewDefinitionController.data.item['query']}" value="#{dataViewDefinitionController.data.item['query']}"
style="height: 14em; font-family: 'Courier New', Courier, monospace; autocomplete: off;" /> style="height: 14em; font-family: 'Courier New', Courier, monospace; autocomplete: off;" />
</dd> </dd>
@ -93,7 +109,7 @@
Sort By: Sort By:
</dt> </dt>
<dd> <dd>
<h:inputText required="true" <h:inputText required="false"
value="#{dataViewDefinitionController.data.item['sort.by']}" /> value="#{dataViewDefinitionController.data.item['sort.by']}" />
</dd> </dd>
</dl> </dl>

View file

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