Merge branch 'Verze_1.0'
Conflicts: src/main/java/info/bukova/isspst/AppInitListener.java src/main/java/info/bukova/isspst/Constants.java src/main/java/info/bukova/isspst/data/Order.java src/main/java/info/bukova/isspst/data/OrderItem.java src/main/java/info/bukova/isspst/data/RequirementBase.java src/main/java/info/bukova/isspst/data/RequirementItem.java src/main/java/info/bukova/isspst/ui/settings/NumberSeriesVM.java
This commit is contained in:
@@ -12,6 +12,7 @@ import info.bukova.isspst.reporting.Report;
|
||||
import info.bukova.isspst.reporting.ReportMapping;
|
||||
import info.bukova.isspst.reporting.ReportType;
|
||||
import info.bukova.isspst.services.FullTextService;
|
||||
import info.bukova.isspst.services.dbinfo.DbInfoService;
|
||||
import info.bukova.isspst.services.munits.MUnitService;
|
||||
import info.bukova.isspst.services.numberseries.NumberSeriesService;
|
||||
import info.bukova.isspst.services.requirement.RequirementTypeService;
|
||||
@@ -34,6 +35,8 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
public class AppInitListener implements ServletContextListener {
|
||||
|
||||
|
||||
private DbInfoService dbInfoService;
|
||||
private MUnitService mUnitsService;
|
||||
private RoleService roleService;
|
||||
private UserService userService;
|
||||
@@ -54,6 +57,7 @@ public class AppInitListener implements ServletContextListener {
|
||||
logger.info("Initializing database");
|
||||
|
||||
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(evt.getServletContext());
|
||||
dbInfoService = ctx.getBean(DbInfoService.class);
|
||||
mUnitsService = ctx.getBean(MUnitService.class);
|
||||
roleService = ctx.getBean(RoleService.class);
|
||||
userService = ctx.getBean(UserService.class);
|
||||
@@ -64,6 +68,7 @@ public class AppInitListener implements ServletContextListener {
|
||||
ftService = ctx.getBean(FullTextService.class);
|
||||
|
||||
userService.grantAdmin();
|
||||
this.checkDbInfo();
|
||||
checkMUnits();
|
||||
checkRoles();
|
||||
checkUsers();
|
||||
@@ -81,6 +86,23 @@ public class AppInitListener implements ServletContextListener {
|
||||
private void buildFulltext() {
|
||||
ftService.reindex();
|
||||
}
|
||||
private void checkDbInfo()
|
||||
{
|
||||
List<User> userList = userService.getAll();
|
||||
|
||||
if (userList.isEmpty())
|
||||
{
|
||||
// Database is new/empty, column definition is anotated - set actual
|
||||
// database version
|
||||
dbInfoService.updateDatabaseVersion();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Existing database - try change structure and set actual database
|
||||
// version...
|
||||
dbInfoService.changeDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkMUnits()
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package info.bukova.isspst;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import info.bukova.isspst.data.Order;
|
||||
import info.bukova.isspst.data.Permission;
|
||||
import info.bukova.isspst.data.PermissionType;
|
||||
@@ -31,8 +27,14 @@ import info.bukova.isspst.services.users.RoleService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Constants {
|
||||
|
||||
|
||||
public final static long DB_VERSION = 1;
|
||||
|
||||
public final static String DEF_ADMIN = "admin";
|
||||
public final static String DEF_ADMIN_PASSWD = "admin";
|
||||
public final static String ROLE_USER = "ROLE_USER";
|
||||
@@ -156,4 +158,7 @@ public class Constants {
|
||||
put(Order.class, "/main/orders/created/");
|
||||
put(TripBill.class, "/main/trips/bill/");
|
||||
}} );
|
||||
|
||||
public final static int LEN_TEXT = 255;
|
||||
public final static int LEN_DESCRIPTION = 8192;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao;
|
||||
|
||||
import info.bukova.isspst.data.DbInfo;
|
||||
|
||||
public interface DbInfoDao extends BaseDao<DbInfo>
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package info.bukova.isspst.dao.jpa;
|
||||
|
||||
import info.bukova.isspst.dao.DbInfoDao;
|
||||
import info.bukova.isspst.data.DbInfo;
|
||||
|
||||
public class DbInfoDaoJPA extends BaseDaoJPA<DbInfo> implements DbInfoDao
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,7 +46,7 @@ public class Address extends BaseData
|
||||
private String email;
|
||||
@Column(name = "WEB")
|
||||
private String web;
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "Zadejte firmu")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,7 +25,7 @@ public class Building extends BaseData implements DataModel {
|
||||
@Column(name = "NAME")
|
||||
private String name;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "building", orphanRemoval = true)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "DBINFO")
|
||||
public class DbInfo extends BaseSimpleData
|
||||
{
|
||||
@Column(name = "VERSION")
|
||||
private long version;
|
||||
|
||||
public DbInfo()
|
||||
{
|
||||
this.version = 0;
|
||||
}
|
||||
|
||||
public long getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(long version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@@ -13,7 +14,7 @@ public class MUnit extends BaseData
|
||||
@Column(name = "NAME")
|
||||
private String name;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
|
||||
public String getName()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@@ -14,7 +15,7 @@ public class MUnitEmb
|
||||
@Column(name = "MUNIT_NAME")
|
||||
private String name;
|
||||
|
||||
@Column(name = "MUNIT_DESCRIPTION")
|
||||
@Column(name = "MUNIT_DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
|
||||
public MUnitEmb()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -41,7 +43,7 @@ public class Order extends BaseData implements Cloneable
|
||||
@AttributeOverride(name = "company", column = @Column(name = "SUPPLIER_COMPANY")),
|
||||
@AttributeOverride(name = "contactName", column = @Column(name = "SUPPLIER_CONTACT_NAME")),
|
||||
@AttributeOverride(name = "department", column = @Column(name = "SUPPLIER_DEPARTMENT")),
|
||||
@AttributeOverride(name = "description", column = @Column(name = "SUPPLIER_DESCRIPTION")),
|
||||
@AttributeOverride(name = "description", column = @Column(name = "SUPPLIER_DESCRIPTION", length = Constants.LEN_DESCRIPTION)),
|
||||
@AttributeOverride(name = "dic", column = @Column(name = "SUPPLIER_DIC")),
|
||||
@AttributeOverride(name = "email", column = @Column(name = "SUPPLIER_EMAIL")),
|
||||
@AttributeOverride(name = "houseNumber", column = @Column(name = "SUPPLIER_HOUSENUMBER")),
|
||||
@@ -61,7 +63,7 @@ public class Order extends BaseData implements Cloneable
|
||||
@AttributeOverride(name = "company", column = @Column(name = "INVOICE_COMPANY")),
|
||||
@AttributeOverride(name = "contactName", column = @Column(name = "INVOICE_CONTACT_NAME")),
|
||||
@AttributeOverride(name = "department", column = @Column(name = "INVOICE_DEPARTMENT")),
|
||||
@AttributeOverride(name = "description", column = @Column(name = "INVOICE_DESCRIPTION")),
|
||||
@AttributeOverride(name = "description", column = @Column(name = "INVOICE_DESCRIPTION", length = Constants.LEN_DESCRIPTION)),
|
||||
@AttributeOverride(name = "dic", column = @Column(name = "INVOICE_DIC")),
|
||||
@AttributeOverride(name = "email", column = @Column(name = "INVOICE_EMAIL")),
|
||||
@AttributeOverride(name = "houseNumber", column = @Column(name = "INVOICE_HOUSENUMBER")),
|
||||
@@ -80,7 +82,7 @@ public class Order extends BaseData implements Cloneable
|
||||
@AttributeOverride(name = "company", column = @Column(name = "DELIVERY_COMPANY")),
|
||||
@AttributeOverride(name = "contactName", column = @Column(name = "DELIVERY_CONTACT_NAME")),
|
||||
@AttributeOverride(name = "department", column = @Column(name = "DELIVERY_DEPARTMENT")),
|
||||
@AttributeOverride(name = "description", column = @Column(name = "DELIVERY_DESCRIPTION")),
|
||||
@AttributeOverride(name = "description", column = @Column(name = "DELIVERY_DESCRIPTION", length = Constants.LEN_DESCRIPTION)),
|
||||
@AttributeOverride(name = "dic", column = @Column(name = "DELIVERY_DIC")),
|
||||
@AttributeOverride(name = "email", column = @Column(name = "DELIVERY_EMAIL")),
|
||||
@AttributeOverride(name = "houseNumber", column = @Column(name = "DELIVERY_HOUSENUMBER")),
|
||||
@@ -101,7 +103,7 @@ public class Order extends BaseData implements Cloneable
|
||||
@Column(name = "DELIVERY_TYPE")
|
||||
private String deliveryType;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
@Field(index = Index.YES, analyze = Analyze.YES)
|
||||
private String description;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@@ -51,7 +53,7 @@ public class OrderItem
|
||||
@Column(name = "TOTAL", precision = 15, scale = 4)
|
||||
private BigDecimal total;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
@Field(index = Index.YES, analyze = Analyze.YES)
|
||||
private String description;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
@@ -19,7 +21,7 @@ public class Permission extends BaseSimpleData implements GrantedAuthority {
|
||||
|
||||
@Column(name="AUTHORITY")
|
||||
private String authority;
|
||||
@Column(name="DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
@Column(name="MODULE")
|
||||
private String module;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -37,7 +39,7 @@ public class RequirementBase extends BaseData implements FilterableRequirement {
|
||||
private String numser;
|
||||
@Column(name = "REQ_DATE")
|
||||
private Date reqDate;
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
@Field(index = Index.YES, analyze = Analyze.YES)
|
||||
private String description;
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@@ -59,7 +61,7 @@ public class RequirementItem
|
||||
@Column(name = "TOTAL", precision=15, scale=4)
|
||||
private BigDecimal total;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
@Field(index = Index.YES, analyze = Analyze.YES)
|
||||
private String description;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@@ -42,7 +44,7 @@ public abstract class RequirementSubject implements OwnedDataModel {
|
||||
private String code;
|
||||
@Column(name = "NAME")
|
||||
private String name;
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
|
||||
@NotEmpty(message = "{MaterialFormCodeConstr}")
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OrderBy;
|
||||
@@ -22,7 +24,7 @@ public class RequirementType extends BaseData {
|
||||
|
||||
@Column(name = "TYPE")
|
||||
private String type;
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval=true)
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +27,7 @@ public class Role extends BaseSimpleData implements GrantedAuthority, DataModel
|
||||
|
||||
@Column(name="AUTHORITY", unique=true)
|
||||
private String authority;
|
||||
@Column(name="DESCRIPTION")
|
||||
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
@ManyToMany
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -33,7 +35,7 @@ public class TripBillItem extends BaseData {
|
||||
@Embedded
|
||||
@AttributeOverrides({
|
||||
@AttributeOverride(name = "code", column = @Column(name = "BACK_VEHICLE_CODE")),
|
||||
@AttributeOverride(name = "description", column = @Column(name = "BACK_VEHICLE_DESCRIPTION"))
|
||||
@AttributeOverride(name = "description", column = @Column(name = "BACK_VEHICLE_DESCRIPTION", length = Constants.LEN_DESCRIPTION))
|
||||
})
|
||||
private Vehicle backVehicle;
|
||||
@Column(name = "BEGIN_WORK")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@@ -8,7 +10,7 @@ public class Vehicle {
|
||||
|
||||
@Column(name = "VEHICLE_CODE")
|
||||
private String code;
|
||||
@Column(name = "VEHICLE_DESCRIPTION")
|
||||
@Column(name = "VEHICLE_DESCRIPTION", length = Constants.LEN_DESCRIPTION)
|
||||
private String description;
|
||||
|
||||
public String getCode() {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package info.bukova.isspst.services.dbinfo;
|
||||
|
||||
import info.bukova.isspst.data.DbInfo;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface DbInfoService extends Service<DbInfo>
|
||||
{
|
||||
public void changeDatabase();
|
||||
|
||||
public void updateDatabaseVersion();
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package info.bukova.isspst.services.dbinfo;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.data.DbInfo;
|
||||
import info.bukova.isspst.services.AbstractService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfoService
|
||||
{
|
||||
private DbInfo getDbInfo()
|
||||
{
|
||||
DbInfo dbInfo = null;
|
||||
|
||||
List<DbInfo> list = this.getAll();
|
||||
|
||||
if (list.isEmpty())
|
||||
{
|
||||
dbInfo = new DbInfo();
|
||||
this.add(dbInfo);
|
||||
list = this.getAll();
|
||||
}
|
||||
|
||||
for (DbInfo item : list)
|
||||
{
|
||||
dbInfo = item;
|
||||
break;
|
||||
}
|
||||
|
||||
return dbInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void changeDatabase()
|
||||
{
|
||||
class Str2Str
|
||||
{
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
public Str2Str(String key, String value)
|
||||
{
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getKey()
|
||||
{
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
long dbVersion = this.getDbInfo().getVersion();
|
||||
|
||||
if (Constants.DB_VERSION > dbVersion)
|
||||
{
|
||||
if (dbVersion < 1)
|
||||
{
|
||||
List<Str2Str> tables = new ArrayList<Str2Str>();
|
||||
tables.add(new Str2Str("address", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("building", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("material", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("munit", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("order_item", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("permission", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirement", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirementtype", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirement_items", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("role", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("service", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("triprequirement", "DESCRIPTION"));
|
||||
|
||||
tables.add(new Str2Str("material", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "INVOICE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "DELIVERY_DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "SUPPLIER_DESCRIPTION"));
|
||||
tables.add(new Str2Str("order_item", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirement_items", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("triprequirement", "VEHICLE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("trip_bill_items", "BACK_VEHICLE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("trip_bill_items", "VEHICLE_DESCRIPTION"));
|
||||
|
||||
SQLQuery sq = null;
|
||||
String sql = "";
|
||||
|
||||
for (Str2Str item : tables)
|
||||
{
|
||||
sql = "ALTER TABLE " + item.getKey() + " MODIFY " + item.getValue() + " VARCHAR(" + String.valueOf(Constants.LEN_DESCRIPTION) + ")";
|
||||
sq = this.dao.getSession().createSQLQuery(sql);
|
||||
sq.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
this.updateDatabaseVersion();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateDatabaseVersion()
|
||||
{
|
||||
DbInfo dbInfo = this.getDbInfo();
|
||||
dbInfo.setVersion(Constants.DB_VERSION);
|
||||
this.update(dbInfo);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.bukova.isspst.ui;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -39,6 +40,16 @@ public class DocumentViewModel
|
||||
this.standardBoolConverter = standardBoolConverter;
|
||||
}
|
||||
|
||||
final public int getLengthText()
|
||||
{
|
||||
return Constants.LEN_TEXT;
|
||||
}
|
||||
|
||||
final public int getLengthDescription()
|
||||
{
|
||||
return Constants.LEN_DESCRIPTION;
|
||||
}
|
||||
|
||||
@Init
|
||||
public void initDocumentViewModel()
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ import info.bukova.isspst.reporting.GeneratorFactory;
|
||||
import info.bukova.isspst.reporting.ReportDefinition;
|
||||
import info.bukova.isspst.services.addressbook.AdbService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -27,7 +28,8 @@ import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class MailForm {
|
||||
public class MailForm extends DocumentViewModel
|
||||
{
|
||||
|
||||
@WireVariable
|
||||
private Mailer mailer;
|
||||
@@ -52,7 +54,7 @@ public class MailForm {
|
||||
private int adbType;
|
||||
private String findAddress;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init(@ExecutionArgParam("report") Boolean report) {
|
||||
message = new MailMessage();
|
||||
message.setHtml(true);
|
||||
|
||||
@@ -4,6 +4,7 @@ import info.bukova.isspst.reporting.Report;
|
||||
import info.bukova.isspst.reporting.ReportDefinition;
|
||||
import info.bukova.isspst.reporting.ReportType;
|
||||
import info.bukova.isspst.sort.ReflectionTools;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
import info.bukova.isspst.ui.ListChecks;
|
||||
import info.bukova.isspst.ui.LocaleConverter;
|
||||
|
||||
@@ -12,13 +13,13 @@ import java.util.List;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class ColSelectVM {
|
||||
|
||||
public class ColSelectVM extends DocumentViewModel
|
||||
{
|
||||
@WireVariable
|
||||
private ReportDefinition reportDefinition;
|
||||
private LocaleConverter locConverter;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
locConverter = new LocaleConverter();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package info.bukova.isspst.ui.reporting;
|
||||
|
||||
import info.bukova.isspst.reporting.ReportDefinition;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class OrderOptionsVM {
|
||||
|
||||
public class OrderOptionsVM extends DocumentViewModel
|
||||
{
|
||||
private boolean printPrices;
|
||||
@WireVariable
|
||||
private ReportDefinition reportDefinition;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
printPrices = true;
|
||||
reportDefinition.setParam("SET_PRICES", true);
|
||||
|
||||
@@ -4,6 +4,7 @@ import info.bukova.isspst.reporting.Report;
|
||||
import info.bukova.isspst.reporting.ReportDefinition;
|
||||
import info.bukova.isspst.reporting.ReportType;
|
||||
import info.bukova.isspst.services.Service;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,7 +17,8 @@ import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class ReportDialogVM {
|
||||
public class ReportDialogVM extends DocumentViewModel
|
||||
{
|
||||
|
||||
private List<Report> reports;
|
||||
private Report selected;
|
||||
@@ -25,7 +27,7 @@ public class ReportDialogVM {
|
||||
private List<Object> dataList;
|
||||
private Object singleObject;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init(@ExecutionArgParam("reports") List<Report> reports,
|
||||
@ExecutionArgParam("data") List<Object> data,
|
||||
@ExecutionArgParam("singleObject") Object singleObject,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.ui.reporting;
|
||||
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -8,9 +10,9 @@ import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class ReportVM {
|
||||
|
||||
@Init
|
||||
public class ReportVM extends DocumentViewModel
|
||||
{
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package info.bukova.isspst.ui.requirement;
|
||||
|
||||
import info.bukova.isspst.data.Workflow;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
@@ -8,11 +9,11 @@ import org.zkoss.bind.annotation.ExecutionArgParam;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class LimitVM {
|
||||
|
||||
public class LimitVM extends DocumentViewModel
|
||||
{
|
||||
private Workflow workflow;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init(@ExecutionArgParam("workflow") Workflow workflow) {
|
||||
this.workflow = workflow;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package info.bukova.isspst.ui.requirement;
|
||||
|
||||
import info.bukova.isspst.data.RequirementType;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
import info.bukova.isspst.ui.ListChecks;
|
||||
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
import org.zkoss.bind.annotation.ExecutionArgParam;
|
||||
@@ -7,19 +13,14 @@ import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
import info.bukova.isspst.data.RequirementType;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.ListChecks;
|
||||
|
||||
public class OfferedCentresVM {
|
||||
|
||||
public class OfferedCentresVM extends DocumentViewModel
|
||||
{
|
||||
private RequirementType selectedType;
|
||||
@WireVariable
|
||||
private WorkgroupService workgroupService;
|
||||
private ListChecks<Workgroup> wgChecks;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init(@ExecutionArgParam("type") RequirementType type) {
|
||||
this.selectedType = type;
|
||||
wgChecks = new ListChecks<Workgroup>(selectedType.getOfferedCentres(), workgroupService.getCentres());
|
||||
|
||||
@@ -9,6 +9,7 @@ import info.bukova.isspst.mail.MailMessage;
|
||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||
import info.bukova.isspst.sort.ReflectionTools;
|
||||
import info.bukova.isspst.storage.FileStorage;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
import info.bukova.isspst.ui.LocaleConverter;
|
||||
import info.bukova.isspst.ui.SecurityHelper;
|
||||
|
||||
@@ -31,7 +32,8 @@ import org.zkoss.zk.ui.event.UploadEvent;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class GlobalSettingsVM {
|
||||
public class GlobalSettingsVM extends DocumentViewModel
|
||||
{
|
||||
|
||||
@WireVariable
|
||||
private GlobalSettingsService settingsService;
|
||||
@@ -42,7 +44,7 @@ public class GlobalSettingsVM {
|
||||
@WireVariable
|
||||
private FileStorage storage;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
settings = settingsService.getSettings();
|
||||
locConverter = new LocaleConverter();
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package info.bukova.isspst.ui.settings;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.Module;
|
||||
import info.bukova.isspst.ModuleUtils;
|
||||
import info.bukova.isspst.data.NumberSeries;
|
||||
import info.bukova.isspst.services.numberseries.NumberSeriesService;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -16,14 +18,15 @@ import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class NumberSeriesVM {
|
||||
public class NumberSeriesVM extends DocumentViewModel
|
||||
{
|
||||
|
||||
@WireVariable
|
||||
private NumberSeriesService numericSeriesService;
|
||||
private List<NumberSeries> numberSeriesList;
|
||||
private Map<String, Module> moduleMap;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
numberSeriesList = new ArrayList<NumberSeries>(numericSeriesService.getAll());
|
||||
moduleMap = new HashMap<String, Module>();
|
||||
|
||||
@@ -3,6 +3,7 @@ package info.bukova.isspst.ui.settings;
|
||||
import info.bukova.isspst.data.UserSettingsData;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.storage.FileStorage;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.IOException;
|
||||
@@ -19,15 +20,15 @@ import org.zkoss.zk.ui.event.UploadEvent;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class UserSettingsVM {
|
||||
|
||||
public class UserSettingsVM extends DocumentViewModel
|
||||
{
|
||||
@WireVariable
|
||||
private UserService userService;
|
||||
@WireVariable
|
||||
private FileStorage storage;
|
||||
private UserSettingsData settings;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
settings = userService.getUserSettings();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package info.bukova.isspst.ui.users;
|
||||
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.ui.DocumentViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
@@ -10,7 +11,8 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Messagebox;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class PasswdVM {
|
||||
public class PasswdVM extends DocumentViewModel
|
||||
{
|
||||
|
||||
private String oldPw;
|
||||
private String newPw;
|
||||
@@ -19,7 +21,7 @@ public class PasswdVM {
|
||||
@WireVariable
|
||||
private UserService userService;
|
||||
|
||||
@Init
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
user = userService.getCurrent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user