Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
fd3332da
Commit
fd3332da
authored
Jul 21, 2015
by
michael.simon
Browse files
make groups deletable for group admin
parent
8293b410
Changes
3
Hide whitespace changes
Inline
Side-by-side
bwreg-jpa/src/main/java/edu/kit/scc/webreg/dao/jpa/JpaServiceGroupFlagDao.java
View file @
fd3332da
...
...
@@ -19,6 +19,7 @@ import javax.persistence.criteria.CriteriaQuery;
import
javax.persistence.criteria.Root
;
import
edu.kit.scc.webreg.dao.ServiceGroupFlagDao
;
import
edu.kit.scc.webreg.entity.GroupStatus
;
import
edu.kit.scc.webreg.entity.ServiceBasedGroupEntity
;
import
edu.kit.scc.webreg.entity.ServiceEntity
;
import
edu.kit.scc.webreg.entity.ServiceGroupFlagEntity
;
...
...
@@ -63,8 +64,10 @@ public class JpaServiceGroupFlagDao extends JpaBaseDao<ServiceGroupFlagEntity, L
public
List
<
ServiceGroupFlagEntity
>
findLocalGroupsForService
(
ServiceEntity
service
)
{
return
em
.
createQuery
(
"select gf from ServiceGroupFlagEntity gf, LocalGroupEntity g "
+
"where gf.group = g"
+
" and gf.service = :service"
)
.
setParameter
(
"service"
,
service
).
getResultList
();
+
" and gf.service = :service and (g.groupStatus = :groupStatus or g.groupStatus is null)"
)
.
setParameter
(
"service"
,
service
)
.
setParameter
(
"groupStatus"
,
GroupStatus
.
ACTIVE
)
.
getResultList
();
}
@Override
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/bean/admin/group/GroupAdminShowLocalGroupBean.java
View file @
fd3332da
...
...
@@ -24,6 +24,7 @@ import org.slf4j.Logger;
import
edu.kit.scc.webreg.entity.EventType
;
import
edu.kit.scc.webreg.entity.GroupEntity
;
import
edu.kit.scc.webreg.entity.GroupStatus
;
import
edu.kit.scc.webreg.entity.LocalGroupEntity
;
import
edu.kit.scc.webreg.entity.ServiceEntity
;
import
edu.kit.scc.webreg.entity.ServiceGroupFlagEntity
;
...
...
@@ -128,14 +129,7 @@ public class GroupAdminShowLocalGroupBean implements Serializable {
flag
=
groupFlagService
.
save
(
flag
);
}
HashSet
<
GroupEntity
>
gl
=
new
HashSet
<
GroupEntity
>();
gl
.
add
(
entity
);
MultipleGroupEvent
mge
=
new
MultipleGroupEvent
(
gl
);
try
{
eventSubmitter
.
submit
(
mge
,
EventType
.
GROUP_UPDATE
,
"user-"
+
sessionManager
.
getUserId
());
}
catch
(
EventSubmitException
e
)
{
logger
.
warn
(
"Exeption"
,
e
);
}
fireGroupChangeEvent
();
messageGenerator
.
addResolvedInfoMessage
(
"item_saved"
,
"item_saved_long"
,
true
);
...
...
@@ -146,6 +140,36 @@ public class GroupAdminShowLocalGroupBean implements Serializable {
return
ViewIds
.
GROUP_ADMIN_EDIT_LOCAL_GROUP
+
"?faces-redirect=true&serviceId="
+
serviceId
+
"&groupId="
+
groupId
;
}
public
String
deleteGroup
()
{
if
(
editable
==
false
)
{
return
""
;
}
entity
.
setGroupStatus
(
GroupStatus
.
DELETED
);
for
(
ServiceGroupFlagEntity
flag
:
groupFlagList
)
{
flag
.
setStatus
(
ServiceGroupStatus
.
TO_DELETE
);
groupFlagService
.
save
(
flag
);
}
entity
=
service
.
save
(
entity
);
fireGroupChangeEvent
();
return
ViewIds
.
GROUP_ADMIN_INDEX
+
"?faces-redirect=true&serviceId="
+
serviceId
;
}
public
void
fireGroupChangeEvent
()
{
HashSet
<
GroupEntity
>
gl
=
new
HashSet
<
GroupEntity
>();
gl
.
add
(
entity
);
MultipleGroupEvent
mge
=
new
MultipleGroupEvent
(
gl
);
try
{
eventSubmitter
.
submit
(
mge
,
EventType
.
GROUP_UPDATE
,
"user-"
+
sessionManager
.
getUserId
());
}
catch
(
EventSubmitException
e
)
{
logger
.
warn
(
"Exeption"
,
e
);
}
}
public
LocalGroupEntity
getEntity
()
{
return
entity
;
}
...
...
bwreg-webapp/src/main/webapp/service-group-admin/show-local-group.xhtml
View file @
fd3332da
...
...
@@ -40,6 +40,9 @@
<h:outputText
value=
"#{messages.gid_number}:"
/>
<h:outputText
value=
"#{groupAdminShowLocalGroupBean.entity.gidNumber}"
/>
<h:outputText
value=
"#{messages.status}:"
/>
<h:outputText
value=
"#{groupAdminShowLocalGroupBean.entity.groupStatus}"
/>
<h:outputText
value=
"#{messages.services}:"
/>
<p:dataList
var=
"flag"
value=
"#{groupAdminShowLocalGroupBean.groupFlagList}"
>
<h:outputText
value=
"#{flag.service.name}"
/>
...
...
@@ -88,6 +91,14 @@
</p:panel>
</div>
<br/>
<div
id=
"panelInline"
>
<p:panel
header=
"#{messages.tools}"
>
<p:commandButton
id=
"delGrp"
action=
"#{groupAdminShowLocalGroupBean.deleteGroup()}"
value=
"#{messages.delete_group}"
style=
"color: red;"
ajax=
"false"
disabled=
"#{not groupAdminShowLocalGroupBean.editable}"
/>
</p:panel>
</div>
</h:form>
</ui:define>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment