Merge branch 'master' of https://git.bukova.info/repos/git/isspst
Conflicts: src/main/webapp/app/navigation.zulmultitenant
commit
6dcc93ee83
@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao;
|
||||
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
|
||||
public interface WorkgroupDao extends BaseDao<Workgroup> {
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package info.bukova.isspst.dao.jpa;
|
||||
|
||||
import info.bukova.isspst.dao.WorkgroupDao;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
|
||||
public class WorkgroupDaoJPA extends BaseDaoJPA<Workgroup> implements WorkgroupDao {
|
||||
|
||||
@Override
|
||||
public String getEntityName() {
|
||||
return Workgroup.class.getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "JOBMAPPING")
|
||||
public class JobMapping {
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
@GeneratedValue
|
||||
private int id;
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinTable(name = "JOB_MEMBER", joinColumns = { @JoinColumn(name = "JOB_ID") }, inverseJoinColumns = { @JoinColumn(name = "MEMBER_ID") })
|
||||
private Member member;
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinTable(name = "JOB_ROLE", joinColumns = { @JoinColumn(name = "JOB_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
|
||||
private Role role;
|
||||
|
||||
public JobMapping() {
|
||||
|
||||
}
|
||||
|
||||
public JobMapping(Member member, Role role) {
|
||||
this.member = member;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Member getMember() {
|
||||
return member;
|
||||
}
|
||||
|
||||
public void setMember(Member member) {
|
||||
this.member = member;
|
||||
}
|
||||
|
||||
public Role getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Role role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof JobMapping
|
||||
&& ((JobMapping)o).getMember().equals(this.getMember())
|
||||
&& ((JobMapping)o).getRole().equals(this.getRole())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||
public abstract class Member implements DataModel {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
||||
private int id;
|
||||
@Column(name = "CREATED")
|
||||
private Date created;
|
||||
@Column(name = "MODIFIED")
|
||||
private Date modified;
|
||||
@Transient
|
||||
private boolean valid;
|
||||
|
||||
public abstract String getFullName();
|
||||
public abstract boolean isHasJob();
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return valid;
|
||||
}
|
||||
|
||||
public void setValid(boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
public enum PermissionType {
|
||||
|
||||
GLOBAL,
|
||||
WORKGROUP,
|
||||
CENTRE
|
||||
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.LazyCollection;
|
||||
import org.hibernate.annotations.LazyCollectionOption;
|
||||
|
||||
@Entity
|
||||
@Table(name = "WORKGROUP")
|
||||
public class Workgroup extends Member implements OwnedDataModel {
|
||||
|
||||
@Column(name = "CODE")
|
||||
private String code;
|
||||
@Column(name = "NAME")
|
||||
private String name;
|
||||
@ManyToMany(cascade = {CascadeType.ALL})
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
@JoinTable(name="WORKGROUP_MEMBER", joinColumns={@JoinColumn(name="WORKGROUP_ID")}, inverseJoinColumns={@JoinColumn(name="JOBMAPPING_ID")})
|
||||
private List<JobMapping> members;
|
||||
@Column(name = "CENTRE")
|
||||
private boolean centre;
|
||||
//BaseData
|
||||
@ManyToOne(fetch=FetchType.EAGER)
|
||||
@JoinColumn(name="OWNED_BY_ID")
|
||||
private User ownedBy;
|
||||
@ManyToOne(fetch=FetchType.EAGER)
|
||||
@JoinColumn(name="MODIFIED_BY_ID")
|
||||
private User modifiedBy;
|
||||
|
||||
|
||||
public Workgroup() {
|
||||
members = new ArrayList<JobMapping>();
|
||||
centre = false;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isCentre() {
|
||||
return centre;
|
||||
}
|
||||
|
||||
public void setCentre(boolean centre) {
|
||||
this.centre = centre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwnedBy(User user) {
|
||||
this.ownedBy = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getOwnedBy() {
|
||||
return ownedBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModifiedBy(User user) {
|
||||
this.modifiedBy = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getModifiedBy() {
|
||||
return modifiedBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHasJob() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<JobMapping> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
public void setMembers(List<JobMapping> members) {
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
public void removeMember(JobMapping mapping) {
|
||||
members.remove(mapping);
|
||||
}
|
||||
|
||||
public void removeMember(Member member, Role role) {
|
||||
JobMapping mapping = new JobMapping(member, role);
|
||||
members.remove(mapping);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof Workgroup && ((Workgroup)o).getId() == this.getId()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -1,60 +1,60 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.not0ToStr;
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Address;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class AddressFilter implements Filter<Address> {
|
||||
|
||||
private Address condAddr;
|
||||
|
||||
public AddressFilter(Address condAddr) {
|
||||
this.condAddr = condAddr;
|
||||
}
|
||||
|
||||
private static class AddrMatcher extends TypeSafeMatcher<Address> {
|
||||
|
||||
private Address condAddress;
|
||||
|
||||
public AddrMatcher(Address cond) {
|
||||
this.condAddress = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("address matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Address item) {
|
||||
return nullStr(item.getCompany()).toLowerCase().contains(nullStr(condAddress.getCompany()).toLowerCase())
|
||||
&& nullStr(item.getCity()).toLowerCase().contains(nullStr(condAddress.getCity()).toLowerCase())
|
||||
&& nullStr(item.getContactName()).toLowerCase().contains(nullStr(condAddress.getContactName()).toLowerCase())
|
||||
&& nullStr(item.getStreet()).toLowerCase().contains(nullStr(condAddress.getStreet()).toLowerCase())
|
||||
&& not0ToStr(item.getIc()).startsWith(not0ToStr(condAddress.getIc()))
|
||||
&& nullStr(item.getHouseNumber()).startsWith(nullStr(condAddress.getHouseNumber()));
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Address> matchAddr(Address addr) {
|
||||
return new AddrMatcher(addr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddrMatcher matcher() {
|
||||
return new AddrMatcher(condAddr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.not0ToStr;
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Address;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class AddressFilter implements Filter<Address> {
|
||||
|
||||
private Address condAddr;
|
||||
|
||||
public AddressFilter(Address condAddr) {
|
||||
this.condAddr = condAddr;
|
||||
}
|
||||
|
||||
private static class AddrMatcher extends TypeSafeMatcher<Address> {
|
||||
|
||||
private Address condAddress;
|
||||
|
||||
public AddrMatcher(Address cond) {
|
||||
this.condAddress = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("address matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Address item) {
|
||||
return nullStr(item.getCompany()).toLowerCase().contains(nullStr(condAddress.getCompany()).toLowerCase())
|
||||
&& nullStr(item.getCity()).toLowerCase().contains(nullStr(condAddress.getCity()).toLowerCase())
|
||||
&& nullStr(item.getContactName()).toLowerCase().contains(nullStr(condAddress.getContactName()).toLowerCase())
|
||||
&& nullStr(item.getStreet()).toLowerCase().contains(nullStr(condAddress.getStreet()).toLowerCase())
|
||||
&& not0ToStr(item.getIc()).startsWith(not0ToStr(condAddress.getIc()))
|
||||
&& nullStr(item.getHouseNumber()).startsWith(nullStr(condAddress.getHouseNumber()));
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Address> matchAddr(Address addr) {
|
||||
return new AddrMatcher(addr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddrMatcher matcher() {
|
||||
return new AddrMatcher(condAddr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Building;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class BuildingFilter implements Filter<Building> {
|
||||
|
||||
private Building condBuilding;
|
||||
|
||||
public BuildingFilter(Building condBuilding) {
|
||||
this.condBuilding = condBuilding;
|
||||
}
|
||||
|
||||
private static class BuildingMatcher extends TypeSafeMatcher<Building> {
|
||||
|
||||
private Building condBuilding;
|
||||
|
||||
public BuildingMatcher(Building cond) {
|
||||
this.condBuilding = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("buildings matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Building item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condBuilding.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condBuilding.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condBuilding.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Building> matchBuilding(Building building) {
|
||||
return new BuildingMatcher(building);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuildingMatcher matcher() {
|
||||
return new BuildingMatcher(condBuilding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Building;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class BuildingFilter implements Filter<Building> {
|
||||
|
||||
private Building condBuilding;
|
||||
|
||||
public BuildingFilter(Building condBuilding) {
|
||||
this.condBuilding = condBuilding;
|
||||
}
|
||||
|
||||
private static class BuildingMatcher extends TypeSafeMatcher<Building> {
|
||||
|
||||
private Building condBuilding;
|
||||
|
||||
public BuildingMatcher(Building cond) {
|
||||
this.condBuilding = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("buildings matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Building item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condBuilding.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condBuilding.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condBuilding.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Building> matchBuilding(Building building) {
|
||||
return new BuildingMatcher(building);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuildingMatcher matcher() {
|
||||
return new BuildingMatcher(condBuilding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public interface Filter<T> {
|
||||
|
||||
public TypeSafeMatcher<T> matcher();
|
||||
public String queryString();
|
||||
|
||||
}
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public interface Filter<T> {
|
||||
|
||||
public TypeSafeMatcher<T> matcher();
|
||||
public String queryString();
|
||||
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class MUnitFilter implements Filter<MUnit> {
|
||||
|
||||
private MUnit condMUnit;
|
||||
|
||||
public MUnitFilter(MUnit condMUnit) {
|
||||
this.condMUnit = condMUnit;
|
||||
}
|
||||
|
||||
private static class MUnitMatcher extends TypeSafeMatcher<MUnit> {
|
||||
|
||||
private MUnit condMUnit;
|
||||
|
||||
public MUnitMatcher(MUnit cond) {
|
||||
this.condMUnit = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("munits matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(MUnit item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMUnit.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condMUnit.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMUnit.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<MUnit> matchMUnit(MUnit munit) {
|
||||
return new MUnitMatcher(munit);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MUnitMatcher matcher() {
|
||||
return new MUnitMatcher(condMUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class MUnitFilter implements Filter<MUnit> {
|
||||
|
||||
private MUnit condMUnit;
|
||||
|
||||
public MUnitFilter(MUnit condMUnit) {
|
||||
this.condMUnit = condMUnit;
|
||||
}
|
||||
|
||||
private static class MUnitMatcher extends TypeSafeMatcher<MUnit> {
|
||||
|
||||
private MUnit condMUnit;
|
||||
|
||||
public MUnitMatcher(MUnit cond) {
|
||||
this.condMUnit = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("munits matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(MUnit item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMUnit.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condMUnit.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMUnit.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<MUnit> matchMUnit(MUnit munit) {
|
||||
return new MUnitMatcher(munit);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MUnitMatcher matcher() {
|
||||
return new MUnitMatcher(condMUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Material;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class MaterialFilter implements Filter<Material> {
|
||||
|
||||
private Material condMaterial;
|
||||
|
||||
public MaterialFilter(Material condMaterial) {
|
||||
this.condMaterial = condMaterial;
|
||||
}
|
||||
|
||||
private static class MaterialMatcher extends TypeSafeMatcher<Material> {
|
||||
|
||||
private Material condMaterial;
|
||||
|
||||
public MaterialMatcher(Material cond) {
|
||||
this.condMaterial = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("material matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Material item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMaterial.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condMaterial.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMaterial.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Material> matchBuilding(Material material) {
|
||||
return new MaterialMatcher(material);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialMatcher matcher() {
|
||||
return new MaterialMatcher(condMaterial);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Material;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class MaterialFilter implements Filter<Material> {
|
||||
|
||||
private Material condMaterial;
|
||||
|
||||
public MaterialFilter(Material condMaterial) {
|
||||
this.condMaterial = condMaterial;
|
||||
}
|
||||
|
||||
private static class MaterialMatcher extends TypeSafeMatcher<Material> {
|
||||
|
||||
private Material condMaterial;
|
||||
|
||||
public MaterialMatcher(Material cond) {
|
||||
this.condMaterial = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("material matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Material item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMaterial.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condMaterial.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMaterial.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Material> matchBuilding(Material material) {
|
||||
return new MaterialMatcher(material);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialMatcher matcher() {
|
||||
return new MaterialMatcher(condMaterial);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
package info.bukova.isspst.services.addressbook;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AresOdpoved {
|
||||
|
||||
private long pocetZaznamu;
|
||||
private String typVyhledani;
|
||||
private List<AresZaznam> aresZaznam;
|
||||
|
||||
public long getPocetZaznamu() {
|
||||
return pocetZaznamu;
|
||||
}
|
||||
public void setPocetZaznamu(long pocetZaznamu) {
|
||||
this.pocetZaznamu = pocetZaznamu;
|
||||
}
|
||||
public String getTypVyhledani() {
|
||||
return typVyhledani;
|
||||
}
|
||||
public void setTypVyhledani(String typVyhledani) {
|
||||
this.typVyhledani = typVyhledani;
|
||||
}
|
||||
public List<AresZaznam> getAresZaznam() {
|
||||
return aresZaznam;
|
||||
}
|
||||
public void setAresZaznam(List<AresZaznam> aresZaznam) {
|
||||
this.aresZaznam = aresZaznam;
|
||||
}
|
||||
|
||||
}
|
||||
package info.bukova.isspst.services.addressbook;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AresOdpoved {
|
||||
|
||||
private long pocetZaznamu;
|
||||
private String typVyhledani;
|
||||
private List<AresZaznam> aresZaznam;
|
||||
|
||||
public long getPocetZaznamu() {
|
||||
return pocetZaznamu;
|
||||
}
|
||||
public void setPocetZaznamu(long pocetZaznamu) {
|
||||
this.pocetZaznamu = pocetZaznamu;
|
||||
}
|
||||
public String getTypVyhledani() {
|
||||
return typVyhledani;
|
||||
}
|
||||
public void setTypVyhledani(String typVyhledani) {
|
||||
this.typVyhledani = typVyhledani;
|
||||
}
|
||||
public List<AresZaznam> getAresZaznam() {
|
||||
return aresZaznam;
|
||||
}
|
||||
public void setAresZaznam(List<AresZaznam> aresZaznam) {
|
||||
this.aresZaznam = aresZaznam;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
package info.bukova.isspst.services.addressbook;
|
||||
|
||||
public class AresZaznam {
|
||||
|
||||
private String firma;
|
||||
private long ico;
|
||||
private String obec;
|
||||
private String mestskaCast;
|
||||
private String ulice;
|
||||
private String cp;
|
||||
private String psc;
|
||||
|
||||
public String getFirma() {
|
||||
return firma;
|
||||
}
|
||||
public void setFirma(String firma) {
|
||||
this.firma = firma;
|
||||
}
|
||||
public long getIco() {
|
||||
return ico;
|
||||
}
|
||||
public void setIco(long ico) {
|
||||
this.ico = ico;
|
||||
}
|
||||
public String getObec() {
|
||||
return obec;
|
||||
}
|
||||
public void setObec(String obec) {
|
||||
this.obec = obec;
|
||||
}
|
||||
public String getMestskaCast() {
|
||||
return mestskaCast;
|
||||
}
|
||||
public void setMestskaCast(String mestskaCast) {
|
||||
this.mestskaCast = mestskaCast;
|
||||
}
|
||||
public String getUlice() {
|
||||
return ulice;
|
||||
}
|
||||
public void setUlice(String ulice) {
|
||||
this.ulice = ulice;
|
||||
}
|
||||
public String getCp() {
|
||||
return cp;
|
||||
}
|
||||
public void setCp(String cp) {
|
||||
this.cp = cp;
|
||||
}
|
||||
public String getPsc() {
|
||||
return psc;
|
||||
}
|
||||
public void setPsc(String psc) {
|
||||
this.psc = psc;
|
||||
}
|
||||
|
||||
}
|
||||
package info.bukova.isspst.services.addressbook;
|
||||
|
||||
public class AresZaznam {
|
||||
|
||||
private String firma;
|
||||
private long ico;
|
||||
private String obec;
|
||||
private String mestskaCast;
|
||||
private String ulice;
|
||||
private String cp;
|
||||
private String psc;
|
||||
|
||||
public String getFirma() {
|
||||
return firma;
|
||||
}
|
||||
public void setFirma(String firma) {
|
||||
this.firma = firma;
|
||||
}
|
||||
public long getIco() {
|
||||
return ico;
|
||||
}
|
||||
public void setIco(long ico) {
|
||||
this.ico = ico;
|
||||
}
|
||||
public String getObec() {
|
||||
return obec;
|
||||
}
|
||||
public void setObec(String obec) {
|
||||
this.obec = obec;
|
||||
}
|
||||
public String getMestskaCast() {
|
||||
return mestskaCast;
|
||||
}
|
||||
public void setMestskaCast(String mestskaCast) {
|
||||
this.mestskaCast = mestskaCast;
|
||||
}
|
||||
public String getUlice() {
|
||||
return ulice;
|
||||
}
|
||||
public void setUlice(String ulice) {
|
||||
this.ulice = ulice;
|
||||
}
|
||||
public String getCp() {
|
||||
return cp;
|
||||
}
|
||||
public void setCp(String cp) {
|
||||
this.cp = cp;
|
||||
}
|
||||
public String getPsc() {
|
||||
return psc;
|
||||
}
|
||||
public void setPsc(String psc) {
|
||||
this.psc = psc;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,28 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
||||
xmlns:are="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer/v_1.0.1"
|
||||
xmlns:dtt="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_datatypes/v_1.0.4"
|
||||
xmlns:udt="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/uvis_datatypes/v_1.0.1" >
|
||||
|
||||
<xsl:template match="are:Odpoved">
|
||||
<AresOdpoved>
|
||||
<PocetZaznamu><xsl:value-of select="are:Pocet_zaznamu" /></PocetZaznamu>
|
||||
<TypVyhledani><xsl:value-of select="are:Typ_vyhledani" /></TypVyhledani>
|
||||
<xsl:for-each select="are:Zaznam">
|
||||
<AresZaznam>
|
||||
<Firma><xsl:value-of select="are:Obchodni_firma" /></Firma>
|
||||
<Ico><xsl:value-of select="are:ICO" /></Ico>
|
||||
<Obec><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Nazev_obce" /></Obec>
|
||||
<MestskaCast><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Nazev_mestske_casti" /></MestskaCast>
|
||||
<Ulice><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Nazev_ulice" /></Ulice>
|
||||
<Cp><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Cislo_domovni" /><xsl:if test="are:Identifikace/are:Adresa_ARES/dtt:Cislo_orientacni">/<xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Cislo_orientacni" />
|
||||
</xsl:if>
|
||||
</Cp>
|
||||
<Psc><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:PSC" /></Psc>
|
||||
</AresZaznam>
|
||||
</xsl:for-each>
|
||||
</AresOdpoved>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
||||
xmlns:are="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer/v_1.0.1"
|
||||
xmlns:dtt="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_datatypes/v_1.0.4"
|
||||
xmlns:udt="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/uvis_datatypes/v_1.0.1" >
|
||||
|
||||
<xsl:template match="are:Odpoved">
|
||||
<AresOdpoved>
|
||||
<PocetZaznamu><xsl:value-of select="are:Pocet_zaznamu" /></PocetZaznamu>
|
||||
<TypVyhledani><xsl:value-of select="are:Typ_vyhledani" /></TypVyhledani>
|
||||
<xsl:for-each select="are:Zaznam">
|
||||
<AresZaznam>
|
||||
<Firma><xsl:value-of select="are:Obchodni_firma" /></Firma>
|
||||
<Ico><xsl:value-of select="are:ICO" /></Ico>
|
||||
<Obec><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Nazev_obce" /></Obec>
|
||||
<MestskaCast><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Nazev_mestske_casti" /></MestskaCast>
|
||||
<Ulice><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Nazev_ulice" /></Ulice>
|
||||
<Cp><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Cislo_domovni" /><xsl:if test="are:Identifikace/are:Adresa_ARES/dtt:Cislo_orientacni">/<xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:Cislo_orientacni" />
|
||||
</xsl:if>
|
||||
</Cp>
|
||||
<Psc><xsl:value-of select="are:Identifikace/are:Adresa_ARES/dtt:PSC" /></Psc>
|
||||
</AresZaznam>
|
||||
</xsl:for-each>
|
||||
</AresOdpoved>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
@ -1,42 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
|
||||
"http://castor.codehaus.org/mapping.dtd">
|
||||
|
||||
<mapping>
|
||||
<class name="info.bukova.isspst.services.addressbook.AresOdpoved">
|
||||
<map-to xml="AresOdpoved"/>
|
||||
<field name="PocetZaznamu" type="long">
|
||||
<bind-xml name="PocetZaznamu" node="element"/>
|
||||
</field>
|
||||
<field name="TypVyhledani" type="string">
|
||||
<bind-xml name="TypVyhledani" node="element"/>
|
||||
</field>
|
||||
<field name="AresZaznam" type="info.bukova.isspst.services.addressbook.AresZaznam" collection="arraylist">
|
||||
<bind-xml name="AresZaznam" node="element"/>
|
||||
</field>
|
||||
</class>
|
||||
|
||||
<class name="info.bukova.isspst.services.addressbook.AresZaznam">
|
||||
<field name="Firma" type="string">
|
||||
<bind-xml name="Firma" node="element"/>
|
||||
</field>
|
||||
<field name="Ico" type="long">
|
||||
<bind-xml name="Ico" node="element"/>
|
||||
</field>
|
||||
<field name="Ulice" type="string">
|
||||
<bind-xml name="Ulice" node="element"/>
|
||||
</field>
|
||||
<field name="Cp" type="string">
|
||||
<bind-xml name="Cp" node="element"/>
|
||||
</field>
|
||||
<field name="Obec" type="string">
|
||||
<bind-xml name="Obec" node="element"/>
|
||||
</field>
|
||||
<field name="MestskaCast" type="string">
|
||||
<bind-xml name="MestskaCast" node="element"/>
|
||||
</field>
|
||||
<field name="Psc" type="string">
|
||||
<bind-xml name="Psc" node="element"/>
|
||||
</field>
|
||||
</class>
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
|
||||
"http://castor.codehaus.org/mapping.dtd">
|
||||
|
||||
<mapping>
|
||||
<class name="info.bukova.isspst.services.addressbook.AresOdpoved">
|
||||
<map-to xml="AresOdpoved"/>
|
||||
<field name="PocetZaznamu" type="long">
|
||||
<bind-xml name="PocetZaznamu" node="element"/>
|
||||
</field>
|
||||
<field name="TypVyhledani" type="string">
|
||||
<bind-xml name="TypVyhledani" node="element"/>
|
||||
</field>
|
||||
<field name="AresZaznam" type="info.bukova.isspst.services.addressbook.AresZaznam" collection="arraylist">
|
||||
<bind-xml name="AresZaznam" node="element"/>
|
||||
</field>
|
||||
</class>
|
||||
|
||||
<class name="info.bukova.isspst.services.addressbook.AresZaznam">
|
||||
<field name="Firma" type="string">
|
||||
<bind-xml name="Firma" node="element"/>
|
||||
</field>
|
||||
<field name="Ico" type="long">
|
||||
<bind-xml name="Ico" node="element"/>
|
||||
</field>
|
||||
<field name="Ulice" type="string">
|
||||
<bind-xml name="Ulice" node="element"/>
|
||||
</field>
|
||||
<field name="Cp" type="string">
|
||||
<bind-xml name="Cp" node="element"/>
|
||||
</field>
|
||||
<field name="Obec" type="string">
|
||||
<bind-xml name="Obec" node="element"/>
|
||||
</field>
|
||||
<field name="MestskaCast" type="string">
|
||||
<bind-xml name="MestskaCast" node="element"/>
|
||||
</field>
|
||||
<field name="Psc" type="string">
|
||||
<bind-xml name="Psc" node="element"/>
|
||||
</field>
|
||||
</class>
|
||||
</mapping>
|
@ -1,10 +1,14 @@
|
||||
package info.bukova.isspst.services.users;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.bukova.isspst.data.Role;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface RoleService extends Service<Role> {
|
||||
|
||||
public Role getRoleByAuthority(String authority);
|
||||
public List<Role> getWorkgroupRoles();
|
||||
public List<Role> getCentreRoles();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package info.bukova.isspst.services.workgroups;
|
||||
|
||||
import info.bukova.isspst.services.IsspstException;
|
||||
|
||||
public class WorkgroupException extends IsspstException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1729975111741519801L;
|
||||
|
||||
public final static String NO_WORGROUP = "WorkgroupNotAllowed";
|
||||
public final static String MSUT_HAS_CENTER = "RoleMustHasCentre";
|
||||
public final static String MUST_HAS_WORKGROUP = "WorkgroupMustHasCentre";
|
||||
|
||||
public WorkgroupException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package info.bukova.isspst.services.workgroups;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.bukova.isspst.data.Member;
|
||||
import info.bukova.isspst.data.Role;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface WorkgroupService extends Service<Workgroup> {
|
||||
|
||||
public void addMember(Workgroup workgroup, Member member, Role role);
|
||||
public List<Workgroup> getWorkgroups();
|
||||
public List<Workgroup> getCentres();
|
||||
public boolean isMember(Workgroup workgroup, Member member);
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package info.bukova.isspst.services.workgroups;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.data.JobMapping;
|
||||
import info.bukova.isspst.data.Member;
|
||||
import info.bukova.isspst.data.Role;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.AbstractOwnedService;
|
||||
|
||||
public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implements WorkgroupService {
|
||||
|
||||
@Override
|
||||
public void addMember(Workgroup workgroup, Member member, Role role) {
|
||||
if (!member.isHasJob() && !role.getAuthority().equals(Constants.ROLE_USER)) {
|
||||
throw new WorkgroupException(WorkgroupException.NO_WORGROUP);
|
||||
}
|
||||
if (workgroup.isCentre() && !role.isCentre()) {
|
||||
throw new WorkgroupException(WorkgroupException.MSUT_HAS_CENTER);
|
||||
}
|
||||
if (!workgroup.isCentre() && !role.isWorkgroup()) {
|
||||
throw new WorkgroupException(WorkgroupException.MUST_HAS_WORKGROUP);
|
||||
}
|
||||
|
||||
JobMapping mapping = new JobMapping(member, role);
|
||||
if (!workgroup.getMembers().contains(mapping)) {
|
||||
workgroup.getMembers().add(mapping);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<Workgroup> getWorkgroups() {
|
||||
return this.execQuery("from Workgroup where centre = false");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<Workgroup> getCentres() {
|
||||
return this.execQuery("from Workgroup where centre = true");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(Workgroup workgroup, Member member) {
|
||||
for (JobMapping jm : workgroup.getMembers()) {
|
||||
if (jm.getMember().equals(member)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
package info.bukova.isspst.ui.workgroups;
|
||||
|
||||
import info.bukova.isspst.data.JobMapping;
|
||||
import info.bukova.isspst.data.Member;
|
||||
import info.bukova.isspst.data.Role;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.users.RoleService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.FormViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.event.DropEvent;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Listitem;
|
||||
|
||||
public class WorkgroupForm extends FormViewModel<Workgroup> {
|
||||
|
||||
@WireVariable
|
||||
private UserService userService;
|
||||
@WireVariable
|
||||
private RoleService roleService;
|
||||
@WireVariable
|
||||
private WorkgroupService workgroupService;
|
||||
private List<Member> users;
|
||||
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
users = new ArrayList<Member>();
|
||||
users.addAll(userService.getAll());
|
||||
List<Workgroup> wg = workgroupService.getWorkgroups();
|
||||
|
||||
for (Workgroup w : wg) {
|
||||
if (!workgroupService.isMember(getDataBean(), w)) {
|
||||
users.add(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Member> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public List<Role> getWorkgroupRoles() {
|
||||
if (getDataBean().isCentre()) {
|
||||
return roleService.getCentreRoles();
|
||||
} else {
|
||||
return roleService.getWorkgroupRoles();
|
||||
}
|
||||
}
|
||||
|
||||
@NotifyChange({"workgroupRoles", "centre"})
|
||||
public void setCentre(boolean centre) {
|
||||
getDataBean().setCentre(centre);
|
||||
}
|
||||
|
||||
public boolean getCentre() {
|
||||
return getDataBean().isCentre();
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange({"users", "dataBean"})
|
||||
public void addMember(@BindingParam("event") DropEvent event) {
|
||||
Set<Listitem> selected = ((Listitem)event.getDragged()).getListbox().getSelectedItems();
|
||||
|
||||
if (selected.isEmpty()) {
|
||||
try {
|
||||
Member u = ((Listitem)event.getDragged()).getValue();
|
||||
moveUser(u, event);
|
||||
} catch(ClassCastException e) {
|
||||
JobMapping u = ((Listitem)event.getDragged()).getValue();
|
||||
moveUser(u, event);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (Listitem li : selected) {
|
||||
try {
|
||||
Member u = li.getValue();
|
||||
moveUser(u, event);
|
||||
} catch (ClassCastException e) {
|
||||
JobMapping u = li.getValue();
|
||||
moveUser(u, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void moveUser(JobMapping u, DropEvent event) {
|
||||
String source = getSource(event);
|
||||
String target = getTarget(event);
|
||||
|
||||
if (source.equals(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
getDataBean().removeMember(u);
|
||||
|
||||
if (!target.equals("users")) {
|
||||
moveUser(u.getMember(), event);
|
||||
} else if (!u.getMember().isHasJob()) {
|
||||
users.add(u.getMember());
|
||||
}
|
||||
}
|
||||
|
||||
private void moveUser(Member u, DropEvent event) {
|
||||
String source = getSource(event);
|
||||
String target = getTarget(event);
|
||||
|
||||
if (source.equals(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
workgroupService.addMember(getDataBean(), u, roleService.getRoleByAuthority(target));
|
||||
|
||||
if (!u.isHasJob()) {
|
||||
users.remove(u);
|
||||
}
|
||||
}
|
||||
|
||||
private String getSource(DropEvent event) {
|
||||
return ((Listitem)event.getDragged()).getListbox().getId();
|
||||
}
|
||||
|
||||
private String getTarget(DropEvent event) {
|
||||
String target;
|
||||
|
||||
if (event.getTarget() instanceof Listitem) {
|
||||
target = ((Listitem)event.getTarget()).getListbox().getId();
|
||||
} else {
|
||||
target = event.getTarget().getId();
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package info.bukova.isspst.ui.workgroups;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
public class WorkgroupList extends ListViewModel<Workgroup> {
|
||||
|
||||
@WireVariable
|
||||
private WorkgroupService workgroupService;
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
service = workgroupService;
|
||||
dataClass = Workgroup.class;
|
||||
formZul = "workgroupForm.zul";
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +1,55 @@
|
||||
.nicebutton {
|
||||
font-family: Arial;
|
||||
color: #050005;
|
||||
font-size: 12px;
|
||||
padding-top: 3px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 3px;
|
||||
padding-left: 10px;
|
||||
margin: 4px;
|
||||
text-decoration: none;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0px 1px 3px #666666;
|
||||
-moz-box-shadow: 0px 1px 3px #666666;
|
||||
box-shadow: 0px 1px 3px #666666;
|
||||
text-shadow: 1px 1px 2px #666666;
|
||||
border: solid #8abaed 1px;
|
||||
background: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#efefef));
|
||||
background: -moz-linear-gradient(top, #ffffff, #efefef);
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#ffffff, endColorStr=#efefef);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#ffffff, endColorStr=#efefef);
|
||||
display:inline-block; /* IE is so silly */
|
||||
}
|
||||
.nicebutton:hover {
|
||||
background: #c5e8fa;
|
||||
}
|
||||
.nicebutton:disabled {
|
||||
font-family: Arial;
|
||||
color: #c4c4c4;
|
||||
font-size: 12px;
|
||||
padding-top: 3px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 3px;
|
||||
padding-left: 10px;
|
||||
margin: 5px;
|
||||
text-decoration: none;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0px 1px 3px #666666;
|
||||
-moz-box-shadow: 0px 1px 3px #666666;
|
||||
text-shadow: 0px 0px 0px #9e9e9e;
|
||||
box-shadow: 0px 1px 3px #666666;
|
||||
border: solid #d91c71 0px;
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
.nicebutton {
|
||||
font-family: Arial;
|
||||
color: #050005;
|
||||
font-size: 12px;
|
||||
padding-top: 3px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 3px;
|
||||
padding-left: 10px;
|
||||
margin: 4px;
|
||||
text-decoration: none;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0px 1px 3px #666666;
|
||||
-moz-box-shadow: 0px 1px 3px #666666;
|
||||
box-shadow: 0px 1px 3px #666666;
|
||||
text-shadow: 1px 1px 2px #666666;
|
||||
border: solid #8abaed 1px;
|
||||
background: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#efefef));
|
||||
background: -moz-linear-gradient(top, #ffffff, #efefef);
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#ffffff, endColorStr=#efefef);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#ffffff, endColorStr=#efefef);
|
||||
display:inline-block; /* IE is so silly */
|
||||
}
|
||||
.nicebutton:hover {
|
||||
background: #c5e8fa;
|
||||
}
|
||||
.nicebutton:disabled {
|
||||
font-family: Arial;
|
||||
color: #c4c4c4;
|
||||
font-size: 12px;
|
||||
padding-top: 3px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 3px;
|
||||
padding-left: 10px;
|
||||
margin: 5px;
|
||||
text-decoration: none;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0px 1px 3px #666666;
|
||||
-moz-box-shadow: 0px 1px 3px #666666;
|
||||
text-shadow: 0px 0px 0px #9e9e9e;
|
||||
box-shadow: 0px 1px 3px #666666;
|
||||
border: solid #d91c71 0px;
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@ -0,0 +1,10 @@
|
||||
<?page title="${labels.AgendaCommissions}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
|
||||
<zscript>
|
||||
String gridZul = "workgroups.zul";
|
||||
</zscript>
|
||||
|
||||
<include src="/app/template.zhtml"/>
|
||||
|
||||
</zk>
|
@ -0,0 +1,67 @@
|
||||
<?page title="${labels.WorkgroupFormTitle}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer"
|
||||
viewModel="@id('vm') @init('info.bukova.isspst.ui.workgroups.WorkgroupForm')">
|
||||
<caption src="/img/commission.png" zclass="form-caption" label="${labels.WorkgroupFormTitle}" />
|
||||
<vlayout>
|
||||
<grid hflex="min">
|
||||
<columns>
|
||||
<column align="right" hflex="min" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.code} :</cell>
|
||||
<cell>
|
||||
<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.code)" />
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.name} :</cell>
|
||||
<cell>
|
||||
<textbox id="name" width="200px" value="@bind(vm.dataBean.name)" />
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell>
|
||||
<checkbox label="Středisko" checked="@bind(vm.centre)"/>
|
||||
</cell>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<label value="Přetáhněte myší:"/>
|
||||
<hlayout>
|
||||
<listbox id="users" model="@bind(vm.users)" height="280px" width="200px" multiple="true"
|
||||
droppable="true" onDrop="@command('addMember', event=event)">
|
||||
<listhead>
|
||||
<listheader label="Uživatelé" sort="czech(fullName)"/>
|
||||
</listhead>
|
||||
<template name="model">
|
||||
<listitem image="@load(each.hasJob ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(each.fullName)" draggable="user" droppable="user"
|
||||
onDrop="@command('addMember', event=event)" attributes.item="@load(each)"/>
|
||||
</template>
|
||||
</listbox>
|
||||
|
||||
|
||||
|
||||
<vlayout children="@load(vm.workgroupRoles)">
|
||||
<template name="children">
|
||||
<listbox id="@load(each.authority)" model="@bind(vm.dataBean.members)" height="120px" width="200px" multiple="true"
|
||||
droppable="true" onDrop="@command('addMember', event=event)">
|
||||
<listhead>
|
||||
<listheader label="@load(each.description)" sort="czech(fullName)"/>
|
||||
</listhead>
|
||||
<template name="model" var="member">
|
||||
<listitem image="@load(member.member.hasJob ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(member.member.fullName)" draggable="user" droppable="user"
|
||||
onDrop="@command('addMember', event=event)" attributes.item="@load(member)" visible="@load(member.role.authority eq each.authority)"/>
|
||||
</template>
|
||||
</listbox>
|
||||
</template>
|
||||
|
||||
</vlayout>
|
||||
|
||||
</hlayout>
|
||||
<include src="/app/formButtons.zul" />
|
||||
</vlayout>
|
||||
</window>
|
||||
</zk>
|
@ -0,0 +1,94 @@
|
||||
<?page title="${labels.AgendaWorkgroups}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
<window border="normal" apply="org.zkoss.bind.BindComposer"
|
||||
viewModel="@id('vm') @init('info.bukova.isspst.ui.workgroups.WorkgroupList')">
|
||||
<caption zclass="form-caption" label="${labels.AgendaWorkgroups}" />
|
||||
<include src="/app/toolbar.zul" />
|
||||
|
||||
<hbox width="100%" height="500px">
|
||||
|
||||
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" width="680px" height="480px">
|
||||
<listhead menupopup="auto">
|
||||
<listheader label="${labels.code}" sort="czech(code)" width="10%" />
|
||||
<listheader label="${labels.name}" sort="czech(name)" width="30%" />
|
||||
</listhead>
|
||||
<!--
|
||||
<auxhead sclass="category-center" visible="@load(vm.filter)">
|
||||
<auxheader>
|
||||
<div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox value="@bind(vm.filterTemplate.code)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
|
||||
</div>
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div>
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox value="@bind(vm.filterTemplate.name)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
|
||||
</div>
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div>
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox value="@bind(vm.filterTemplate.description)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
|
||||
</div>
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div>
|
||||
</auxheader>
|
||||
</auxhead>
|
||||
-->
|
||||
<template name="model">
|
||||
<listitem>
|
||||
<listcell label="@load(each.code)" />
|
||||
<listcell label="@load(each.name)" />
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
|
||||
<!-- <panel hflex="1" width="70%" height="480px">
|
||||
<panelchildren>
|
||||
<grid model="@load(vm.dataBean.approvers)" height="90px">
|
||||
<columns>
|
||||
<column label="Vedoucí" sort="auto(fullName)"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<template name="model">
|
||||
<row>
|
||||
<cell>
|
||||
<image src="/img/user-small-red.png"/><label value="@load(each.fullName)"/>
|
||||
</cell>
|
||||
</row>
|
||||
</template>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
<grid model="@load(vm.dataBean.members)" height="290px">
|
||||
<columns>
|
||||
<column label="Členové" sort="auto(fullName)"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<template name="model">
|
||||
<row>
|
||||
<cell>
|
||||
<image src="/img/user-small.png"/><label value="@load(each.fullName)"/>
|
||||
</cell>
|
||||
</row>
|
||||
</template>
|
||||
</rows>
|
||||
</grid>
|
||||
</panelchildren>
|
||||
</panel> -->
|
||||
|
||||
</hbox>
|
||||
</window>
|
||||
</zk>
|
Loading…
Reference in New Issue