Conflicts:
	src/main/java/info/bukova/isspst/AppInitListener.java
	src/main/java/info/bukova/isspst/Constants.java
multitenant
František Přibyl 11 years ago
commit 54edc0c4cf

@ -308,6 +308,13 @@
<artifactId>DynamicJasper-core-fonts</artifactId> <artifactId>DynamicJasper-core-fonts</artifactId>
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>
<!-- Java Mail API -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>
<!-- Test --> <!-- Test -->
<dependency> <dependency>

@ -1,8 +1,7 @@
package info.bukova.isspst; package info.bukova.isspst;
import info.bukova.isspst.data.GlobalSettings;
import info.bukova.isspst.data.NumberSeries; import info.bukova.isspst.data.NumberSeries;
import java.util.List;
import info.bukova.isspst.data.Permission; import info.bukova.isspst.data.Permission;
import info.bukova.isspst.data.RequirementType; import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
@ -12,10 +11,13 @@ import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.reporting.ReportType; import info.bukova.isspst.reporting.ReportType;
import info.bukova.isspst.services.numberseries.NumberSeriesService; import info.bukova.isspst.services.numberseries.NumberSeriesService;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.users.PermissionService; import info.bukova.isspst.services.users.PermissionService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import java.util.List;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
@ -32,6 +34,7 @@ public class AppInitListener implements ServletContextListener {
private PermissionService permService; private PermissionService permService;
private NumberSeriesService nsService; private NumberSeriesService nsService;
private RequirementTypeService reqTypeService; private RequirementTypeService reqTypeService;
private GlobalSettingsService gSettingsService;
@Override @Override
public void contextDestroyed(ServletContextEvent arg0) { public void contextDestroyed(ServletContextEvent arg0) {
@ -48,6 +51,7 @@ public class AppInitListener implements ServletContextListener {
userService = ctx.getBean(UserService.class); userService = ctx.getBean(UserService.class);
permService = ctx.getBean(PermissionService.class); permService = ctx.getBean(PermissionService.class);
nsService =ctx.getBean(NumberSeriesService.class); nsService =ctx.getBean(NumberSeriesService.class);
gSettingsService = ctx.getBean(GlobalSettingsService.class);
reqTypeService = ctx.getBean(RequirementTypeService.class); reqTypeService = ctx.getBean(RequirementTypeService.class);
userService.grantAdmin(); userService.grantAdmin();
@ -57,6 +61,7 @@ public class AppInitListener implements ServletContextListener {
checkAllAdminRights(); checkAllAdminRights();
this.checkNumberSeries(); this.checkNumberSeries();
checkReqTypes(); checkReqTypes();
this.checkGlobalSettings();
userService.removeAccess(); userService.removeAccess();
loadModuleReports(); loadModuleReports();
@ -173,5 +178,13 @@ public class AppInitListener implements ServletContextListener {
nsService.add(ns); nsService.add(ns);
} }
} }
private void checkGlobalSettings() {
if (gSettingsService.getAll().isEmpty()) {
GlobalSettings gs = new GlobalSettings();
gSettingsService.add(gs);
}
}
} }

@ -8,7 +8,8 @@ import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.services.addressbook.AdbService; import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.buildings.BuildingService; import info.bukova.isspst.services.buildings.BuildingService;
import info.bukova.isspst.services.material.MaterialService; import info.bukova.isspst.services.reqsubjects.MaterialService;
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
import info.bukova.isspst.services.munits.MUnitService; import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.requirement.RequirementService; import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
@ -58,6 +59,7 @@ public class Constants {
public final static String MOD_BUILDINGS = "BUILDINGS"; public final static String MOD_BUILDINGS = "BUILDINGS";
public final static String MOD_MUNITS = "MUNITS"; public final static String MOD_MUNITS = "MUNITS";
public final static String MOD_MATERIAL = "MATERIAL"; public final static String MOD_MATERIAL = "MATERIAL";
public final static String MOD_SERVICES = "SERVICES";
public final static String MOD_WORKGROUPS = "WORKGROUPS"; public final static String MOD_WORKGROUPS = "WORKGROUPS";
public final static String MOD_REQUIREMENTS = "REQUIREMENTS"; public final static String MOD_REQUIREMENTS = "REQUIREMENTS";
public final static String MOD_WORKFLOW = "WORKFLOW"; public final static String MOD_WORKFLOW = "WORKFLOW";
@ -68,6 +70,7 @@ public class Constants {
new Module(MOD_BUILDINGS, "Budovy", BuildingService.class), new Module(MOD_BUILDINGS, "Budovy", BuildingService.class),
new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class), new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class),
new Module(MOD_MATERIAL, "Materiál", MaterialService.class), new Module(MOD_MATERIAL, "Materiál", MaterialService.class),
new Module(MOD_SERVICES, "Služby", ServiceItemService.class),
new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class), new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class),
new Module(MOD_REQUIREMENTS, "Požadavky", RequirementService.class), new Module(MOD_REQUIREMENTS, "Požadavky", RequirementService.class),
new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class) new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class)

@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.GlobalSettings;
public interface GlobalSettingsDao extends BaseDao<GlobalSettings> {
}

@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.ServiceItem;
public interface ServiceItemDao extends BaseDao<ServiceItem> {
}

@ -0,0 +1,9 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.GlobalSettingsDao;
import info.bukova.isspst.data.GlobalSettings;
public class GlobalSettingsDaoJPA extends BaseDaoJPA<GlobalSettings> implements
GlobalSettingsDao {
}

@ -0,0 +1,8 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.ServiceItemDao;
import info.bukova.isspst.data.ServiceItem;
public class ServiceItemDaoJPA extends BaseDaoJPA<ServiceItem> implements ServiceItemDao {
}

@ -0,0 +1,22 @@
package info.bukova.isspst.data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "GLOBALSETTINGS")
public class GlobalSettings extends BaseData {
@Column(name = "DATA", length = 1048576)
private String data;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}

