- •1 Постановка задачи
- •1.1 Требования к разрабатываемому по
- •1.1.1 Требования пользователя
- •1.1.2 Требования к по
- •Интерфейс системы должен быть реализован на английском языке.
- •4 Архитектурное и детальное проектирование по.
- •4.1 Архитектурное проектирование
- •2 Анализ требований
- •2.1 Описание концептуальной модели
- •2.2 Словарь предметной области
- •2.3 Основные прецеденты использования по
- •Пользовательский интерфейс
- •4.4.2 Проектирование серверной части по
- •5 Проверка работоспособности по
- •Литература
- •Приложения Приложение а. Листинг исходного кода sql-спринтов для создания базы данных
- •Приложение б. Листинги исходных кодов классов клиентской части по Классы-сущности
- •Слой доступа к данным
- •Классы пользовательского интерфейса
Литература
1 Кей С.Хорстманн, Гари Корнелл Библиотека профессионала Java 1,2 том – М:Издательский дом «Вильямс»,2002, 1120стр.
2 Swing руководство для начинающих - М:Издательский дом «Вильямс»,2007, 697стр.
3 С.Орлик Многоуровневые модели в архитектуре клиент-сервер http://ods.com.ua/win/rus/db/kbd97/22.htm
Приложения Приложение а. Листинг исходного кода sql-спринтов для создания базы данных
create table ADMIN.Employee
(
Id int Primary Key NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
Name varchar(100) not null CHECK(LENGTH(Name) > 0),
CONSTRAINT UK_Employee_Name UNIQUE (Name)
);
create table ADMIN.Product
(
Id int Primary Key NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
Name varchar(100) not null CHECK(LENGTH(Name) > 0),
Manufacturer varchar(100),
QuantityInStock int not null default 0,
CONSTRAINT UK_Product_Name UNIQUE (Name)
);
create table ADMIN.Shipment
(
Id int Primary Key NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
ProductId int not null,
Quantity int not null,
DateTime Timestamp,
ResponsiblePersonId int not null,
CONSTRAINT FK_Shiment_Product Foreign Key (ProductId) References Product(Id),
CONSTRAINT FK_Shiment_Employee Foreign Key (ResponsiblePersonId) References Employee(Id)
);
insert into ADMIN.EMPLOYEE (Name)
values ('James Winkles');
insert into ADMIN.EMPLOYEE (Name)
values ('John Snipes');
insert into ADMIN.EMPLOYEE (Name)
values ('Gregory House');
insert into ADMIN.EMPLOYEE (Name)
values ('Jessica Gamilton');
insert into ADMIN.EMPLOYEE (Name)
values ('Sarah Daniels');
insert into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock)
values ('Strepsils', 'Ecoemical Inc.', 500);
insert into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock)
values ('Tera Flu', 'Bio Pharm', 700);
insert into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock)
values ('Vikodin', 'Biogeticals', 300);
insert into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock)
values ('Coldrex', 'Green Generation', 1000);
insert into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock)
values ('Ascorbic acid', 'Ecoemical Inc.', 2000);
insert into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId)
values (1, 200, TIMESTAMP('20.03.2011', '12:00:00'), 1);
insert into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId)
values (2, 400, TIMESTAMP('20.03.2011', '13:00:00'), 1);
insert into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId)
values (1, 100, TIMESTAMP('20.03.2011', '14:00:00'), 3);
insert into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId)
values (3, 300, TIMESTAMP('20.03.2011', '15:00:00'), 2);
insert into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId)
values (5, 500, TIMESTAMP('20.03.2011', '16:00:00'), 5);
Приложение б. Листинги исходных кодов классов клиентской части по Классы-сущности
package Entities;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
*
* @author Humanity
*/
@Entity
@Table(name = "EMPLOYEE")
@NamedQueries({@NamedQuery(name = "Employee.findAll", query = "SELECT e FROM Employee e"), @NamedQuery(name = "Employee.findById", query = "SELECT e FROM Employee e WHERE e.id = :id"), @NamedQuery(name = "Employee.findByName", query = "SELECT e FROM Employee e WHERE e.name = :name")})
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false)
@Column(name = "NAME")
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "responsiblepersonid")
private List<Shipment> shipmentList;
public Employee() {
}
public Employee(Integer id) {
this.id = id;
}
public Employee(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Shipment> getShipmentList() {
return shipmentList;
}
public void setShipmentList(List<Shipment> shipmentList) {
this.shipmentList = shipmentList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Employee)) {
return false;
}
Employee other = (Employee) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return name;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Entities;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
*
* @author Humanity
*/
@Entity
@Table(name = "PRODUCT")
@NamedQueries({@NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"), @NamedQuery(name = "Product.findById", query = "SELECT p FROM Product p WHERE p.id = :id"), @NamedQuery(name = "Product.findByName", query = "SELECT p FROM Product p WHERE p.name = :name"), @NamedQuery(name = "Product.findByManufacturer", query = "SELECT p FROM Product p WHERE p.manufacturer = :manufacturer"), @NamedQuery(name = "Product.findByQuantityinstock", query = "SELECT p FROM Product p WHERE p.quantityinstock = :quantityinstock")})
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false)
@Column(name = "NAME")
private String name;
@Column(name = "MANUFACTURER")
private String manufacturer;
@Basic(optional = false)
@Column(name = "QUANTITYINSTOCK")
private int quantityinstock;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productid")
private List<Shipment> shipmentList;
public Product() {
}
public Product(Integer id) {
this.id = id;
this.shipmentList = new ArrayList<Shipment>();
}
public Product(Integer id, String name, int quantityinstock) {
this.id = id;
this.name = name;
this.quantityinstock = quantityinstock;
this.shipmentList = new ArrayList<Shipment>();
}
public Product(Integer id, String name, String manufacturer, int quantityinstock) {
this.id = id;
this.name = name;
this.manufacturer = manufacturer;
this.quantityinstock = quantityinstock;
this.shipmentList = new ArrayList<Shipment>();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public int getQuantityinstock() {
return quantityinstock;
}
public void setQuantityinstock(int quantityinstock) {
this.quantityinstock = quantityinstock;
}
public List<Shipment> getShipmentList() {
return shipmentList;
}
public void setShipmentList(List<Shipment> shipmentList) {
this.shipmentList = shipmentList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Product)) {
return false;
}
Product other = (Product) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return name;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author Humanity
*/
@Entity
@Table(name = "SHIPMENT")
@NamedQueries({@NamedQuery(name = "Shipment.findAll", query = "SELECT s FROM Shipment s"), @NamedQuery(name = "Shipment.findById", query = "SELECT s FROM Shipment s WHERE s.id = :id"), @NamedQuery(name = "Shipment.findByQuantity", query = "SELECT s FROM Shipment s WHERE s.quantity = :quantity"), @NamedQuery(name = "Shipment.findByDatetime", query = "SELECT s FROM Shipment s WHERE s.datetime = :datetime")})
public class Shipment implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false)
@Column(name = "QUANTITY")
private int quantity;
@Column(name = "DATETIME")
@Temporal(TemporalType.TIMESTAMP)
private Date datetime;
@JoinColumn(name = "RESPONSIBLEPERSONID", referencedColumnName = "ID")
@ManyToOne(optional = false)
private Employee responsiblepersonid;
@JoinColumn(name = "PRODUCTID", referencedColumnName = "ID")
@ManyToOne(optional = false)
private Product productid;
public Shipment() {
}
public Shipment(Integer id) {
this.id = id;
}
public Shipment(Integer id, int quantity) {
this.id = id;
this.quantity = quantity;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public Date getDatetime() {
return datetime;
}
public void setDatetime(Date datetime) {
this.datetime = datetime;
}
public Employee getResponsiblepersonid() {
return responsiblepersonid;
}
public void setResponsiblepersonid(Employee responsiblepersonid) {
this.responsiblepersonid = responsiblepersonid;
}
public Product getProductid() {
return productid;
}
public void setProductid(Product productid) {
this.productid = productid;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Shipment)) {
return false;
}
Shipment other = (Shipment) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "Entities.Shipment[id=" + id + "]";
}
}
