Implementováno zadávání hlaviček Požadavků.
Implementována číselná řada. Přidány metody pro porovnání String a Date pro filtry. Upraveno logování aplikace - loguje se až úroveň warning. refs #100multitenant
							parent
							
								
									a074dd376d
								
							
						
					
					
						commit
						8bcfc04c15
					
				@ -0,0 +1,57 @@
 | 
				
			|||||||
 | 
					package info.bukova.isspst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Calendar;
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.apache.commons.lang.time.DateUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class DateTimeUtils
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public static Date getDate(Date value)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (value == null)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return value;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Keep date - truncate time
 | 
				
			||||||
 | 
							return DateUtils.truncate(value, Calendar.DAY_OF_MONTH);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public static boolean isEqualByDate(Date d1, Date d2)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (d1 != null && d2 != null)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								d1 = DateTimeUtils.getDate(d1);
 | 
				
			||||||
 | 
								d2 = DateTimeUtils.getDate(d2);
 | 
				
			||||||
 | 
								boolean equals = (d1.compareTo(d2) == 0);
 | 
				
			||||||
 | 
								return equals;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public static boolean isEqualByDateForFilter(Date value, Date search)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (search == null)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else if (value != null)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return DateTimeUtils.isEqualByDate(value, search);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public static Date getCurrDateTime()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return new Date();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public static Date getCurrDate()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return DateTimeUtils.getDate(DateTimeUtils.getCurrDateTime());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,9 +1,31 @@
 | 
				
			|||||||
package info.bukova.isspst.services.requirement;
 | 
					package info.bukova.isspst.services.requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import info.bukova.isspst.data.Requirement;
 | 
					import info.bukova.isspst.data.Requirement;
 | 
				
			||||||
import info.bukova.isspst.services.AbstractService;
 | 
					import info.bukova.isspst.services.AbstractOwnedService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class RequirementServiceImpl extends AbstractService<Requirement> implements RequirementService
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.security.access.prepost.PreAuthorize;
 | 
				
			||||||
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class RequirementServiceImpl extends AbstractOwnedService<Requirement> implements RequirementService
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						protected Requirement createEntity()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							Requirement entity = new Requirement();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							entity.setReqDate(new Date());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return entity;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						@Transactional
 | 
				
			||||||
 | 
						@PreAuthorize("hasPermission(this, 'PERM_ADD')")
 | 
				
			||||||
 | 
						public void add(Requirement entity)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							entity.setNumser(this.getNumberSerie());
 | 
				
			||||||
 | 
							super.add(entity);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package info.bukova.isspst.services.requirements;
 | 
					package info.bukova.isspst.services.requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import info.bukova.isspst.data.RequirementType;
 | 
					import info.bukova.isspst.data.RequirementType;
 | 
				
			||||||
import info.bukova.isspst.services.Service;
 | 
					import info.bukova.isspst.services.Service;
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package info.bukova.isspst.services.requirements;
 | 
					package info.bukova.isspst.services.requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import info.bukova.isspst.data.RequirementType;
 | 
					import info.bukova.isspst.data.RequirementType;
 | 
				
			||||||
import info.bukova.isspst.services.AbstractOwnedService;
 | 
					import info.bukova.isspst.services.AbstractOwnedService;
 | 
				
			||||||
@ -1,15 +1,77 @@
 | 
				
			|||||||
package info.bukova.isspst.ui.requirement;
 | 
					package info.bukova.isspst.ui.requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import info.bukova.isspst.data.Requirement;
 | 
					import info.bukova.isspst.data.Requirement;
 | 
				
			||||||
 | 
					import info.bukova.isspst.data.RequirementSubject;
 | 
				
			||||||
 | 
					import info.bukova.isspst.data.Workgroup;
 | 
				
			||||||
 | 
					import info.bukova.isspst.services.requirement.RequirementService;
 | 
				
			||||||
 | 
					import info.bukova.isspst.services.users.UserService;
 | 
				
			||||||
 | 
					import info.bukova.isspst.services.workgroups.WorkgroupService;
 | 
				
			||||||
