Commit 8b69b6cc authored by michael.simon's avatar michael.simon
Browse files

Upgrade Tabele for Bulk users registers

Still won't work for users that have no EPPN set.
Closes #98
parent b88b96f9
......@@ -16,6 +16,7 @@ import java.util.Map;
import org.primefaces.model.FilterMeta;
import org.primefaces.model.LazyDataModel;
import org.primefaces.model.SelectableDataModel;
import org.primefaces.model.SortOrder;
import edu.kit.scc.webreg.dao.GenericSortOrder;
......@@ -24,7 +25,7 @@ import edu.kit.scc.webreg.service.BaseService;
public class GenericLazyDataModelImpl<E extends BaseEntity<PK>, T extends BaseService<E, PK>, PK extends Serializable>
extends LazyDataModel<E>
implements GenericLazyDataModel<E, T, PK> {
implements GenericLazyDataModel<E, T, PK>, SelectableDataModel<E> {
private static final long serialVersionUID = 1L;
......@@ -73,10 +74,25 @@ public class GenericLazyDataModelImpl<E extends BaseEntity<PK>, T extends BaseSe
if (n != null)
setRowCount(n.intValue());
return returnList;
return returnList;
}
public T getService() {
return service;
}
@SuppressWarnings("unchecked")
@Override
public E getRowData(String rowKey) {
Long id = Long.parseLong(rowKey);
if (id instanceof Serializable) {
return getService().findById((PK) id);
}
return null;
}
@Override
public Object getRowKey(E object) {
return object.getId();
}
}
......@@ -40,11 +40,38 @@
</p:tab>
<p:tab id="usrListPanel" title="#{messages.users}">
<p:dataTable id="usrs" var="user" value="#{bulkRegisterBean.userList}"
rowKey="#{user.eppn}" paginator="true" rows="10" lazy="true"
paginator="true" rows="15" lazy="true"
selection="#{bulkRegisterBean.insertUser}" selectionMode="multiple">
<p:column headerText="#{messages.eppn}">#{user.eppn}</p:column>
<p:column headerText="#{messages.given_name}">#{user.givenName}</p:column>
<p:column headerText="#{messages.sur_name}">#{user.surName}</p:column>
<p:column sortBy="#{user.id}" style="width:36px;">
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{user.id}" />
</p:column>
<p:column sortBy="#{user.surName}" filterBy="#{user.surName}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="#{messages.sur_name}" />
</f:facet>
<h:outputText value="#{user.surName}" />
</p:column>
<p:column sortBy="#{user.givenName}" filterBy="#{user.givenName}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="#{messages.given_name}" />
</f:facet>
<h:outputText value="#{user.givenName}" />
</p:column>
<p:column sortBy="#{user.eppn}" filterBy="#{user.eppn}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="#{messages.eppn}" />
</f:facet>
<h:outputText value="#{user.eppn != null ? user.eppn : 'null'}" />
</p:column>
<p:column sortBy="#{user.userStatus}" style="width:50px;">
<f:facet name="header">
<h:outputText value="#{messages.status}" />
</f:facet>
<h:outputText value="#{user.userStatus}" />
</p:column>
</p:dataTable>
<p:commandButton action="#{bulkRegisterBean.insert()}" value="Auswahl in Tabelle"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment