parent
a834b91091
commit
177e29fe23
@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao;
|
||||
|
||||
import info.bukova.isspst.data.NumberSeries;
|
||||
|
||||
public interface NumberSeriesDao extends BaseDao<NumberSeries> {
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao;
|
||||
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
|
||||
public interface RequirementDao extends BaseDao<Requirement> {
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao.jpa;
|
||||
|
||||
import info.bukova.isspst.dao.NumberSeriesDao;
|
||||
import info.bukova.isspst.data.NumberSeries;
|
||||
|
||||
public class NumberSeriesDaoJPA extends BaseDaoJPA<NumberSeries> implements NumberSeriesDao {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao.jpa;
|
||||
|
||||
import info.bukova.isspst.dao.RequirementDao;
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
|
||||
public class RequirementDaoJPA extends BaseDaoJPA<Requirement> implements RequirementDao {
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "NUMBERSERIES")
|
||||
public class NumberSeries extends BaseSimpleData
|
||||
{
|
||||
@Column(name = "MODULE")
|
||||
private String module;
|
||||
|
||||
@Column(name = "PREFIX")
|
||||
private String prefix;
|
||||
|
||||
@Column(name = "NUMBER")
|
||||
private int number;
|
||||
|
||||
public String getCurrentNumber()
|
||||
{
|
||||
return String.format("%s%06d", this.getPrefix(), this.getNumber());
|
||||
}
|
||||
|
||||
public String getModule()
|
||||
{
|
||||
return module;
|
||||
}
|
||||
|
||||
public void setModule(String module)
|
||||
{
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public String getPrefix()
|
||||
{
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix)
|
||||
{
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public int getNumber()
|
||||
{
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(int number)
|
||||
{
|
||||
this.number = number;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "REQUIREMENT")
|
||||
public class Requirement extends BaseData implements DataModel
|
||||
{
|
||||
@Column(name = "NUMSER", unique = true)
|
||||
private String numser;
|
||||
|
||||
@Column(name = "REQDATE")
|
||||
private Date reqDate;
|
||||
|
||||
@Column(name = "DELIVERYDATE")
|
||||
private Date deliveryDate;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "WORKGROUP_ID")
|
||||
private Workgroup workgroup;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
public String getNumser()
|
||||
{
|
||||
return numser;
|
||||
}
|
||||
|
||||
public void setNumser(String numser)
|
||||
{
|
||||
this.numser = numser;
|
||||
}
|
||||
|
||||
public Date getReqDate()
|
||||
{
|
||||
return reqDate;
|
||||
}
|
||||
|
||||
public void setReqDate(Date reqDate)
|
||||
{
|
||||
this.reqDate = reqDate;
|
||||
}
|
||||
|
||||
public Date getDeliveryDate()
|
||||
{
|
||||
return deliveryDate;
|
||||
}
|
||||
|
||||
public void setDeliveryDate(Date deliveryDate)
|
||||
{
|
||||
this.deliveryDate = deliveryDate;
|
||||
}
|
||||
|
||||
public Workgroup getWorkgroup()
|
||||
{
|
||||
return workgroup;
|
||||
}
|
||||
|
||||
public void setWorkgroup(Workgroup workgroup)
|
||||
{
|
||||
this.workgroup = workgroup;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class RequirementFilter implements Filter<Requirement>
|
||||
{
|
||||
|
||||
private Requirement condition;
|
||||
|
||||
public RequirementFilter(Requirement cond)
|
||||
{
|
||||
this.condition = cond;
|
||||
}
|
||||
|
||||
private static class RequirementMatcher extends TypeSafeMatcher<Requirement>
|
||||
{
|
||||
|
||||
private Requirement condition;
|
||||
|
||||
public RequirementMatcher(Requirement cond)
|
||||
{
|
||||
this.condition = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc)
|
||||
{
|
||||
desc.appendText("requirement matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Requirement item)
|
||||
{
|
||||
return nullStr(item.getNumser()).toLowerCase().contains(nullStr(condition.getNumser()).toLowerCase())
|
||||
&& item.getReqDate().equals(condition.getReqDate())
|
||||
&& item.getDeliveryDate().equals(condition.getDeliveryDate())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condition.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Requirement> matchBuilding(Requirement building)
|
||||
{
|
||||
return new RequirementMatcher(building);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequirementMatcher matcher()
|
||||
{
|
||||
return new RequirementMatcher(condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package info.bukova.isspst.services.numberseries;
|
||||
|
||||
import info.bukova.isspst.data.NumberSeries;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface NumberSeriesService extends Service<NumberSeries>
|
||||
{
|
||||
public NumberSeries getNumberSerie(String module);
|
||||
|
||||
public void increase(NumberSeries ns);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package info.bukova.isspst.services.numberseries;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import info.bukova.isspst.data.NumberSeries;
|
||||
import info.bukova.isspst.services.AbstractService;
|
||||
|
||||
public class NumberSeriesServiceImpl extends AbstractService<NumberSeries> implements NumberSeriesService
|
||||
{
|
||||
@Transactional
|
||||
@Override
|
||||
public NumberSeries getNumberSerie(String module)
|
||||
{
|
||||
return this.selectSingle("from NumberSeries where MODULE = '" + module + "'");
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void increase(NumberSeries ns)
|
||||
{
|
||||
ns.setNumber(ns.getNumber() + 1);
|
||||
this.update(ns);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package info.bukova.isspst.services.requirement;
|
||||
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface RequirementService extends Service<Requirement> {
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package info.bukova.isspst.services.requirement;
|
||||
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
import info.bukova.isspst.services.AbstractService;
|
||||
|
||||
public class RequirementServiceImpl extends AbstractService<Requirement> implements RequirementService
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package info.bukova.isspst.ui.requirement;
|
||||
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
import info.bukova.isspst.ui.FormViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
|
||||
public class RequirementForm extends FormViewModel<Requirement>
|
||||
{
|
||||
@Init(superclass = true)
|
||||
public void init()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package info.bukova.isspst.ui.requirement;
|
||||
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
import info.bukova.isspst.filters.RequirementFilter;
|
||||
import info.bukova.isspst.services.requirement.RequirementService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class RequirementList extends ListViewModel<Requirement> {
|
||||
|
||||
@WireVariable
|
||||
private RequirementService requirementService;
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
service = requirementService;
|
||||
dataClass = Requirement.class;
|
||||
formZul = "requirementsForm.zul";
|
||||
dataFilter = new RequirementFilter(getFilterTemplate());
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,10 @@
|
||||
<?page title="${labels.AgendaActRequirements}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
|
||||
<zscript>
|
||||
String gridZul = "requirements.zul";
|
||||
</zscript>
|
||||
|
||||
<include src="../../app/template.zhtml"/>
|
||||
|
||||
</zk>
|
@ -0,0 +1,58 @@
|
||||
<?page title="${labels.AgendaActRequirements}" 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.requirement.RequirementList')">
|
||||
<caption zclass="form-caption" label="${labels.AgendaActRequirements}" />
|
||||
<include src="/app/toolbar.zul" />
|
||||
|
||||
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)">
|
||||
<listhead menupopup="auto">
|
||||
<listheader label="${labels.BuildingsGridColumnCode}" sort="czech(numser)" width="10%" />
|
||||
<listheader label="${labels.BuildingsGridColumnName}" sort="auto(reqDate)" width="30%" />
|
||||
<listheader label="${labels.BuildingsGridColumnDescription}" 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.numser)" 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">
|
||||
<datebox value="@bind(vm.filterTemplate.reqDate)" 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.numser)" />
|
||||
<listcell label="@load(each.reqDate)" />
|
||||
<listcell label="@load(each.description)" />
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
|
||||
</window>
|
||||
</zk>
|
@ -0,0 +1,35 @@
|
||||
<?page title="${labels.RequirementsFormTitle}" 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.requirement.RequirementForm')">
|
||||
<caption src="/img/reqact.png" zclass="form-caption" label="RequirementsFormTitle" />
|
||||
<vlayout>
|
||||
<grid hflex="min">
|
||||
<columns>
|
||||
<column align="right" hflex="min" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.BuildingsFormCode} :</cell>
|
||||
<cell>
|
||||
<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.numser)" />
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.BuildingsFormName} :</cell>
|
||||
<cell>
|
||||
<datebox id="name" width="200px" value="@bind(vm.dataBean.reqDate)" />
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.BuildingsFormDescription} :</cell>
|
||||
<cell>
|
||||
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
|
||||
</cell>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<include src="/app/formButtons.zul" />
|
||||
</vlayout>
|
||||
</window>
|
||||
</zk>
|
Loading…
Reference in New Issue