import info.bukova.isspst.ui.FormViewModel;
 | 
					import info.bukova.isspst.ui.FormViewModel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.zkoss.bind.annotation.Command;
 | 
				
			||||||
import org.zkoss.bind.annotation.Init;
 | 
					import org.zkoss.bind.annotation.Init;
 | 
				
			||||||
 | 
					import org.zkoss.bind.annotation.NotifyChange;
 | 
				
			||||||
 | 
					import org.zkoss.zk.ui.select.annotation.WireVariable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class RequirementForm extends FormViewModel<Requirement>
 | 
					public class RequirementForm extends FormViewModel<Requirement>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						@WireVariable
 | 
				
			||||||
 | 
						private UserService userService;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@WireVariable
 | 
				
			||||||
 | 
						private WorkgroupService workgroupService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public List<Workgroup> getCentres() {
 | 
				
			||||||
 | 
							return workgroupService.getUserCentres(userService.getCurrent());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						@WireVariable
 | 
				
			||||||
 | 
						private RequirementService requirementService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private RequirementSubject item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private int selItemIndex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Init(superclass = true)
 | 
						@Init(superclass = true)
 | 
				
			||||||
	public void init()
 | 
						public void init()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							this.setSelItemIndex(-1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public RequirementSubject getItem()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return item;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public void setItem(RequirementSubject item)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							this.item = item;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public int getSelItemIndex()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return selItemIndex;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public void setSelItemIndex(int selItemIndex)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							this.selItemIndex = selItemIndex;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Command
 | 
				
			||||||
 | 
						@NotifyChange({"dataBean", "selItemIndex"})
 | 
				
			||||||
 | 
						public void addItem() {
 | 
				
			||||||
 | 
					//		RequirementSubject item = new Material();
 | 
				
			||||||
 | 
					//		requirementService.addItem(getDataBean(), item);
 | 
				
			||||||
 | 
					//		selItemIndex = getDataBean().getItems().indexOf(item);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					/*	
 | 
				
			||||||
 | 
						@Command
 | 
				
			||||||
 | 
						@NotifyChange({"dataBean", "selItemIndex"})
 | 
				
			||||||
 | 
						public void removeItem(@BindingParam("item") RequirementItem item) {
 | 
				
			||||||
 | 
							requirementService.removeItem(getDataBean(), item);
 | 
				
			||||||
 | 
							selItemIndex = -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,10 @@
 | 
				
			|||||||
package info.bukova.isspst.ui.requirements;
 | 
					package info.bukova.isspst.ui.requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import info.bukova.isspst.Constants;
 | 
					import info.bukova.isspst.Constants;
 | 
				
			||||||
import info.bukova.isspst.data.RequirementType;
 | 
					import info.bukova.isspst.data.RequirementType;
 | 
				
			||||||
import info.bukova.isspst.data.Role;
 | 
					import info.bukova.isspst.data.Role;
 | 
				
			||||||
import info.bukova.isspst.data.Workflow;
 | 
					import info.bukova.isspst.data.Workflow;
 | 
				
			||||||
import info.bukova.isspst.services.requirements.RequirementTypeService;
 | 
					import info.bukova.isspst.services.requirement.RequirementTypeService;
 | 
				
			||||||
import info.bukova.isspst.services.users.RoleService;
 | 
					import info.bukova.isspst.services.users.RoleService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
											
												Binary file not shown.
											
										
									
								| 
		 After Width: | Height: | Size: 1.3 KiB  | 
											
												Binary file not shown.
											
										
									
								| 
		 After Width: | Height: | Size: 1.6 KiB  | 
@ -1,34 +1,87 @@
 | 
				
			|||||||
<?page title="${labels.RequirementsFormTitle}" contentType="text/html;charset=UTF-8"?>
 | 
					<?page title="${labels.RequirementsFormTitle}" contentType="text/html;charset=UTF-8"?>
 | 
				
			||||||
<zk>
 | 
					<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')">
 | 
						<window
 | 
				
			||||||
		<caption src="/img/reqact.png" zclass="form-caption" label="RequirementsFormTitle" />
 | 
							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="${labels.RequirementsFormTitle}" />
 | 
				
			||||||
		<vlayout>
 | 
							<vlayout>
 | 
				
			||||||
			<grid hflex="min">
 | 
								<grid hflex="min">
 | 
				
			||||||
				<columns>
 | 
									<columns>
 | 
				
			||||||
					<column align="right" hflex="min" />
 | 
										<column
 | 
				
			||||||
 | 
											align="right"
 | 
				
			||||||
 | 
											hflex="min" />
 | 
				
			||||||
					<column />
 | 
										<column />
 | 
				
			||||||
				</columns>
 | 
									</columns>
 | 
				
			||||||
				<rows>
 | 
									<rows>
 | 
				
			||||||
					<row>
 | 
										<row>
 | 
				
			||||||
						<cell sclass="row-title">${labels.BuildingsFormCode} :</cell>
 | 
											<cell sclass="row-title">${labels.RequirementsFormNumberSerie} :</cell>
 | 
				
			||||||
						<cell>
 | 
											<cell>
 | 
				
			||||||
							<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.numser)" />
 | 
												<textbox
 | 
				
			||||||
 | 
													id="numser"
 | 
				
			||||||
 | 
													constraint="@load(vm.constriant)"
 | 
				
			||||||
 | 
													width="200px"
 | 
				
			||||||
 | 
													value="@bind(vm.dataBean.numser)"
 | 
				
			||||||
 | 
													readonly="true" />
 | 
				
			||||||
						</cell>
 | 
											</cell>
 | 
				
			||||||
					</row>
 | 
										</row>
 | 
				
			||||||
					<row>
 | 
										<row>
 | 
				
			||||||
						<cell sclass="row-title">${labels.BuildingsFormName} :</cell>
 | 
											<cell sclass="row-title">${labels.RequirementsFormReqDate} :</cell>
 | 
				
			||||||
						<cell>
 | 
											<cell>
 | 
				
			||||||
							<datebox id="name" width="200px" value="@bind(vm.dataBean.reqDate)" />
 | 
												<datebox
 | 
				
			||||||
 | 
													id="reqDate"
 | 
				
			||||||
 | 
													width="200px"
 | 
				
			||||||
 | 
													value="@bind(vm.dataBean.reqDate)"
 | 
				
			||||||
 | 
													format="${labels.DateFormat}" />
 | 
				
			||||||
						</cell>
 | 
											</cell>
 | 
				
			||||||
					</row>
 | 
										</row>
 | 
				
			||||||
					<row>
 | 
										<row>
 | 
				
			||||||
						<cell sclass="row-title">${labels.BuildingsFormDescription} :</cell>
 | 
											<cell sclass="row-title">${labels.RequirementsFormCenter} :</cell>
 | 
				
			||||||
						<cell>
 | 
											<cell>
 | 
				
			||||||
							<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
 | 
												<combobox
 | 
				
			||||||
 | 
													model="@load(vm.centres)"
 | 
				
			||||||
 | 
													readonly="true"
 | 
				
			||||||
 | 
													selectedItem="@bind(vm.dataBean.workgroup)">
 | 
				
			||||||
 | 
													<template name="model">
 | 
				
			||||||
 | 
														<comboitem label="@load(each.fullName)" />
 | 
				
			||||||
 | 
													</template>
 | 
				
			||||||
 | 
												</combobox>
 | 
				
			||||||
 | 
											</cell>
 | 
				
			||||||
 | 
										</row>
 | 
				
			||||||
 | 
										<row>
 | 
				
			||||||
 | 
											<cell sclass="row-title">${labels.RequirementsFormDescription} :</cell>
 | 
				
			||||||
 | 
											<cell>
 | 
				
			||||||
 | 
												<textbox
 | 
				
			||||||
 | 
													id="description"
 | 
				
			||||||
 | 
													width="300px"
 | 
				
			||||||
 | 
													value="@bind(vm.dataBean.description)" />
 | 
				
			||||||
 | 
											</cell>
 | 
				
			||||||
 | 
										</row>
 | 
				
			||||||
 | 
										<row>
 | 
				
			||||||
 | 
											<cell sclass="row-title">${labels.RequirementsFormDeliveryDate} :</cell>
 | 
				
			||||||
 | 
											<cell>
 | 
				
			||||||
 | 
												<datebox
 | 
				
			||||||
 | 
													id="deliveryDate"
 | 
				
			||||||
 | 
													width="200px"
 | 
				
			||||||
 | 
													value="@bind(vm.dataBean.deliveryDate)"
 | 
				
			||||||
 | 
													format="${labels.DateFormat}" />
 | 
				
			||||||
						</cell>
 | 
											</cell>
 | 
				
			||||||
					</row>
 | 
										</row>
 | 
				
			||||||
				</rows>
 | 
									</rows>
 | 
				
			||||||
			</grid>
 | 
								</grid>
 | 
				
			||||||
 | 
								<hbox>
 | 
				
			||||||
 | 
									<button
 | 
				
			||||||
 | 
										image="/img/item-add.png"
 | 
				
			||||||
 | 
										label="${labels.AddItem}"
 | 
				
			||||||
 | 
										onClick="@command('addItem')"
 | 
				
			||||||
 | 
										sclass="nicebutton" />
 | 
				
			||||||
 | 
								</hbox>
 | 
				
			||||||
			<include src="/app/formButtons.zul" />
 | 
								<include src="/app/formButtons.zul" />
 | 
				
			||||||
		</vlayout>
 | 
							</vlayout>
 | 
				
			||||||
	</window>
 | 
						</window>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,41 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
 | 
					 | 
				
			||||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<!-- Appenders -->
 | 
					 | 
				
			||||||
	<appender name="console" class="org.apache.log4j.ConsoleAppender">
 | 
					 | 
				
			||||||
		<param name="Target" value="System.out" />
 | 
					 | 
				
			||||||
		<layout class="org.apache.log4j.PatternLayout">
 | 
					 | 
				
			||||||
			<param name="ConversionPattern" value="%-5p: %c - %m%n" />
 | 
					 | 
				
			||||||
		</layout>
 | 
					 | 
				
			||||||
	</appender>
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	<!-- Application Loggers -->
 | 
					 | 
				
			||||||
	<logger name="info.bukova.isspst">
 | 
					 | 
				
			||||||
		<level value="info" />
 | 
					 | 
				
			||||||
	</logger>
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	<!-- 3rdparty Loggers -->
 | 
					 | 
				
			||||||
	<logger name="org.springframework.core">
 | 
					 | 
				
			||||||
		<level value="info" />
 | 
					 | 
				
			||||||
	</logger>	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	<logger name="org.springframework.beans">
 | 
					 | 
				
			||||||
		<level value="info" />
 | 
					 | 
				
			||||||
	</logger>
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	<logger name="org.springframework.context">
 | 
					 | 
				
			||||||
		<level value="info" />
 | 
					 | 
				
			||||||
	</logger>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<logger name="org.springframework.web">
 | 
					 | 
				
			||||||
		<level value="info" />
 | 
					 | 
				
			||||||
	</logger>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<!-- Root Logger -->
 | 
					 | 
				
			||||||
	<root>
 | 
					 | 
				
			||||||
		<priority value="info" />
 | 
					 | 
				
			||||||
		<appender-ref ref="console" />
 | 
					 | 
				
			||||||
	</root>
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
</log4j:configuration>
 | 
					 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue