Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
70745ac
add basic goods feature structure
Apr 13, 2017
e1668e6
add minor naming changes in products feature
Apr 14, 2017
c37689a
Addition of Product entity integration tests
tgnv Apr 16, 2017
3e92977
some test changes
tgnv Apr 18, 2017
51006bf
Some minor changes
tgnv Apr 18, 2017
57e38ab
Next Minor changes
tgnv Apr 18, 2017
fd30567
Merge branch 'development' into feature-products
Victor-IT Apr 19, 2017
d0c93f4
Addition of:
tgnv Apr 20, 2017
0aa1358
Merge remote-tracking branch 'origin/feature-products' into feature-p…
tgnv Apr 20, 2017
acddc3a
Changes in product catalog entities.
tgnv Apr 21, 2017
3580a44
Some modifications
tgnv Apr 21, 2017
160c136
Next Minor changes
tgnv Apr 21, 2017
06d3af7
Add basic product catalog and images structure
Apr 22, 2017
815b251
Added UI experiments
tgnv Apr 23, 2017
db625f7
Merge remote-tracking branch 'origin/feature-products' into feature-p…
tgnv Apr 23, 2017
8ca50b8
Merge branch 'development' into feature-products
tgnv Apr 24, 2017
eb5d67a
Merge remote-tracking branch 'origin/development' into feature-products
tgnv Apr 24, 2017
a4ee5e9
Rename of Product Catalog methods
tgnv Apr 24, 2017
34168d2
Continue rename of Product Catalog methods
tgnv Apr 25, 2017
4e71592
Add feature-product description in readme file
Apr 25, 2017
e2397bb
Merge remote-tracking branch 'origin/development' into feature-products
tgnv Apr 25, 2017
21eb094
Merge whith development branch
tgnv Apr 25, 2017
1c83c90
Merge remote-tracking branch 'origin/feature-products' into feature-p…
tgnv Apr 25, 2017
dab6a31
Creation of Product Catalog integration tests
tgnv Apr 26, 2017
e4c74ef
Continuation of product catalog integration tests development
tgnv Apr 26, 2017
dfb0a37
Continuation of Product Catalog integration tests development.
tgnv Apr 27, 2017
b42c2fa
Continuation of product catalog integration tests development
tgnv Apr 27, 2017
1444544
Completion of Product Catalog integration tests development
tgnv Apr 28, 2017
6328b3f
Import of Central Bank of the Russian Federation SOAP service WSDL.
tgnv Apr 28, 2017
d859dd9
Some modifications
tgnv Apr 28, 2017
71ed487
Some minor modifications
tgnv Apr 28, 2017
8ab443e
Change Web Service client to SurRiseSet from Central Bank of the Russ…
tgnv May 2, 2017
9686cca
Continuation of sex with Web Service client for Central Bank of the R…
tgnv May 3, 2017
d6d531b
Add DevExtreme JS Framework to Product Catalog UI.
tgnv May 4, 2017
958325f
Creating ProductCatalog UI with DevExtreme JS Framework
tgnv May 5, 2017
5e097b8
Product Catalog UI development continuation. Round 2.
tgnv May 7, 2017
55521f7
Product Catalog UI development continuation. Round 3.
tgnv May 11, 2017
d8e7206
Product Catalog UI development continuation. Round 4.
tgnv Jun 14, 2017
98f806c
Creating ProductCatalog UI with jQuery
tgnv Jun 15, 2017
a472fa0
Creating ProductCatalog UI with jQuery. Round 5
tgnv Jun 16, 2017
6b269f4
Creating ProductCatalog UI with jQuery. Round 5
tgnv Jun 19, 2017
063fd36
Creating ProductCatalog UI with jQuery. Round 6
tgnv Jun 20, 2017
f55e3f4
Creating ProductCatalog UI with jQuery. Round 7.
tgnv Jun 21, 2017
87e45fb
Creating ProductCatalog UI with jQuery. Round 8.
tgnv Jun 30, 2017
5588360
Creating ProductCatalog UI with jQuery. Round 9.
tgnv Jul 3, 2017
e5e7c1f
Product catalog section CRUD realise.
tgnv Jul 4, 2017
1c0f40d
remove duplicates in POM
Victor-IT Jul 6, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/out/
/target/
/classes/
.DS_Store
94 changes: 93 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,96 @@ ______
- ***BasicDao** - дженерик интерфейс, описывающий базовые CRUD-операции.*
- ***CustomerDao** - интерфейс, унаследованный от BasicDao и расширяющий его функционал дополнительными методами взаимодействия сущности заказчика с базой данных*

#### *To be continued...*
#### *To be continued...*

## Feature products

Функционал отвечает за управление сущностями товаров и связанных с ними сущностями изображений товаров и разделов каталога товаров.

*Реализован на уровнях:*
- [**Entity**](#product_entity)
- [**Dao**](#product_dao)
- [**Service**](#product_service)
- [**Controller**](#product_controller)

### <a name = "product_entity"></a> Product entities

Включают в себя следующие сущности, представленные одноименными java классами:

* **Product** - товар
* **ProductCatalogSection** - раздел каталога товаров
* **ProductImage** - изображение, связанное с товаром

Каждое поле имеет соответсвующие getter и setter.
##### Product.java
- `long id`
- `String name`
- `int price`
- `String description`
- `ProductCatalogSection productCatalogSection` - @ManyToOne
- `List<ProductImage> images` - @OneToMany

##### ProductCatalogSection.java
- `long id`
- `String name`
- `List<Product> products` - @OneToMany

##### ProductImage
- `long id`
- `Product product` - @ManyToOne
- `byte[] image`

### <a name = "product_dao"></a> Product DAOs

Представлены следующими DAO, каждый из которых является расширением базового **BasicDao**:

* **ProductDao** имеет следующие специфичные методы
- `List<Product> findByName(String name)`
- `List<Product> findByPriceRange(int min, int max)`
- `List<Product> findByCatalogSectionId(long sectionId)`

* **ProductCatalogSectionDao**
* **ProductImageDao**

### <a name = "product_service"> </a> Product service

- `List<Product> getAllProducts()`
- `List<Product> getProductsByName(String name)`
- `Product addProduct(Product product)`
- `Product updateProduct(Product product)`
- `Product deleteProduct(long id)`
- `Product getProductById(long id)`
- `List<Product> getProductsByPriceRange(int min, int max)`
- `List<Product> getProductsByCatalogSectionId(long sectionId)`
- `List<ProductCatalogSection> getAllCatalogSections()`
- `ProductCatalogSection addCatalogSection(ProductCatalogSection section)`
- `ProductCatalogSection getCatalogSectionById(long sectionId)`
- `ProductCatalogSection updateCatalogSection(ProductCatalogSection section)`
- `ProductCatalogSection deleteCatalogSection(long sectionId)`
- `List<ProductImage> getImagesByProductId(long id)`
- `ProductImage addImage(ProductImage image)`
- `ProductImage deleteImage(long imageId)`
- `ProductImage getImageById(long imageId)`

### <a name = "product_controller"> </a> Product controller
Mapped to "/products":
##### Function mappings:
- `List<Product> getAllProducts()` - "/getAllProducts"
- `List<Product> getProductsByName(@PathVariable(value = "name") String name)` - "/getProductsByName/{name}"
- `Product addProduct(@RequestBody Product product)` - "/addProduct"
- `Product updateProduct(@RequestBody Product product)` - "/updateProduct"
- `Product deleteProduct(@PathVariable(value = "id") String inputId)` - "/deleteProduct/{id}"
- `Product getProductById(@PathVariable(value = "id") String id)`- "/getProductById/{id}"
- `List<Product> getProductsByPriceRange(@PathVariable(value = "min") int min, @PathVariable(value = "max") int max)` - "/getProductsByPriceRange/{min}/{max}"
- `List<Product> getProductsByCatalogSectionId(@PathVariable(value = "id") String id)` - "/getProductsByCatalogSectionId/{id}"
- `String showProductImageUploadForm()` - "/images/add"
- `String showProductImage()` - "/images/show"
- `Long uploadProductImage(@RequestParam("file") MultipartFile file, @RequestParam("productId") String productId)` - "/images/upload"
- `Long deleteImage(@PathVariable(value = "id") String inputId)` - "/deleteImage/{id}"
- `List<Long> getImageIdsByProductId(@PathVariable(value = "id") String productId)` - "/getImageIdsByProductId/{id}"
- `byte[] getImageById(@PathVariable(value = "id")` - "/getImageById/{id}"
- `List<ProductCatalogSection> getAllCatalogSections()` - "/getAllCatalogSections"
- `ProductCatalogSection addCatalogSection(@RequestBody ProductCatalogSection section)` - "/addCatalogSection"
- `ProductCatalogSection updateCatalogSection(@RequestBody ProductCatalogSection section)` - "/updateCatalogSection"
- `ProductCatalogSection deleteCatalogSection(@PathVariable(value = "id") String inputId)` - "deleteCatalogSection/{id}"
- `ProductCatalogSection getCatalogSectionById(@PathVariable(value = "id") String id)` - "/getCatalogSectionById/{id}"
22 changes: 14 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
Expand All @@ -63,6 +58,11 @@
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down Expand Up @@ -127,10 +127,16 @@
<version>2.7.22</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>

</dependencies>

<build>
Expand Down
21 changes: 19 additions & 2 deletions src/main/java/io/delivery/config/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

@Configuration
@PropertySource(value = {"classpath:util.properties"})
Expand Down Expand Up @@ -97,6 +98,22 @@ public DocumentDao documentDao() {
return new DocumentDaoImpl(Document.class);
}

@Bean
ProductDao productDao() {
return new ProductDaoImpl(Product.class);
}

@Bean
ProductCatalogSectionDao productCatalogSectionDao() {
return new ProductCatalogSectionDaoImpl(ProductCatalogSection.class);
}

@Bean
ProductImageDao productImageDao() { return new ProductImageDaoImpl(ProductImage.class);}

@Bean
CommonsMultipartResolver multipartResolver() {return new CommonsMultipartResolver();}

@Bean
public NewsCreator newsCreator() {
return new NewsCreatorImpl(jdbcTemplate());
Expand All @@ -113,12 +130,12 @@ NoRegistrationCustomerDao noRegistrationCustomerDao() {
}

@Bean
public OfficeDao officeDao() {
public OfficeDao officeDao(){
return new OfficeDaoImpl(Office.class);
}

@Bean
public CustomerDao customerDao() {
CustomerDao customerDao() {
return new CustomerDaoImpl(Customer.class);
}

Expand Down
5 changes: 4 additions & 1 deletion src/main/java/io/delivery/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ protected void configure(HttpSecurity http) throws Exception {
.antMatchers("/").permitAll()
.antMatchers("/secure").access("hasRole('ADMIN')")
.antMatchers("/dump").access("hasRole('ADMIN')")
.and().csrf().disable().formLogin().defaultSuccessUrl("/", false);
.and().csrf().disable()
.formLogin().defaultSuccessUrl("/", false);
// .and().httpBasic();
// .and().sessionManagement().disable();
}

}
9 changes: 9 additions & 0 deletions src/main/java/io/delivery/config/WebAppInitializer.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package io.delivery.config;

import io.delivery.config.application.WebConfig;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

import javax.servlet.Filter;

public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

@Override
Expand All @@ -19,4 +22,10 @@ protected Class<?>[] getServletConfigClasses() {
protected String[] getServletMappings() {
return new String[]{"/"};
}

@Override
protected Filter[] getServletFilters() {
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding("utf-8");
return new Filter[]{characterEncodingFilter}; }
}
5 changes: 5 additions & 0 deletions src/main/java/io/delivery/controller/AppController.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public String getDocumentInfo() {
return "document";
}

@RequestMapping(value = "/productCatalog")
public String showProductCatalog() {
return "productCatalog";
}

@RequestMapping(value = {"/word/{check}"}, method = RequestMethod.GET)
public ModelAndView checkWord(@PathVariable("check") String check) throws IOException, SOAPException {
ModelAndView modelAndView = new ModelAndView();
Expand Down
Loading