Commit 9a691347 authored by michael.simon's avatar michael.simon
Browse files

show attributesource groups in group list

parent 2f1df7f5
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.service;
import edu.kit.scc.webreg.entity.as.AttributeSourceGroupEntity;
public interface AttributeSourceGroupService extends BaseService<AttributeSourceGroupEntity, Long> {
}
......@@ -14,6 +14,7 @@ import java.util.List;
import java.util.Set;
import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.ServiceBasedGroupEntity;
import edu.kit.scc.webreg.entity.UserEntity;
public interface GroupService extends BaseService<GroupEntity, Long> {
......@@ -34,4 +35,7 @@ public interface GroupService extends BaseService<GroupEntity, Long> {
Set<GroupEntity> findByUserWithParents(UserEntity user);
ServiceBasedGroupEntity persistWithServiceFlags(
ServiceBasedGroupEntity entity);
}
......@@ -23,6 +23,4 @@ public interface HomeOrgGroupService extends BaseService<HomeOrgGroupEntity, Lon
HomeOrgGroupEntity findWithUsers(Long id);
HomeOrgGroupEntity persistWithServiceFlags(HomeOrgGroupEntity entity);
}
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.service.impl;
import javax.ejb.Stateless;
import javax.inject.Inject;
import edu.kit.scc.webreg.dao.BaseDao;
import edu.kit.scc.webreg.dao.as.AttributeSourceGroupDao;
import edu.kit.scc.webreg.entity.as.AttributeSourceGroupEntity;
import edu.kit.scc.webreg.service.AttributeSourceGroupService;
@Stateless
public class AttributeSourceGroupServiceImpl extends BaseServiceImpl<AttributeSourceGroupEntity, Long> implements AttributeSourceGroupService {
private static final long serialVersionUID = 1L;
@Inject
private AttributeSourceGroupDao dao;
@Override
protected BaseDao<AttributeSourceGroupEntity, Long> getDao() {
return dao;
}
}
......@@ -21,6 +21,7 @@ import edu.kit.scc.webreg.dao.BaseDao;
import edu.kit.scc.webreg.dao.GroupDao;
import edu.kit.scc.webreg.dao.UserDao;
import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.ServiceBasedGroupEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.service.GroupService;
import edu.kit.scc.webreg.service.reg.GroupUtil;
......@@ -91,6 +92,11 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupEntity, Long> impleme
return groupDao.findByUser(user);
}
@Override
public ServiceBasedGroupEntity persistWithServiceFlags(ServiceBasedGroupEntity entity) {
return groupDao.persistWithServiceFlags(entity);
}
@Override
public Set<GroupEntity> findByUserWithParents(UserEntity user) {
Set<GroupEntity> groups = new HashSet<GroupEntity>(groupDao.findByUser(user));
......
......@@ -16,7 +16,6 @@ import javax.ejb.Stateless;
import javax.inject.Inject;
import edu.kit.scc.webreg.dao.BaseDao;
import edu.kit.scc.webreg.dao.GroupDao;
import edu.kit.scc.webreg.dao.HomeOrgGroupDao;
import edu.kit.scc.webreg.entity.HomeOrgGroupEntity;
import edu.kit.scc.webreg.entity.UserEntity;
......@@ -30,9 +29,6 @@ public class HomeOrgGroupServiceImpl extends BaseServiceImpl<HomeOrgGroupEntity,
@Inject
private HomeOrgGroupDao dao;
@Inject
private GroupDao groupDao;
@Override
public HomeOrgGroupEntity findWithUsers(Long id) {
return dao.findWithUsers(id);
......@@ -48,11 +44,6 @@ public class HomeOrgGroupServiceImpl extends BaseServiceImpl<HomeOrgGroupEntity,
return dao.findByUser(user);
}
@Override
public HomeOrgGroupEntity persistWithServiceFlags(HomeOrgGroupEntity entity) {
return (HomeOrgGroupEntity) groupDao.persistWithServiceFlags(entity);
}
@Override
protected BaseDao<HomeOrgGroupEntity, Long> getDao() {
return dao;
......
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin.group;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject;
import edu.kit.scc.webreg.entity.ServiceGroupFlagEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.UserGroupEntity;
import edu.kit.scc.webreg.entity.as.AttributeSourceGroupEntity;
import edu.kit.scc.webreg.service.AttributeSourceGroupService;
import edu.kit.scc.webreg.service.GroupService;
import edu.kit.scc.webreg.service.ServiceGroupFlagService;
@ManagedBean
@ViewScoped
public class ShowAttributeSourceGroupBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private GroupService service;
@Inject
private AttributeSourceGroupService groupService;
@Inject
private ServiceGroupFlagService groupFlagService;
private AttributeSourceGroupEntity entity;
private List<ServiceGroupFlagEntity> groupFlagList;
private List<UserEntity> memberList;
private Long id;
public void preRenderView(ComponentSystemEvent ev) {
if (entity == null) {
entity = groupService.findByIdWithAttrs(id, "users");
groupFlagList = groupFlagService.findByGroup(entity);
memberList = new ArrayList<UserEntity>();
for (UserGroupEntity ug : entity.getUsers()) {
memberList.add(ug.getUser());
}
}
}
public void addGroupFlags() {
entity = (AttributeSourceGroupEntity) service.persistWithServiceFlags(entity);
groupFlagList = groupFlagService.findByGroup(entity);
}
public AttributeSourceGroupEntity getEntity() {
return entity;
}
public void setEntity(AttributeSourceGroupEntity entity) {
this.entity = entity;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public List<ServiceGroupFlagEntity> getGroupFlagList() {
return groupFlagList;
}
public List<UserEntity> getMemberList() {
return memberList;
}
}
......@@ -23,6 +23,7 @@ import edu.kit.scc.webreg.entity.HomeOrgGroupEntity;
import edu.kit.scc.webreg.entity.ServiceGroupFlagEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.UserGroupEntity;
import edu.kit.scc.webreg.service.GroupService;
import edu.kit.scc.webreg.service.HomeOrgGroupService;
import edu.kit.scc.webreg.service.ServiceGroupFlagService;
......@@ -32,6 +33,9 @@ public class ShowHomeOrgGroupBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private GroupService service;
@Inject
private HomeOrgGroupService groupService;
......@@ -57,7 +61,7 @@ public class ShowHomeOrgGroupBean implements Serializable {
}
public void addGroupFlags() {
entity = groupService.persistWithServiceFlags(entity);
entity = (HomeOrgGroupEntity) service.persistWithServiceFlags(entity);
groupFlagList = groupFlagService.findByGroup(entity);
}
......
......@@ -48,6 +48,9 @@
</h:link>
<h:link outcome="show-local-group.xhtml" value="#{group.name}" rendered="#{group.class.simpleName == 'LocalGroupEntity'}" >
<f:param name="id" value="#{group.id}"/>
</h:link>
<h:link outcome="show-as-group.xhtml" value="#{group.name}" rendered="#{group.class.simpleName == 'AttributeSourceGroupEntity'}" >
<f:param name="id" value="#{group.id}"/>
</h:link>
</p:column>
<p:column sortBy="#{group.gidNumber}">
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<head>
<title></title>
</head>
<body>
<f:view>
<f:metadata>
<f:viewParam name="id" value="#{showAttributeSourceGroupBean.id}"/>
<f:event type="javax.faces.event.PreRenderViewEvent"
listener="#{showAttributeSourceGroupBean.preRenderView}" />
</f:metadata>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<h2><h:outputText value="#{messages.user}: #{showAttributeSourceGroupBean.entity.name} (#{showAttributeSourceGroupBean.entity.attributeSource.name})"/></h2>
<p:messages id="messageBox" showDetail="true" />
<div class="panel">
<p:panel header="#{messages.properties}">
<p:panelGrid id="baseData" columns="2">
<h:outputText value="#{messages.id}:"/>
<h:outputText value="#{showAttributeSourceGroupBean.entity.id}"/>
<h:outputText value="#{messages.name}:"/>
<h:outputText value="#{showAttributeSourceGroupBean.entity.name}"/>
<h:outputText value="#{messages.gid_number}:"/>
<h:outputText value="#{showAttributeSourceGroupBean.entity.gidNumber}"/>
<h:outputText value="#{messages.attribute_source}:"/>
<h:outputText value="#{showAttributeSourceGroupBean.entity.attributeSource.name}"/>
<h:outputText value="#{messages.status}:"/>
<h:outputText value="#{showAttributeSourceGroupBean.entity.groupStatus}"/>
</p:panelGrid>
</p:panel>
</div>
<div class="panel">
<p:panel id="groupFlagPanel" header="#{messages.services}">
<p:dataTable id="flagData" style="min-width: 500px;"
value="#{showAttributeSourceGroupBean.groupFlagList}" var="flags">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{flags.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.service}" />
</f:facet>
<h:outputText value="#{flags.service.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.status}" />
</f:facet>
<h:outputText value="#{flags.status}" />
</p:column>
</p:dataTable>
<p:commandButton id="addGF" action="#{showAttributeSourceGroupBean.addGroupFlags()}" value="#{messages.add_group_flags}"
update="@form"/>
</p:panel>
</div>
<div class="panel">
<p:panel id="attrPanel" header="#{messages.members}">
<p:dataTable id="allUsersTable" var="user" value="#{showAttributeSourceGroupBean.memberList}" paginator="true"
lazy="true" rows="15">
<p:column sortBy="#{user.id}">
<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}">
<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}">
<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}">
<f:facet name="header">
<h:outputText value="#{messages.eppn}" />
</f:facet>
<h:link outcome="/admin/user/show-user.xhtml" value="#{user.eppn}">
<f:param name="id" value="#{user.id}"/>
</h:link>
</p:column>
<p:column sortBy="#{user.userStatus}">
<f:facet name="header">
<h:outputText value="#{messages.status}" />
</f:facet>
<h:outputText value="#{user.userStatus}" />
</p:column>
</p:dataTable>
</p:panel>
</div>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
\ No newline at end of file
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