@ -0,0 +1,81 @@
package info.bukova.isspst.data;
import javax.persistence.Column;
import javax.persistence.Embeddable;
@Embeddable
public class MUnitEmb {
@Column(name = "MUNIT_ID")
private Integer id;
@Column(name = "MUNIT_CODE")
private String code;
@Column(name = "MUNIT_DESCRIPTION")
private String description;
@Column(name = "MUNIT_NAME")
private String name;
public MUnitEmb() {
}
public MUnitEmb(MUnit munit) {
this.id = munit.getId();
this.code = munit.getCode();
this.description = munit.getDescription();
this.name = munit.getName();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean eqWith(MUnit munit) {
return this.id == munit.getId()
&& this.code.equals(munit.getCode())
&& this.name.equals(munit.getName())
&& this.description.equals(munit.getDescription());
}
@Override
public boolean equals(Object munit) {
return munit != null
&& (munit instanceof MUnitEmb)
&& this.id == ((MUnitEmb)munit).getId()
&& (this.code == ((MUnitEmb)munit).getCode() || this.code.equals(((MUnitEmb)munit).getCode()))
&& (this.name == ((MUnitEmb)munit).getName() || this.name.equals(((MUnitEmb)munit).getName()))
&& (this.description == ((MUnitEmb)munit).getDescription() || this.description.equals(((MUnitEmb)munit).getDescription()));
}
@Override
public String toString() {
return this.code + " - " + this.name;
}
}

@ -1,5 +1,6 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import javax.persistence.Embedded;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
@ -7,6 +8,15 @@ import javax.persistence.Table;
@Table(name="MATERIAL") @Table(name="MATERIAL")
public class Material extends RequirementSubject { public class Material extends RequirementSubject {
@Embedded
private MUnitEmb munit;
public MUnitEmb getMunit() {
return munit;
}
public void setMunit(MUnitEmb munit) {
this.munit = munit;
}
} }

@ -25,10 +25,10 @@ public abstract class RequirementSubject implements OwnedDataModel {
@Column(name =" ID") @Column(name =" ID")
@GeneratedValue(strategy = GenerationType.TABLE) @GeneratedValue(strategy = GenerationType.TABLE)
private int id; private int id;
@ManyToOne(fetch=FetchType.EAGER) @ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="OWNED_BY_ID") @JoinColumn(name="OWNED_BY_ID")
private User ownedBy; private User ownedBy;
@ManyToOne(fetch=FetchType.EAGER) @ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="MODIFIED_BY_ID") @JoinColumn(name="MODIFIED_BY_ID")
private User modifiedBy; private User modifiedBy;
@Column(name = "CREATED") @Column(name = "CREATED")

@ -0,0 +1,10 @@
package info.bukova.isspst.data;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "SERVICE")
public class ServiceItem extends RequirementSubject {
}

@ -0,0 +1,50 @@
package info.bukova.isspst.data;
import info.bukova.isspst.mail.MailMessage;
public class SettingsData {
private boolean enableRequirements;
private MailMessage newReqTemplate;
private MailMessage authReqTemplate;
private MailMessage confReqTemplate;
public SettingsData() {
newReqTemplate = new MailMessage();
authReqTemplate = new MailMessage();
confReqTemplate = new MailMessage();
}
public boolean isEnableRequirements() {
return enableRequirements;
}
public void setEnableRequirements(boolean enableRequirements) {
this.enableRequirements = enableRequirements;
}
public MailMessage getNewReqTemplate() {
return newReqTemplate;
}
public void setNewReqTemplate(MailMessage newReqTemplate) {
this.newReqTemplate = newReqTemplate;
}
public MailMessage getAuthReqTemplate() {
return authReqTemplate;
}
public void setAuthReqTemplate(MailMessage authReqTemplate) {
this.authReqTemplate = authReqTemplate;
}
public MailMessage getConfReqTemplate() {
return confReqTemplate;
}
public void setConfReqTemplate(MailMessage confReqTemplate) {
this.confReqTemplate = confReqTemplate;
}
}

@ -1,5 +1,7 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import java.math.BigDecimal;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
@ -21,6 +23,8 @@ public class Workflow extends BaseData {
private Role role; private Role role;
@Column(name = "WORDER") @Column(name = "WORDER")
private Integer wOrder; private Integer wOrder;
@Column(name = "WLIMIT", precision=15, scale=4)
private BigDecimal limit;
public Boolean getCentre() { public Boolean getCentre() {
return centre; return centre;
@ -56,4 +60,12 @@ public class Workflow extends BaseData {
this.wOrder = order; this.wOrder = order;
} }
public BigDecimal getLimit() {
return limit;
}
public void setLimit(BigDecimal limit) {
this.limit = limit;
}
} }

@ -0,0 +1,56 @@
package info.bukova.isspst.filters;
import static info.bukova.isspst.StringUtils.nullStr;
import info.bukova.isspst.data.ServiceItem;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class ServiceItemFilter implements Filter<ServiceItem> {
private ServiceItem condServiceItem;
public ServiceItemFilter(ServiceItem condServiceItem) {
this.condServiceItem = condServiceItem;
}
private static class ServiceItemMatcher extends TypeSafeMatcher<ServiceItem> {
private ServiceItem condServiceItem;
public ServiceItemMatcher(ServiceItem cond) {
this.condServiceItem = cond;
}
@Override
public void describeTo(Description desc) {
desc.appendText("material matches");
}
@Override
public boolean matchesSafely(ServiceItem item) {
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condServiceItem.getCode()).toLowerCase())
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condServiceItem.getName()).toLowerCase())
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condServiceItem.getDescription()).toLowerCase());
}
@Factory
public static Matcher<ServiceItem> matchBuilding(ServiceItem material) {
return new ServiceItemMatcher(material);
}
}
@Override
public ServiceItemMatcher matcher() {
return new ServiceItemMatcher(condServiceItem);
}
@Override
public String queryString() {
// TODO query string
return "";
}
}

