V agendě Střediska se zobrazují funkce (Příkazce, Správce rozpočtu...).

refs #97
multitenant
Josef Rokos 11 years ago
parent 601e3eedcb
commit dd369c5186

@ -2,6 +2,7 @@ package info.bukova.isspst.dao.jpa;
import java.util.List; import java.util.List;
import org.hibernate.NonUniqueObjectException;
import org.hibernate.Query; import org.hibernate.Query;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
@ -44,7 +45,11 @@ public abstract class BaseDaoJPA<T> implements BaseDao<T> {
@Override @Override
public void modify(T entity) { public void modify(T entity) {
try {
sessionFactory.getCurrentSession().update(entity); sessionFactory.getCurrentSession().update(entity);
} catch (NonUniqueObjectException e) {
sessionFactory.getCurrentSession().merge(entity);
}
} }
@Override @Override

@ -1,5 +1,7 @@
package info.bukova.isspst.ui.workgroups; package info.bukova.isspst.ui.workgroups;
import java.util.List;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
@ -9,8 +11,10 @@ import org.zkoss.zul.TreeModel;
import org.zkoss.zul.TreeNode; import org.zkoss.zul.TreeNode;
import info.bukova.isspst.data.Member; import info.bukova.isspst.data.Member;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.WorkgroupFilter; import info.bukova.isspst.filters.WorkgroupFilter;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.BoolConverter; import info.bukova.isspst.ui.BoolConverter;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
@ -19,6 +23,8 @@ public class WorkgroupList extends ListViewModel<Workgroup> {
@WireVariable @WireVariable
private WorkgroupService workgroupService; private WorkgroupService workgroupService;
@WireVariable
private RoleService roleService;
private WorkgroupTreeFactory treeFactory; private WorkgroupTreeFactory treeFactory;
private BoolConverter boolConverter; private BoolConverter boolConverter;
@ -40,21 +46,21 @@ public class WorkgroupList extends ListViewModel<Workgroup> {
return null; return null;
} }
@NotifyChange({"dataBean", "workgroupTreeModel", "ableToDelete"}) @NotifyChange({"dataBean", "workgroupTreeModel", "ableToDelete", "workgroupRoles"})
public void setDataBean(Workgroup data) { public void setDataBean(Workgroup data) {
super.setDataBean(data); super.setDataBean(data);
} }
@Override @Override
@GlobalCommand @GlobalCommand
@NotifyChange({ "dataList", "dataBean", "workgroupTreeModel", "ableToDelete" }) @NotifyChange({ "dataList", "dataBean", "workgroupTreeModel", "ableToDelete", "workgroupRoles" })
public void refresh() { public void refresh() {
super.refresh(); super.refresh();
} }
@Override @Override
@Command @Command
@NotifyChange({ "filter", "dataList", "dataBean", "workgroupTreeModel" }) @NotifyChange({ "filter", "dataList", "dataBean", "workgroupTreeModel", "workgroupRoles" })
public void filter() { public void filter() {
super.filter(); super.filter();
} }
@ -63,4 +69,14 @@ public class WorkgroupList extends ListViewModel<Workgroup> {
return boolConverter; return boolConverter;
} }
public List<Role> getWorkgroupRoles() {
if (getDataBean() != null && getDataBean().isCentre()) {
return roleService.getCentreRoles();
} else if (getDataBean() != null) {
return roleService.getWorkgroupRoles();
}
return null;
}
} }

@ -46,7 +46,7 @@
<tabbox mold="accordion" width="300px"> <tabbox mold="accordion" width="300px">
<tabs children="@load(vm.workgroupRoles)"> <tabs children="@load(vm.workgroupRoles)">
<template name="children"> <template name="children">
<tab label="@load(each.description)" /> <tab label="@load(each.authority eq 'ROLE_USER' ? 'Členové' : each.description)" />
</template> </template>
</tabs> </tabs>
<tabpanels children="@load(vm.workgroupRoles)"> <tabpanels children="@load(vm.workgroupRoles)">

@ -57,6 +57,24 @@
</template> </template>
</listbox> </listbox>
<vbox>
<vbox children="@load(vm.workgroupRoles)">
<template name="children">
<grid model="@load(vm.dataBean.members)" visible="@load(each.authority ne 'ROLE_USER')">
<columns>
<column label="@load(each.description)"/>
</columns>
<rows>
<template name="model" var="member">
<row visible="@load(member.role eq each)">
<label value="@load(member.member.fullName)"/>
</row>
</template>
</rows>
</grid>
</template>
</vbox>
<groupbox mold="3d" closable="false"> <groupbox mold="3d" closable="false">
<caption label="členové"/> <caption label="členové"/>
<tree hflex="1" model="@load(vm.workgroupTreeModel)"> <tree hflex="1" model="@load(vm.workgroupTreeModel)">
@ -72,7 +90,7 @@
</template> </template>
</tree> </tree>
</groupbox> </groupbox>
</vbox>
</hbox> </hbox>
</window> </window>
</zk> </zk>
Loading…
Cancel
Save