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) {
sessionFactory.getCurrentSession().update(entity); try {
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,22 +57,40 @@
</template> </template>
</listbox> </listbox>
<groupbox mold="3d" closable="false"> <vbox>
<caption label="členové"/> <vbox children="@load(vm.workgroupRoles)">
<tree hflex="1" model="@load(vm.workgroupTreeModel)"> <template name="children">
<treecols> <grid model="@load(vm.dataBean.members)" visible="@load(each.authority ne 'ROLE_USER')">
<treecol/> <columns>
</treecols> <column label="@load(each.description)"/>
<template name="model"> </columns>
<treeitem> <rows>
<treerow> <template name="model" var="member">
<treecell image="@load(each.data.person ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(each.data.fullName)"/> <row visible="@load(member.role eq each)">
</treerow> <label value="@load(member.member.fullName)"/>
</treeitem> </row>
</template> </template>
</tree> </rows>
</groupbox> </grid>
</template>
</vbox>
<groupbox mold="3d" closable="false">
<caption label="členové"/>
<tree hflex="1" model="@load(vm.workgroupTreeModel)">
<treecols>
<treecol/>
</treecols>
<template name="model">
<treeitem>
<treerow>
<treecell image="@load(each.data.person ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(each.data.fullName)"/>
</treerow>
</treeitem>
</template>
</tree>
</groupbox>
</vbox>
</hbox> </hbox>
</window> </window>
</zk> </zk>
Loading…
Cancel
Save