@ -0,0 +1,49 @@
package info.bukova.isspst.mail;
import org.springframework.mail.SimpleMailMessage;
public class MailMessage extends SimpleMailMessage {
/**
*
*/
private static final long serialVersionUID = -3240551712942170018L;
private boolean html;
private String attachementName;
private byte[] attachementData;
private String contentType;
public boolean isHtml() {
return html;
}
public void setHtml(boolean html) {
this.html = html;
}
public byte[] getAttachementData() {
return attachementData;
}
public void setAttachementData(byte[] attachementData) {
this.attachementData = attachementData;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getAttachementName() {
return attachementName;
}
public void setAttachementName(String attachementName) {
this.attachementName = attachementName;
}
}

@ -0,0 +1,7 @@
package info.bukova.isspst.mail;
public interface Mailer {
public void send(MailMessage message);
}

@ -0,0 +1,57 @@
package info.bukova.isspst.mail;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.InputStreamSource;
import org.springframework.mail.MailParseException;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.scheduling.annotation.Async;
public class MailerWithAttachement implements Mailer {
private JavaMailSender sender;
private String from;
public MailerWithAttachement(JavaMailSender sender) {
this.sender = sender;
}
@Override
@Async
public void send(MailMessage message) {
MimeMessage mimeMessage = sender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
if (message.getFrom() == null || message.getFrom().isEmpty()) {
if (from == null || from.isEmpty()) {
message.setFrom("tomcat@is.bukova.info");
} else {
message.setFrom(from);
}
}
helper.setFrom(message.getFrom());
helper.setTo(message.getTo());
helper.setSubject(message.getSubject());
helper.setText(message.getText(), message.isHtml());
if (message.getAttachementData() != null) {
InputStreamSource source = new ByteArrayResource(message.getAttachementData());
helper.addAttachment(message.getAttachementName(), source, message.getContentType());
}
} catch (MessagingException e) {
throw new MailParseException(e);
}
sender.send(mimeMessage);
}
public void setFrom(String from) {
this.from = from;
}
}

@ -0,0 +1,33 @@
package info.bukova.isspst.mail;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
public class SimpleMailer implements Mailer {
private JavaMailSender sender;
private String from;
public SimpleMailer(JavaMailSender sender) {
this.sender = sender;
}
@Override
@Async
public void send(MailMessage message) {
if (message.getFrom() == null || message.getFrom().isEmpty()) {
if (from == null || from.isEmpty()) {
message.setFrom("tomcat@is.bukova.info");
} else {
message.setFrom(from);
}
}
sender.send(message);
}
public void setFrom(String from) {
this.from = from;
}
}

