Pro org.codehaus.castor přidána vazba na xercesImpl.

Implicitní plnění měrných jednotek.
Příprava položek pro nové požadavky.
Logování událostí probíhá od úrovně warning.
Logování hibernate dotazů deaktivováno.

refs #100
multitenant
František Přibyl 11 years ago
parent dd369c5186
commit b633309b74

@ -295,6 +295,12 @@
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
</dependency>
<!-- Reporting -->
<dependency>
<groupId>net.sf.jasperreports</groupId>

@ -1,6 +1,7 @@
package info.bukova.isspst;
import info.bukova.isspst.data.GlobalSettings;
import info.bukova.isspst.data.MUnit;
import info.bukova.isspst.data.NumberSeries;
import info.bukova.isspst.data.Permission;
import info.bukova.isspst.data.RequirementType;
@ -9,6 +10,7 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.reporting.ReportType;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.numberseries.NumberSeriesService;
import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.settings.GlobalSettingsService;
@ -29,6 +31,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
public class AppInitListener implements ServletContextListener {
private MUnitService mUnitsService;
private RoleService roleService;
private UserService userService;
private PermissionService permService;
@ -47,6 +50,7 @@ public class AppInitListener implements ServletContextListener {
logger.info("Initializing database");
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(evt.getServletContext());
mUnitsService = ctx.getBean(MUnitService.class);
roleService = ctx.getBean(RoleService.class);
userService = ctx.getBean(UserService.class);
permService = ctx.getBean(PermissionService.class);
@ -55,6 +59,7 @@ public class AppInitListener implements ServletContextListener {
reqTypeService = ctx.getBean(RequirementTypeService.class);
userService.grantAdmin();
checkMUnits();
checkRoles();
checkUsers();
checkPermissions();
@ -67,6 +72,106 @@ public class AppInitListener implements ServletContextListener {
loadModuleReports();
}
private void checkMUnits()
{
List<MUnit> mUnits = mUnitsService.getAll();
if (mUnits.isEmpty())
{
MUnit mUnit = new MUnit();
mUnit.setCode("ks");
mUnit.setName("ks");
mUnit.setDescription("kus (množství)");
mUnitsService.add(mUnit);
mUnit.setCode("SI-m");
mUnit.setName("m");
mUnit.setDescription("metr (délka)");
mUnitsService.add(mUnit);
mUnit.setCode("VEDL-km");
mUnit.setName("km");
mUnit.setDescription("kilometr (délka)");
mUnitsService.add(mUnit);
mUnit.setCode("SI-kg");
mUnit.setName("kg");
mUnit.setDescription("kilogram (hmotnost)");
mUnitsService.add(mUnit);
mUnit.setCode("VEDL-g");
mUnit.setName("g");
mUnit.setDescription("gram (hmotnost)");
mUnitsService.add(mUnit);
mUnit.setCode("VEDL-dkg");
mUnit.setName("dkg");
mUnit.setDescription("dekagram (hmotnost)");
mUnitsService.add(mUnit);
mUnit.setCode("VEDL-t");
mUnit.setName("t");
mUnit.setDescription("tuna (hmotnost)");
mUnitsService.add(mUnit);
mUnit.setCode("SI-s");
mUnit.setName("s");
mUnit.setDescription("sekunda (čas)");
mUnitsService.add(mUnit);
mUnit.setCode("VEDL-min");
mUnit.setName("min");
mUnit.setDescription("minuta (čas)");
mUnitsService.add(mUnit);
mUnit.setCode("VEDL-hod");
mUnit.setName("hod");
mUnit.setDescription("hodina (čas)");
mUnitsService.add(mUnit);
mUnit.setCode("ODV-m2");
mUnit.setName("m[up]2[/up]");
mUnit.setDescription("metr čtverečný (plocha)");
mUnitsService.add(mUnit);
mUnit.setCode("ODV-ha");
mUnit.setName("ha");
mUnit.setDescription("hektar = 10.000 m² (plocha)");
mUnitsService.add(mUnit);
mUnit.setCode("ODV-m3");
mUnit.setName("m³");
mUnit.setDescription("metr krychlový (objem)");
mUnitsService.add(mUnit);
mUnit.setCode("ODV-l");
mUnit.setName("l");
mUnit.setDescription("litr = 10E-3 m³ (objem)");
mUnitsService.add(mUnit);
mUnit.setCode("SI-A");
mUnit.setName("A");
mUnit.setDescription("ampér (elektrický proud)");
mUnitsService.add(mUnit);
mUnit.setCode("SI-K");
mUnit.setName("K");
mUnit.setDescription("kelvin (termodynamická teplota)");
mUnitsService.add(mUnit);
mUnit.setCode("SI-cd");
mUnit.setName("cd");
mUnit.setDescription("kandela (svítivost)");
mUnitsService.add(mUnit);
mUnit.setCode("SI-mol");
mUnit.setName("mol");
mUnit.setDescription("mol (látkové množství)");
mUnitsService.add(mUnit);
}
}
private void checkRoles() {
for (Role role : Constants.ROLES)
{

@ -39,7 +39,7 @@ public class MUnit extends BaseData implements DataModel {
* @return the name
*/
public String getName() {
return name;
return this.name;
}
/**
@ -50,6 +50,29 @@ public class MUnit extends BaseData implements DataModel {
this.name = name;
}
public String getNameSpecial()
{
String special = this.getName();
if (special != null)
{
special = special.replace("[up]2[/up]", "²");
}
return special;
}
public void setNameSpecial(String special)
{
if (special != null)
{
special = special.replace("²", "[up]2[/up]");
}
this.setName(special);
}
/**
* @return the description
*/

@ -1,12 +1,15 @@
package info.bukova.isspst.data;
import java.util.Date;
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.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@ -29,6 +32,20 @@ public class Requirement extends BaseData implements DataModel
@Column(name = "DESCRIPTION")
private String description;
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
@JoinColumn(name = "REQUIREMENT_ID")
private List<RequirementItem> items;
public List<RequirementItem> getItems()
{
return items;
}
public void setItems(List<RequirementItem> items)
{
this.items = items;
}
public String getNumser()
{
return numser;

@ -0,0 +1,136 @@
package info.bukova.isspst.data;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "REQUIREMENT_ITEMS")
public class RequirementItem
{
@Id
@Column(name="ID")
@GeneratedValue
private int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "REQSUBJECT_ID")
private RequirementSubject reqSubject;
@Column(name = "CODE")
private String code;
@Column(name = "NAME")
private String name;
@Column(name = "QUANTITY", precision=15, scale=4)
private BigDecimal quantity;
@Embedded
private MUnitEmb mUnit;
@Column(name = "UNITPRICE", precision=15, scale=4)
private BigDecimal unitPrice;
@Column(name = "TOTAL", precision=15, scale=4)
private BigDecimal total;
@Column(name = "DESCRIPTION")
private String description;
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public RequirementSubject getReqSubject()
{
return reqSubject;
}
public void setReqSubject(RequirementSubject reqSubject)
{
this.reqSubject = reqSubject;
}
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 BigDecimal getQuantity()
{
return quantity;
}
public void setQuantity(BigDecimal quantity)
{
this.quantity = quantity;
}
public MUnitEmb getMUnit() {
return mUnit;
}
public void setMUnit(MUnitEmb mUnit) {
this.mUnit = mUnit;
}
public BigDecimal getUnitPrice()
{
return unitPrice;
}
public void setUnitPrice(BigDecimal unitPrice)
{
this.unitPrice = unitPrice;
}
public BigDecimal getTotal()
{
return total;
}
public void setTotal(BigDecimal total)
{
this.total = total;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
}

@ -1,7 +1,7 @@
package info.bukova.isspst.ui.requirement;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.RequirementSubject;
import info.bukova.isspst.data.RequirementItem;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.users.UserService;
@ -10,10 +10,13 @@ import info.bukova.isspst.ui.FormViewModel;
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.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
public class RequirementForm extends FormViewModel<Requirement>
{
@ -23,13 +26,15 @@ public class RequirementForm extends FormViewModel<Requirement>
@WireVariable
private WorkgroupService workgroupService;
public List<Workgroup> getCentres() {
public List<Workgroup> getCentres()
{
return workgroupService.getUserCentres(userService.getCurrent());
}
@WireVariable
private RequirementService requirementService;
private RequirementSubject item;
private RequirementItem item;
private int selItemIndex;
@ -39,12 +44,12 @@ public class RequirementForm extends FormViewModel<Requirement>
this.setSelItemIndex(-1);
}
public RequirementSubject getItem()
public RequirementItem getItem()
{
return item;
}
public void setItem(RequirementSubject item)
public void setItem(RequirementItem item)
{
this.item = item;
}
@ -61,17 +66,18 @@ public class RequirementForm extends FormViewModel<Requirement>
@Command
@NotifyChange({ "dataBean", "selItemIndex" })
public void addItem() {
// RequirementSubject item = new Material();
// requirementService.addItem(getDataBean(), item);
// selItemIndex = getDataBean().getItems().indexOf(item);
public void addItem()
{
Window window = (Window) Executions.createComponents("/requirements/selectitems/selectItems.zul", null, null);
window.doModal();
}
/*
@Command
@NotifyChange({ "dataBean", "selItemIndex" })
public void removeItem(@BindingParam("item") RequirementItem item) {
requirementService.removeItem(getDataBean(), item);
public void removeItem(@BindingParam("item") RequirementItem item)
{
// requirementService.removeItem(getDataBean(), item);
selItemIndex = -1;
}
*/
}

@ -0,0 +1,82 @@
package info.bukova.isspst.ui.requirements;
import info.bukova.isspst.data.Material;
import info.bukova.isspst.data.ServiceItem;
import info.bukova.isspst.services.reqsubjects.MaterialService;
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
import java.util.List;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
public class SelectItems
{
@WireVariable
private MaterialService materialService;
@WireVariable
private ServiceItemService serviceItemService;
private List<Material> materialList;
private List<ServiceItem> serviceItemList;
private Material selectedMaterial;
private ServiceItem selectedServiceItem;
@Init
public void init()
{
this.setMaterialList(materialService.getAll());
this.setServiceItemList(serviceItemService.getAll());
}
public List<Material> getMaterialList()
{
return materialList;
}
public void setMaterialList(List<Material> materialList)
{
this.materialList = materialList;
}
public List<ServiceItem> getServiceItemList()
{
return serviceItemList;
}
public void setServiceItemList(List<ServiceItem> serviceItemList)
{
this.serviceItemList = serviceItemList;
}
public Material getSelectedMaterial()
{
return selectedMaterial;
}
public void setSelectedMaterial(Material selectedMaterial)
{
this.selectedMaterial = selectedMaterial;
}
public ServiceItem getSelectedServiceItem()
{
return selectedServiceItem;
}
public void setSelectedServiceItem(ServiceItem selectedServiceItem)
{
this.selectedServiceItem = selectedServiceItem;
}
@Command
public void addItem()
{
//this
}
}

@ -18,6 +18,7 @@
<mapping class="info.bukova.isspst.data.JobMapping"></mapping>
<mapping class="info.bukova.isspst.data.NumberSeries"></mapping>
<mapping class="info.bukova.isspst.data.Requirement"></mapping>
<mapping class="info.bukova.isspst.data.RequirementItem"></mapping>
<mapping class="info.bukova.isspst.data.Workflow"></mapping>
<mapping class="info.bukova.isspst.data.RequirementType"></mapping>
<mapping class="info.bukova.isspst.data.ServiceItem"></mapping>

@ -36,6 +36,10 @@
<level value="warn" />
</logger>
<logger name="org.springframework.core.type.classreading.AnnotationAttributesReadingVisitor">
<level value="error" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />

@ -22,6 +22,15 @@ RequirementsGridCenter=Středisko
RequirementsGridDescription=Popis
RequirementsGridDeliveryDate=Datum dodání
RequirementItemCode=Kód
RequirementItemName=Text
RequirementItemQuantity=Množství
RequirementItemMUnit=MJ
RequirementItemUnitPrice=Jedn. cena
RequirementItemTotal=Celkem
RequirementItemDescription=Poznámka
AgendaMyOrders=Aktuální
AgendaOrdersHistory=Ukončené
@ -180,4 +189,5 @@ false=Ne
DateFormat=dd. MM. yyyy
AddItem=Přidat položku...
RemoveItem=Smazat položku...

@ -26,7 +26,7 @@
<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" />
<textbox value="@bind(vm.filterTemplate.nameSpecial)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
@ -48,7 +48,7 @@
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.nameSpecial)" />
<listcell label="@load(each.description)" />
</listitem>
</template>

@ -82,6 +82,90 @@
onClick="@command('addItem')"
sclass="nicebutton" />
</hbox>
<listbox
height="180px"
model="@load(vm.dataBean.items)"
selectedItem="@bind(vm.item)"
selectedIndex="@bind(vm.selItemIndex)">
<listhead>
<listheader
hflex="1"
Label="${labels.RequirementItemCode}" />
<listheader
hflex="3"
label="${labels.RequirementItemName}" />
<listheader
hflex="1"
label="${labels.RequirementItemQuantity}" />
<listheader
hflex="1"
label="${labels.RequirementItemMUnit}" />
<listheader
hflex="2"
label="${labels.RequirementItemUnitPrice}" />
<listheader
hflex="2"
label="${labels.RequirementItemTotal}" />
<listheader
width="120px"
label="${labels.RequirementItemDescription}" />
<listheader hflex="2" />
</listhead>
<template name="model">
<listitem>
<listcell>
<textbox
inplace="true"
onFocus="@command('selectItem', item=each)"
value="@bind(each.code)" />
</listcell>
<listcell>
<textbox
inplace="true"
onFocus="@command('selectItem', item=each)"
value="@bind(each.name)" />
</listcell>
<listcell>
<spinner
inplace="true"
onFocus="@command('selectItem', item=each)"
__onChange="@command('recalculate', zeroPrice=false)"
value="@bind(each.quantity)" />
</listcell>
<listcell>
<textbox
inplace="true"
onFocus="@command('selectItem', item=each)"
value="@bind(each.mUnit)" />
</listcell>
<listcell>
<textbox
inplace="true"
onFocus="@command('selectItem', item=each)"
value="@bind(each.unitPrice) @converter(vm.numConverter)" />
</listcell>
<listcell>
<textbox
inplace="true"
onFocus="@command('selectItem', item=each)"
value="@bind(each.total) @converter(vm.numConverter)" />
</listcell>
<listcell>
<textbox
inplace="true"
onFocus="@command('selectItem', item=each)"
value="@bind(each.description)" />
</listcell>
<listcell>
<button
image="/img/item-remove.png"
label="${labels.RemoveItem}"
onClick="@command('removeItem', item=each)"
sclass="nicebutton" />
</listcell>
</listitem>
</template>
</listbox>
<include src="/app/formButtons.zul" />
</vlayout>
</window>

@ -0,0 +1,108 @@
<?page title="${labels.AddItem}" contentType="text/html;charset=UTF-8"?>
<zk>
<window
id="selectItemsWnd"
closable="true"
border="normal"
position="center"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirements.SelectItems')">
<caption
src="/img/item-add.png"
zclass="form-caption"
label="${labels.AddItem}" />
<vlayout>
<tabbox
id="tabboxItems"
hflex="1">
<tabs>
<tab
id="tabMaterial"
label="${labels.AgendaMaterial}"
image="/img/material.png" />
<tab
id="tabService"
label="${labels.AgendaServices}"
image="/img/service.png" />
</tabs>
<tabpanels>
<tabpanel>
<listbox
model="@load(vm.materialList)"
selectedItem="@bind(vm.selectedMaterial)">
<listhead menupopup="auto">
<listheader
label="${labels.code}"
sort="czech(code)"
width="10%" />
<listheader
label="${labels.name}"
sort="czech(name)"
width="25%" />
<listheader
label="${labels.description}"
sort="czech(description)"
width="55%" />
<listheader
label="${labels.munit}"
width="10%" />
</listhead>
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.description)" />
<listcell label="@load(each.munit.code)" />
</listitem>
</template>
</listbox>
</tabpanel>
<tabpanel>
<listbox
model="@load(vm.serviceItemList)"
selectedItem="@bind(vm.selectedServiceItem)">
<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>
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.description)" />
</listitem>
</template>
</listbox>
</tabpanel>
</tabpanels>
</tabbox>
</vlayout>
<vlayout>
<div
hflex="max"
align="right">
<button
image="~./zul/img/misc/drag-disallow.png"
label="${labels.ButtonStorno}"
onClick="selectItemsWnd.detach()"
sclass="nicebutton" />
<button
image="/img/item-add.png"
label="${labels.AddItem}"
onClick="@command('addItem', window=selectItemsWnd)"
disabled="false"
sclass="nicebutton" />
</div>
</vlayout>
</window>
</zk>
Loading…
Cancel
Save