@ -41,11 +41,12 @@ public class IsspstPermissionEvaluator implements PermissionEvaluator {
private boolean evaluateGlobal(Service<?> service, String permission, List<Role> perms) { private boolean evaluateGlobal(Service<?> service, String permission, List<Role> perms) {
String moduleId = ""; String moduleId = "";
String perm = ""; String perm = permission;
for (Module m : Constants.MODULES) { for (Module m : Constants.MODULES) {
if (m.getServiceClass() != null && m.getServiceClass().isAssignableFrom(service.getClass())) { if (m.getServiceClass() != null && m.getServiceClass().isAssignableFrom(service.getClass())) {
moduleId = m.getId(); moduleId = m.getId();
break;
} }
} }

@ -1,4 +1,4 @@
package info.bukova.isspst.services.material; package info.bukova.isspst.services.reqsubjects;
import info.bukova.isspst.data.Material; import info.bukova.isspst.data.Material;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;

@ -1,4 +1,4 @@
package info.bukova.isspst.services.material; package info.bukova.isspst.services.reqsubjects;
import info.bukova.isspst.data.Material; import info.bukova.isspst.data.Material;
import info.bukova.isspst.services.AbstractOwnedService; import info.bukova.isspst.services.AbstractOwnedService;

@ -0,0 +1,8 @@
package info.bukova.isspst.services.reqsubjects;
import info.bukova.isspst.data.ServiceItem;
import info.bukova.isspst.services.Service;
public interface ServiceItemService extends Service<ServiceItem> {
}

@ -0,0 +1,9 @@
package info.bukova.isspst.services.reqsubjects;
import info.bukova.isspst.data.ServiceItem;
import info.bukova.isspst.services.AbstractOwnedService;
public class ServiceItemServiceImpl extends AbstractOwnedService<ServiceItem> implements
ServiceItemService {
}

@ -0,0 +1,110 @@
package info.bukova.isspst.services.settings;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import info.bukova.isspst.data.GlobalSettings;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.IsspstException;
public class GlobalSettingServiceImpl extends AbstractOwnedService<GlobalSettings> implements
GlobalSettingsService {
private final static Logger log = LoggerFactory.getLogger(GlobalSettingsService.class);
private final static String MARSHAL_ERROR = "Cannot marshal settings data: ";
private final static String UNMARSHAL_ERROR = "Cannot unmarshal settings data: ";
private Marshaller marshaller;
private Unmarshaller unmarshaller;
private SettingsData settings;
public GlobalSettingServiceImpl(Marshaller marshaller, Unmarshaller unmarshaller) {
this.marshaller = marshaller;
this.unmarshaller = unmarshaller;
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void add(GlobalSettings entity) {
if (!this.getAll().isEmpty()) {
throw new IsspstException("Global settings allready exists");
}
if (entity.getData() == null || entity.getData().isEmpty()) {
SettingsData data = new SettingsData();
entity.setData(marshalData(data));
}
super.add(entity);
}
private String marshalData(SettingsData data) {
StringWriter wr = new StringWriter();
try {
marshaller.setWriter(wr);
marshaller. marshal(data);
} catch (MarshalException e) {
log.error(MARSHAL_ERROR + e.getMessage());
} catch (ValidationException e) {
log.error(MARSHAL_ERROR + e.getMessage());
} catch (IOException e) {
log.error(MARSHAL_ERROR + e.getMessage());
}
return wr.toString();
}
private SettingsData unmarshalData(String data) {
StringReader sr = new StringReader(data);
try {
unmarshaller.setClass(SettingsData.class);
return (SettingsData) unmarshaller.unmarshal(sr);
} catch (MarshalException e) {
log.error(UNMARSHAL_ERROR + e.getMessage());
} catch (ValidationException e) {
log.error(UNMARSHAL_ERROR + e.getMessage());
}
return null;
}
@Override
@Transactional
public SettingsData getSettings() {
if (settings == null) {
GlobalSettings gs = this.getAll().get(0);
settings = unmarshalData(gs.getData());
}
return settings;
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT')")
public void updateSettings() {
if (this.getAll().isEmpty()) {
throw new IsspstException("Global settings does not exists");
}
GlobalSettings gs = this.getAll().get(0);
gs.setData(marshalData(settings));
super.update(gs);
}
}

@ -0,0 +1,12 @@
package info.bukova.isspst.services.settings;
import info.bukova.isspst.data.GlobalSettings;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.services.Service;
public interface GlobalSettingsService extends Service<GlobalSettings> {
public void updateSettings();
public SettingsData getSettings();
}

@ -1,6 +1,12 @@
package info.bukova.isspst.sort; package info.bukova.isspst.sort;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
public class ReflectionTools { public class ReflectionTools {
@ -46,4 +52,30 @@ public class ReflectionTools {
throw new IllegalArgumentException("Not getter method found for '" + propertyName + "', bean: " + bean); throw new IllegalArgumentException("Not getter method found for '" + propertyName + "', bean: " + bean);
} }
public static List<String> getEntityFields(Class<?> clazz) {
BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(clazz);
} catch (IntrospectionException e) {
return null;
}
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
List<String> properties = new ArrayList<String>();
for (PropertyDescriptor pd : pds) {
if (!(pd.getName().equals("password") || pd.getName().equals("class") || pd.getName().equals("id") || pd.getName().equals("valid"))) {
properties.add(pd.getName());
}
}
return properties;
}
public static List<String> getEntityFields(Object entity) {
if (entity == null) {
return null;
}
return getEntityFields(entity.getClass());
}
} }

@ -22,6 +22,18 @@ public class NavigationVM {
window.doModal(); window.doModal();
} }
@Command
public void numSeries() {
Window window = (Window)Executions.createComponents("/settings/numberSeries.zul", null, null);
window.doModal();
}
@Command
public void globalSettings() {
Window window = (Window)Executions.createComponents("/settings/globalSettings.zul", null, null);
window.doModal();
}
public String getContextPath() { public String getContextPath() {
return contextPath; return contextPath;
} }

@ -0,0 +1,73 @@
package info.bukova.isspst.ui.mail;
import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.mail.Mailer;
import info.bukova.isspst.reporting.Generator;
import info.bukova.isspst.reporting.GeneratorFactory;
import info.bukova.isspst.reporting.ReportDefinition;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
public class MailForm {
@WireVariable
private Mailer mailer;
@WireVariable
private ReportDefinition reportDefinition;
@WireVariable
private GeneratorFactory genFactory;
private MailMessage message;
private String to;
private String attachement;
private boolean report;
@Init
public void init(@ExecutionArgParam("report") Boolean report) {
message = new MailMessage();
message.setHtml(true);
this.report = report;
if (report) {
attachement = "report.pdf";
}
}
@Command
public void send(@BindingParam("window") Window window) {
message.setTo(to);
if (report) {
Generator generator = genFactory.createGenerator(reportDefinition);
message.setAttachementData(generator.generate());
message.setAttachementName("report.pdf");
message.setContentType("application/pdf");
}
mailer.send(message);
window.detach();
}
public MailMessage getMessage() {
return message;
}
public void setMessage(MailMessage message) {
this.message = message;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getAttachement() {
return attachement;
}
}

@ -1,18 +1,14 @@
package info.bukova.isspst.ui.reporting; package info.bukova.isspst.ui.reporting;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.List;
import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportDefinition; import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.reporting.ReportType; import info.bukova.isspst.reporting.ReportType;
import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.ui.ListChecks; import info.bukova.isspst.ui.ListChecks;
import info.bukova.isspst.ui.LocaleConverter; import info.bukova.isspst.ui.LocaleConverter;
import java.util.List;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
@ -38,19 +34,7 @@ public class ColSelectVM {
return null; return null;
} }
BeanInfo beanInfo; List<String> properties = ReflectionTools.getEntityFields(data.get(0));
try {
beanInfo = Introspector.getBeanInfo(data.get(0).getClass());
} catch (IntrospectionException e) {
return null;
}
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
List<String> properties = new ArrayList<String>();
for (PropertyDescriptor pd : pds) {
if (!(pd.getName().equals("password") || pd.getName().equals("class") || pd.getName().equals("id") || pd.getName().equals("valid"))) {
properties.add(pd.getName());
}
}
ListChecks<String> columns = new ListChecks<String>(reportDefinition.getFieldsToPrint(), properties); ListChecks<String> columns = new ListChecks<String>(reportDefinition.getFieldsToPrint(), properties);
return columns; return columns;

@ -1,6 +1,12 @@
package info.bukova.isspst.ui.reporting; package info.bukova.isspst.ui.reporting;
import java.util.HashMap;
import java.util.Map;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zul.Window;
public class ReportVM { public class ReportVM {
@ -8,5 +14,13 @@ public class ReportVM {
public void init() { public void init() {
} }
@Command
public void send() {
Map<String, Boolean> params = new HashMap<String, Boolean>();
params.put("report", true);
Window mailForm = (Window) Executions.createComponents("/app/mailForm.zul", null, params);
mailForm.doModal();
}
} }

@ -0,0 +1,35 @@
package info.bukova.isspst.ui.reqsubjects;
import java.util.ArrayList;
import java.util.List;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.MUnit;
import info.bukova.isspst.data.MUnitEmb;
import info.bukova.isspst.data.Material;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.ui.FormViewModel;
public class MaterialForm extends FormViewModel<Material> {
@WireVariable
private MUnitService munitService;
private List<MUnitEmb> munits;
@Init(superclass = true)
public void init() {
List<MUnit> mu = munitService.getAll();
munits = new ArrayList<MUnitEmb>();
for (MUnit m : mu) {
MUnitEmb muEmb = new MUnitEmb(m);
munits.add(muEmb);
}
}
public List<MUnitEmb> getMunits() {
return munits;
}
}

@ -1,11 +1,11 @@
package info.bukova.isspst.ui.material; package info.bukova.isspst.ui.reqsubjects;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.Material; import info.bukova.isspst.data.Material;
import info.bukova.isspst.filters.MaterialFilter; import info.bukova.isspst.filters.MaterialFilter;
import info.bukova.isspst.services.material.MaterialService; import info.bukova.isspst.services.reqsubjects.MaterialService;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
public class MaterialList extends ListViewModel<Material> { public class MaterialList extends ListViewModel<Material> {

@ -1,15 +1,15 @@
package info.bukova.isspst.ui.material; package info.bukova.isspst.ui.reqsubjects;
import org.zkoss.bind.annotation.Init;
import info.bukova.isspst.data.Material; import info.bukova.isspst.data.Material;
import info.bukova.isspst.ui.FormViewModel; import info.bukova.isspst.ui.FormViewModel;
public class MaterialForm extends FormViewModel<Material> { import org.zkoss.bind.annotation.Init;
public class ServiceItemForm extends FormViewModel<Material> {
@Init(superclass = true) @Init(superclass = true)
public void init() { public void init() {
} }
} }

@ -0,0 +1,24 @@
package info.bukova.isspst.ui.reqsubjects;
import info.bukova.isspst.data.ServiceItem;
import info.bukova.isspst.filters.ServiceItemFilter;
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
public class ServiceItemList extends ListViewModel<ServiceItem> {
@WireVariable
private ServiceItemService serviceItemService;
@Init
public void init() {
service = serviceItemService;
dataClass = ServiceItem.class;
formZul = "serviceForm.zul";
dataFilter = new ServiceItemFilter(getFilterTemplate());
}
}

@ -7,16 +7,22 @@ import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.DropEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Window;
public class RequirementTypesVM { public class RequirementTypesVM {
@ -28,6 +34,8 @@ public class RequirementTypesVM {
private List<Role> centreRoles; private List<Role> centreRoles;
private List<Role> workgroupRoles; private List<Role> workgroupRoles;
private RequirementType selected; private RequirementType selected;
private Workflow wgSelWorkflow;
private Workflow centreSelWorkflow;
@Init @Init
public void init() { public void init() {
@ -199,5 +207,42 @@ public class RequirementTypesVM {
this.selected = selected; this.selected = selected;
} }
@Command
@NotifyChange({"selected", "centreSelWorkflow", "wgSelWorkflow"})
public void overLimit(@BindingParam("workflow") Workflow workflow) {
if (workflow.getLimit() != null && !workflow.getLimit().equals(BigDecimal.ZERO)) {
workflow.setLimit(null);
reqTypeService.update(selected);
return;
}
Map<String, Object> params = new HashMap<String, Object>();
params.put("workflow", workflow);
Window win = (Window) Executions.createComponents("/settings/workflow/limit.zul", null, params);
win.doModal();
}
@GlobalCommand
@NotifyChange("selected")
public void refresh() {
reqTypeService.update(selected);
}
public Workflow getWgSelWorkflow() {
return wgSelWorkflow;
}
public void setWgSelWorkflow(Workflow wgSelWorkflow) {
this.wgSelWorkflow = wgSelWorkflow;
}
public Workflow getCentreSelWorkflow() {
return centreSelWorkflow;
}
public void setCentreSelWorkflow(Workflow centreSelWorkflow) {
this.centreSelWorkflow = centreSelWorkflow;
}
} }

@ -0,0 +1,33 @@
package info.bukova.isspst.ui.requirements;
import info.bukova.isspst.data.Workflow;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zul.Window;
public class LimitVM {
private Workflow workflow;
@Init
public void init(@ExecutionArgParam("workflow") Workflow workflow) {
this.workflow = workflow;
}
public Workflow getWorkflow() {
return workflow;
}
@Command
public void save(@BindingParam("window") Window window) {
window.detach();
}
public boolean isCanSave() {
return true;
}
}

@ -0,0 +1,60 @@
package info.bukova.isspst.ui.settings;
import java.util.List;
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.select.annotation.WireVariable;
import org.zkoss.zul.Window;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.ui.LocaleConverter;
public class GlobalSettingsVM {
@WireVariable
private GlobalSettingsService settingsService;
private SettingsData settings;
private LocaleConverter locConverter;
@Init
public void init() {
settings = settingsService.getSettings();
locConverter = new LocaleConverter();
}
public SettingsData getSettings() {
return settings;
}
@Command
public void save(@BindingParam("window") Window window) {
settingsService.updateSettings();
window.detach();
}
public List<String> getRequirementFields() {
return ReflectionTools.getEntityFields(Requirement.class);
}
public boolean isCanSave() {
return true;
}
public LocaleConverter getLocConverter() {
return locConverter;
}
@Command
@NotifyChange("settings")
public void insertField(@BindingParam("field") String field, @BindingParam("message") MailMessage message) {
message.setText(message.getText() + ":" + field + ":");
}
}

@ -0,0 +1,55 @@
package info.bukova.isspst.ui.settings;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
import info.bukova.isspst.Constants;
import info.bukova.isspst.Module;
import info.bukova.isspst.data.NumberSeries;
import info.bukova.isspst.services.numberseries.NumberSeriesService;
public class NumberSeriesVM {
@WireVariable
private NumberSeriesService numericSeriesService;
private List<NumberSeries> numberSeriesList;
private Map<String, Module> moduleMap;
@Init
public void init() {
numberSeriesList = new ArrayList<NumberSeries>(numericSeriesService.getAll());
moduleMap = new HashMap<String, Module>();
for (Module m : Constants.MODULES) {
moduleMap.put(m.getId(), m);
}
}
public List<NumberSeries> getNumberSeriesList() {
return numberSeriesList;
}
public boolean isCanSave() {
return true;
}
@Command
public void save(@BindingParam("window") Window window) {
for (NumberSeries ns : numberSeriesList) {
numericSeriesService.update(ns);
}
window.detach();
}
public Map<String, Module> getModuleMap() {
return moduleMap;
}
}

@ -20,5 +20,7 @@
<mapping class="info.bukova.isspst.data.Requirement"></mapping> <mapping class="info.bukova.isspst.data.Requirement"></mapping>
<mapping class="info.bukova.isspst.data.Workflow"></mapping> <mapping class="info.bukova.isspst.data.Workflow"></mapping>
<mapping class="info.bukova.isspst.data.RequirementType"></mapping> <mapping class="info.bukova.isspst.data.RequirementType"></mapping>
<mapping class="info.bukova.isspst.data.ServiceItem"></mapping>
<mapping class="info.bukova.isspst.data.GlobalSettings"></mapping>
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>

@ -39,4 +39,7 @@ username=Uživatelské jméno
#Skupiny #Skupiny
centre=Středisko centre=Středisko
members=Členové members=Členové
#Materiál
munit=Měrná jednotka

@ -100,6 +100,9 @@ UsersGridColumnSureName=Příjmení
AgendaMaterial=Materiál AgendaMaterial=Materiál
MaterialFormTitle=Materiál MaterialFormTitle=Materiál
AgendaServices=Služby
ServiceFormTitle=Služba
AgendaWorkgroups=Střediska / komise AgendaWorkgroups=Střediska / komise
WorkgroupFormTitle=Pracvní skupina WorkgroupFormTitle=Pracvní skupina
@ -111,6 +114,22 @@ CentreRoles=Role středisek
Workflow=Proces schválení Workflow=Proces schválení
WorkgroupWorkflow=Schválení v komisi WorkgroupWorkflow=Schválení v komisi
CentreWorkflow=Schválení ve středisku CentreWorkflow=Schválení ve středisku
LimitFormTitle=Limit pro schválení
Limit=Limit:
OverLimit=Pouze nadlimitní
NumberSeriesFormTitle=Číselné řady
Number=Číslo:
Prefix=Prefix:
GlobalSettings=Globální nastavení
Requirements=Požadavky
EMails=E-maily
NewRequirement=Nový požadavek
AuthRequirement=Dílčí schválení
ConfirmRequirement=Schválení
InsertField=Vložit pole
EnableRequirements=Povolit zadávání požadavků
CentresForRequirements=Střediska, pro která lze vkládat požadavky CentresForRequirements=Střediska, pro která lze vkládat požadavky
WorkgroupMembership=Členství v komisích WorkgroupMembership=Členství v komisích
@ -138,6 +157,12 @@ ReportTitle=Nadpis sestavy:
ReportOptions=Volby sestavy ReportOptions=Volby sestavy
ReportNoOptions=Žádná nestavení ReportNoOptions=Žádná nestavení
MailForm=Odeslání e-mailu
MailFor=Komu:
MailSubject=Předmět:
MailSend=Odeslat
MailAttachement=Příloha:
Error=Chyba Error=Chyba
ErrorRights=K vykobání této operace nemáte dostatečná oprávnění ErrorRights=K vykobání této operace nemáte dostatečná oprávnění

@ -0,0 +1,7 @@
mail.from=kosef.rokos@gmail.com
mail.host=smtp.gmail.com
mail.port=587
mail.useauth=true
mail.usessl=true
mail.username=josef.rokos@gmail.com
mail.password=XXXXXX

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.host}"/>
<property name="port" value="${mail.port}"/>
<property name="username" value="${mail.username}"/>
<property name="password" value="${mail.password}"/>
<property name="defaultEncoding" value="UTF-8"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">${mail.useauth}</prop>
<prop key="mail.smtp.starttls.enable">${mail.usessl}</prop>
</props>
</property>
</bean>
<bean id="mailer" class="info.bukova.isspst.mail.MailerWithAttachement">
<constructor-arg ref="mailSender"/>
<property name="from" value="${mail.from}"/>
</bean>
<bean id="simpleMailer" class="info.bukova.isspst.mail.SimpleMailer">
<constructor-arg ref="mailSender"/>
<property name="from" value="${mail.from}"/>
</bean>
<!-- <bean id="mailer" class="info.bukova.rsfaktura.services.mail.ThreadMailer"> -->
<!-- <constructor-arg ref="attachementMailer"/> -->
<!-- </bean> -->
<!-- <bean id="attachementMailer" class="info.bukova.rsfaktura.services.mail.AttachementMailer"> -->
<!-- <constructor-arg ref="tmpStorage"/> -->
<!-- <property name="from" value="josef.rokos@gmail.com"/> -->
<!-- <property name="sender" ref="mailSender"/> -->
<!-- </bean> -->
<!-- <bean id="messageBuilder" class="info.bukova.rsfaktura.services.mail.MailMessageBuilder"> -->
<!-- <constructor-arg ref="tmpStorage"/> -->
<!-- </bean> -->
</beans>

@ -1,21 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:security="http://www.springframework.org/schema/security" xmlns:context="http://www.springframework.org/schema/context" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
<!-- Root Context: defines shared resources visible to all other web components --> <!-- Root Context: defines shared resources visible to all other web components -->
<context:annotation-config /> <context:annotation-config />
<context:component-scan base-package="info.bukova.isspst,org.zkoss.spring.beans.zkcomponents"></context:component-scan> <context:component-scan base-package="info.bukova.isspst,org.zkoss.spring.beans.zkcomponents"></context:component-scan>
<task:annotation-driven/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" id="propertyConfigurer"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" id="propertyConfigurer">
<property name="locations"> <property name="locations">
<list> <list>
<value>/WEB-INF/jdbc.properties</value> <value>/WEB-INF/jdbc.properties</value>
<value>/WEB-INF/ldap.properties</value> <value>/WEB-INF/ldap.properties</value>
<value>/WEB-INF/mail.properties</value>
</list> </list>
</property> </property>
</bean> </bean>
@ -75,6 +86,8 @@
<import resource="database-auth.xml"/> <import resource="database-auth.xml"/>
<!-- <import resource="ldap-auth.xml"/> --> <!-- <import resource="ldap-auth.xml"/> -->
<import resource="mail-services.xml"/>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.security.core.context.SecurityContextHolder" /> <property name="targetClass" value="org.springframework.security.core.context.SecurityContextHolder" />
@ -140,6 +153,14 @@
<property name="sessionFactory" ref="sessionFactory"/> <property name="sessionFactory" ref="sessionFactory"/>
</bean> </bean>
<bean id="serviceItemDao" class="info.bukova.isspst.dao.jpa.ServiceItemDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="settingsDao" class="info.bukova.isspst.dao.jpa.GlobalSettingsDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Business logic --> <!-- Business logic -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
@ -192,7 +213,7 @@
<property name="dao" ref="permissionDao"/> <property name="dao" ref="permissionDao"/>
</bean> </bean>
<bean id="materialService" class="info.bukova.isspst.services.material.MaterialServiceImpl"> <bean id="materialService" class="info.bukova.isspst.services.reqsubjects.MaterialServiceImpl">
<property name="dao" ref="materialDao"/> <property name="dao" ref="materialDao"/>
<property name="validator" ref="validator"/> <property name="validator" ref="validator"/>
</bean> </bean>
@ -217,4 +238,32 @@
<property name="dao" ref="numericSeriesDao" /> <property name="dao" ref="numericSeriesDao" />
<property name="validator" ref="validator" /> <property name="validator" ref="validator" />
</bean> </bean>
<bean id="serviceItemService" class="info.bukova.isspst.services.reqsubjects.ServiceItemServiceImpl">
<property name="dao" ref="serviceItemDao" />
<property name="validator" ref="validator" />
</bean>
<bean id="settingsService" class="info.bukova.isspst.services.settings.GlobalSettingServiceImpl">
<constructor-arg name="marshaller" ref="marshallerSettings"/>
<constructor-arg name="unmarshaller" ref="unmarshallerSettings"/>
<property name="dao" ref="settingsDao"/>
</bean>
<bean id="xmlCtxSettings" class="org.castor.spring.xml.XMLContextFactoryBean">
<property name="castorProperties">
<props>
<prop key="org.exolab.castor.xml.introspector.primitive.nodetype">element</prop>
</props>
</property>
</bean>
<bean id="unmarshallerSettings" class="org.castor.spring.xml.CastorUnmarshallerFactoryBean">
<property name="xmlContext" ref="xmlCtxSettings" />
</bean>
<bean id="marshallerSettings" class="org.castor.spring.xml.CastorMarshallerFactoryBean">
<property name="xmlContext" ref="xmlCtxSettings" />
</bean>
</beans> </beans>

@ -0,0 +1,31 @@
<?page title="Mail" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window id="mailWin" border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.mail.MailForm')" width="500px" closable="true">
<caption zclass="form-caption" label="${labels.MailForm}" />
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailFor}"/> <textbox value="@bind(vm.to)" width="100%"/>
</row>
<row>
<label value="${labels.MailSubject }"/> <textbox value="@bind(vm.message.subject)" width="100%"/>
</row>
<row>
<label value="${labels.MailAttachement}"/> <textbox value="@load(vm.attachement)" readonly="true" width="100%"/>
</row>
</rows>
</grid>
<vbox>
<ckeditor width="470px" height="200px" value="@bind(vm.message.text)" toolbar="Basic"/>
<hbox>
<button label="${labels.MailSend}" onClick="@command('send', window=mailWin)"/> <button label="${labels.ButtonStorno}" onClick="mailWin.detach()"/>
</hbox>
</vbox>
</window>
</zk>

@ -30,6 +30,7 @@
<menubar orient="vertical"> <menubar orient="vertical">
<menuitem label="${labels.AgendaSuppliers}" href="/lists/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/> <menuitem label="${labels.AgendaSuppliers}" href="/lists/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/>
<menuitem label="${labels.AgendaMaterial}" href="/lists/material" disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}"/> <menuitem label="${labels.AgendaMaterial}" href="/lists/material" disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}"/>
<menuitem label="${labels.AgendaServices}" href="/lists/service" disabled="${not sec:isAllGranted('PERM_READ_SERVICES')}"/>
<menuitem label="${labels.AgendaMUnits}" href="/lists/munits" disabled="${not sec:isAllGranted('PERM_READ_MUNITS')}" width="120px"/> <menuitem label="${labels.AgendaMUnits}" href="/lists/munits" disabled="${not sec:isAllGranted('PERM_READ_MUNITS')}" width="120px"/>
<menuitem label="${labels.AgendaBuildings}" href="/lists/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" /> <menuitem label="${labels.AgendaBuildings}" href="/lists/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" />
<menuitem label="${labels.AgendaRooms}" href="/lists/rooms" disabled="${not sec:isAllGranted('PERM_READ_ROOMS')}" /> <menuitem label="${labels.AgendaRooms}" href="/lists/rooms" disabled="${not sec:isAllGranted('PERM_READ_ROOMS')}" />
@ -38,8 +39,9 @@
<tabpanel> <tabpanel>
<menubar orient="vertical"> <menubar orient="vertical">
<menuitem label="${labels.AgendaWorkflow}" href="/settings/workflow" disabled="${not sec:isAllGranted('PERM_EDIT_WORKFLOW')}"/> <menuitem label="${labels.AgendaWorkflow}" href="/settings/workflow" disabled="${not sec:isAllGranted('PERM_EDIT_WORKFLOW')}"/>
<menuitem label="Číselné řady" onClick="@command('numSeries')"/>
<menuitem label="Limity částek"/> <menuitem label="Limity částek"/>
<menuitem label="E-maily" /> <menuitem label="${labels.GlobalSettings}" onClick="@command('globalSettings')"/>
</menubar> </menubar>
</tabpanel> </tabpanel>
<tabpanel> <tabpanel>

@ -4,7 +4,7 @@
viewModel="@id('vm') @init('info.bukova.isspst.ui.reporting.ReportVM')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.reporting.ReportVM')">
<caption src="/img/print.png" zclass="form-caption" label="${labels.ReportReport}" /> <caption src="/img/print.png" zclass="form-caption" label="${labels.ReportReport}" />
<toolbar> <toolbar>
<toolbarbutton image="/img/send.png" tooltiptext="${labels.ReportSend}"/> <toolbarbutton image="/img/send.png" tooltiptext="${labels.ReportSend}" onClick="@command('send')"/>
</toolbar> </toolbar>
<iframe width="800px" height="660px" src="/api/report.pdf"/> <iframe width="800px" height="660px" src="/api/report.pdf"/>
</window> </window>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -1,15 +1,16 @@
<?page title="${labels.AgendaMaterial}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.AgendaMaterial}" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?> <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.material.MaterialList')"> <window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.reqsubjects.MaterialList')">
<caption zclass="form-caption" label="${labels.AgendaMaterial}" /> <caption zclass="form-caption" label="${labels.AgendaMaterial}" />
<include src="/app/toolbar.zul" /> <include src="/app/toolbar.zul" />
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" height="500px"> <listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" height="500px">
<listhead menupopup="auto"> <listhead menupopup="auto">
<listheader label="${labels.code}" sort="czech(code)" width="10%" /> <listheader label="${labels.code}" sort="czech(code)" width="10%" />
<listheader label="${labels.name}" sort="czech(name)" width="30%" /> <listheader label="${labels.name}" sort="czech(name)" width="25%" />
<listheader label="${labels.description}" sort="czech(description)" width="60%" /> <listheader label="${labels.description}" sort="czech(description)" width="55%" />
<listheader label="${labels.munit}" width="10%"/>
</listhead> </listhead>
<auxhead sclass="category-center" visible="@load(vm.filter)"> <auxhead sclass="category-center" visible="@load(vm.filter)">
@ -50,6 +51,7 @@
<listcell label="@load(each.code)" /> <listcell label="@load(each.code)" />
<listcell label="@load(each.name)" /> <listcell label="@load(each.name)" />
<listcell label="@load(each.description)" /> <listcell label="@load(each.description)" />
<listcell label="@load(each.munit.code)"/>
</listitem> </listitem>
</template> </template>
</listbox> </listbox>

@ -1,7 +1,7 @@
<?page title="${labels.MaterialFormTitle}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.MaterialFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" <window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.material.MaterialForm')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.reqsubjects.MaterialForm')">
<caption src="/img/material.png" zclass="form-caption" label="${labels.MaterialFormTitle}" /> <caption src="/img/material.png" zclass="form-caption" label="${labels.MaterialFormTitle}" />
<vlayout> <vlayout>
<grid hflex="min"> <grid hflex="min">
@ -28,6 +28,16 @@
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" /> <textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
</cell> </cell>
</row> </row>
<row>
<cell sclass="row-title">${labels.munit} :</cell>
<cell>
<combobox model="@load(vm.munits)" selectedItem="@bind(vm.dataBean.munit)" readonly="true">
<template name="model">
<comboitem label="@load(each.code)"/>
</template>
</combobox>
</cell>
</row>
</rows> </rows>
</grid> </grid>
<include src="/app/formButtons.zul" /> <include src="/app/formButtons.zul" />

@ -0,0 +1,10 @@
<?page title="${labels.AgendaServices}" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
String gridZul = "service.zul";
</zscript>
<include src="/app/template.zhtml"/>
</zk>

@ -0,0 +1,58 @@
<?page title="${labels.AgendaServices}" 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.reqsubjects.ServiceItemList')">
<caption zclass="form-caption" label="${labels.AgendaServices}" />
<include src="/app/toolbar.zul" />
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" height="500px">
<listhead menupopup="auto">
<listheader label="${labels.code}" sort="czech(code)" width="10%" />
<listheader label="${labels.name}" sort="czech(name)" width="30%" />
<listheader label="${labels.description}" sort="czech(description)" width="60%" />
</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)" />
<listcell label="@load(each.description)" />
</listitem>
</template>
</listbox>
</window>
</zk>

@ -0,0 +1,36 @@
<?page title="${labels.ServiceFormTitle}" 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.reqsubjects.ServiceItemForm')">
<caption src="/img/service.png" zclass="form-caption" label="${labels.ServiceFormTitle}" />
<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 sclass="row-title">${labels.description} :</cell>
<cell>
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
</cell>
</row>
</rows>
</grid>
<include src="/app/formButtons.zul" />
</vlayout>
</window>
</zk>

@ -0,0 +1,108 @@
<?page title="EMail" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" border="normal" closable="true" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM')" width="620px"
binder="@init(queueName='email')">
<caption src="/img/settings.png" zclass="form-caption" label="${labels.GlobalSettings}" />
<tabbox orient="vertical" height="400px">
<tabs width="100px">
<tab label="${labels.Requirements}"/>
<tab label="${labels.EMails}"/>
</tabs>
<tabpanels>
<tabpanel>
<div>
<checkbox label="${labels.EnableRequirements}" checked="@bind(vm.settings.enableRequirements)"/>
</div>
</tabpanel>
<tabpanel>
<tabbox>
<tabs>
<tab label="${labels.NewRequirement}"/>
<tab label="${labels.AuthRequirement}"/>
<tab label="${labels.ConfirmRequirement}"/>
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.newReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.newReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsNew, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.authReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.authReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsAuth, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.confReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsConfirm, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<menupopup id="fieldsNew" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.newReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsAuth" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.authReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsConfirm" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
</template>
</menupopup>
</tabpanel>
</tabpanels>
</tabbox>
<include src="/app/formButtons.zul"/>
</window>
</zk>

@ -0,0 +1,28 @@
<?page title="NumberSeriesFormTitle" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.NumberSeriesVM')" closable="true" width="400px"
binder="@init(queueName='numSeries')">
<caption zclass="form-caption" label="${labels.NumberSeriesFormTitle}" />
<!-- <combobox></combobox> -->
<grid model="@load(vm.numberSeriesList)">
<columns>
<column hflex="min"/>
<column/>
<column hflex="min"/>
<column hflex="min"/>
</columns>
<rows>
<template name="model">
<row>
<label value="@load(vm.moduleMap[each.module].name.concat(' - ').concat(labels.Prefix))"/>
<textbox value="@bind(each.prefix)"/>
<label value="${labels.Number}"/>
<label value="@load(each.number)"/>
</row>
</template>
</rows>
</grid>
<include src="/app/formButtons.zul"/>
</window>
</zk>

@ -0,0 +1,15 @@
<?page title="Limit" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirements.LimitVM')">
<caption zclass="form-caption" label="${labels.LimitFormTitle}" />
<vbox>
<hbox>
<label value="${labels.Limit}"/>
<textbox value="@bind(vm.workflow.limit)"/>
</hbox>
<include src="/app/formButtons.zul" />
</vbox>
</window>
</zk>

@ -45,27 +45,45 @@
<caption label="${labels.Workflow}"/> <caption label="${labels.Workflow}"/>
<vbox> <vbox>
<listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup" <listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup"
onDrop="@command('addRoleWg', event=event)"> onDrop="@command('addRoleWg', event=event)"
selectedItem="@bind(vm.wgSelWorkflow)">
<listhead> <listhead>
<listheader label="${labels.WorkgroupWorkflow}"/> <listheader label="${labels.WorkgroupWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(not each.centre)" <listitem label="@load(each.role.description)" visible="@load(not each.centre)"
onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup"/> onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup"
context="limitPopUpWg"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')"
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/>
</template> </template>
</listbox> </listbox>
<listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre" <listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre"
onDrop="@command('addRoleCentre', event=event)"> onDrop="@command('addRoleCentre', event=event)"
selectedItem="@bind(vm.centreSelWorkflow)">
<listhead> <listhead>
<listheader label="${labels.CentreWorkflow}"/> <listheader label="${labels.CentreWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(each.centre)" <listitem label="@load(each.role.description)" visible="@load(each.centre)"
onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre"/> onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre"
context="limitPopUp"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')"
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/>
</template> </template>
</listbox> </listbox>
</vbox> </vbox>
</groupbox> </groupbox>
<menupopup id="limitPopUp">
<menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.centreSelWorkflow.limit)"
onClick="@command('overLimit', workflow=centreWorkflow.selectedItem.value)"/>
</menupopup>
<menupopup id="limitPopUpWg">
<menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.wgSelWorkflow.limit)"
onClick="@command('overLimit', workflow=wgWorkflow.selectedItem.value)"/>
</menupopup>
</div> </div>
</hbox> </hbox>
</vbox> </vbox>

Loading…
Cancel
Save