Skip to content

Commit 6004f97

Browse files
committed
Merge branch 'release/v1.0'
2 parents 94bbaec + 762dc2b commit 6004f97

File tree

105 files changed

+4440
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+4440
-9
lines changed

pom.xml

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
<inceptionYear>2017</inceptionYear>
2121

2222
<properties>
23-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24-
<maven.compiler.source>1.8</maven.compiler.source>
25-
<maven.compiler.target>1.8</maven.compiler.target>
26-
<java.version>1.8</java.version>
27-
</properties>
23+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24+
<maven.compiler.source>1.8</maven.compiler.source>
25+
<maven.compiler.target>1.8</maven.compiler.target>
26+
<java.version>1.8</java.version>
27+
<cucumber.java.version>1.2.5</cucumber.java.version>
28+
<commons-io.version>1.3.2</commons-io.version>
29+
</properties>
2830

2931
<contributors>
3032
<contributor>
@@ -45,17 +47,94 @@
4547
<artifactId>spring-boot-starter-data-jpa</artifactId>
4648
</dependency>
4749

48-
<!-- MYSQL -->
50+
<!-- DATABASE -->
4951
<dependency>
5052
<groupId>mysql</groupId>
5153
<artifactId>mysql-connector-java</artifactId>
54+
<scope>runtime</scope>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.hsqldb</groupId>
58+
<artifactId>hsqldb</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
62+
<!-- SLF4J -->
63+
<dependency>
64+
<groupId>org.slf4j</groupId>
65+
<artifactId>slf4j-api</artifactId>
5266
</dependency>
5367

5468
<!-- TEST -->
5569
<dependency>
5670
<groupId>org.springframework.boot</groupId>
5771
<artifactId>spring-boot-starter-test</artifactId>
5872
</dependency>
73+
<dependency>
74+
<groupId>org.assertj</groupId>
75+
<artifactId>assertj-core</artifactId>
76+
<scope>test</scope>
77+
</dependency>
78+
<dependency>
79+
<groupId>junit</groupId>
80+
<artifactId>junit</artifactId>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.mockito</groupId>
84+
<artifactId>mockito-core</artifactId>
85+
</dependency>
86+
87+
<!-- CUCUMBER -->
88+
<dependency>
89+
<groupId>info.cukes</groupId>
90+
<artifactId>cucumber-core</artifactId>
91+
<version>${cucumber.java.version}</version>
92+
<scope>test</scope>
93+
</dependency>
94+
95+
<dependency>
96+
<groupId>info.cukes</groupId>
97+
<artifactId>cucumber-java</artifactId>
98+
<version>${cucumber.java.version}</version>
99+
<scope>test</scope>
100+
</dependency>
101+
102+
<dependency>
103+
<groupId>info.cukes</groupId>
104+
<artifactId>cucumber-junit</artifactId>
105+
<version>${cucumber.java.version}</version>
106+
<scope>test</scope>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>info.cukes</groupId>
111+
<artifactId>cucumber-spring</artifactId>
112+
<version>${cucumber.java.version}</version>
113+
<scope>test</scope>
114+
</dependency>
115+
116+
<!-- UTILS -->
117+
<dependency>
118+
<groupId>org.apache.commons</groupId>
119+
<artifactId>commons-io</artifactId>
120+
<version>${commons-io.version}</version>
121+
</dependency>
122+
<dependency>
123+
<groupId>commons-lang</groupId>
124+
<artifactId>commons-lang</artifactId>
125+
<version>2.6</version>
126+
</dependency>
127+
<dependency>
128+
<groupId>org.projectlombok</groupId>
129+
<artifactId>lombok</artifactId>
130+
<version>1.16.16</version>
131+
<scope>provided</scope>
132+
</dependency>
133+
<dependency>
134+
<groupId>ma.glasnost.orika</groupId>
135+
<artifactId>orika-core</artifactId>
136+
<version>1.4.2</version><!-- or latest version -->
137+
</dependency>
59138
</dependencies>
60139

61140
<build>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package fr.anthonygodin.api.controller;
2+
3+
import fr.anthonygodin.api.dto.DTO;
4+
import fr.anthonygodin.api.dto.entity.EntityDTO;
5+
import fr.anthonygodin.api.dto.params.PageParams;
6+
import fr.anthonygodin.api.dto.util.PageableFactory;
7+
import fr.anthonygodin.api.exception.NotFoundException;
8+
import fr.anthonygodin.api.service.CrudService;
9+
import org.slf4j.Logger;
10+
import org.springframework.data.domain.Page;
11+
import org.springframework.data.domain.Pageable;
12+
import org.springframework.http.HttpStatus;
13+
import org.springframework.validation.annotation.Validated;
14+
import org.springframework.web.bind.annotation.*;
15+
16+
import javax.validation.Valid;
17+
import java.util.List;
18+
19+
/**
20+
* Created by agodin on 26/03/17.
21+
*/
22+
public abstract class CrudController<EDTO extends EntityDTO, ToCreateDTO extends DTO> {
23+
24+
protected abstract Logger getLogger();
25+
protected abstract CrudService<EDTO, ToCreateDTO> getService();
26+
27+
@PostMapping
28+
@ResponseStatus(HttpStatus.CREATED)
29+
public List<EDTO> create(@Validated @RequestBody List<ToCreateDTO> entityToCreateDTOList) {
30+
getLogger().debug("REST request to create entity : {}", entityToCreateDTOList);
31+
List<EDTO> entities = getService().create(entityToCreateDTOList);
32+
return entities;
33+
}
34+
35+
@DeleteMapping(value = "/{id}")
36+
@ResponseStatus(HttpStatus.NO_CONTENT)
37+
public void delete(@PathVariable("id") String id) throws NotFoundException {
38+
getLogger().debug("REST request to delete entity : {}", id);
39+
getService().delete(id);
40+
}
41+
42+
@GetMapping
43+
@ResponseStatus(HttpStatus.OK)
44+
public Page<EDTO> findAll(@Valid PageParams pageParams) {
45+
getLogger().debug("REST request to find all entities");
46+
Pageable pageable = PageableFactory.getPage(pageParams);
47+
Page<EDTO> response = getService().findAll(pageable);
48+
return response;
49+
}
50+
51+
@GetMapping(value = "/{id}")
52+
@ResponseStatus(HttpStatus.OK)
53+
public EDTO findById(@PathVariable("id") String id) throws NotFoundException {
54+
getLogger().debug("REST request to find entity by id : {}", id);
55+
EDTO entity = getService().findById(id);
56+
return entity;
57+
}
58+
59+
@PutMapping(value = "/{id}")
60+
@ResponseStatus(HttpStatus.OK)
61+
public EDTO update(
62+
@PathVariable("id") String id,
63+
@Validated @RequestBody ToCreateDTO entityToCreateDTO
64+
) throws NotFoundException {
65+
getLogger().debug("REST request to update entity : {}", entityToCreateDTO);
66+
EDTO entityDTO = getService().update(id, entityToCreateDTO);
67+
return entityDTO;
68+
}
69+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package fr.anthonygodin.api.controller;
2+
3+
import fr.anthonygodin.api.dto.entity.ExperienceDTO;
4+
import fr.anthonygodin.api.dto.entity.ExperienceToCreateDTO;
5+
import fr.anthonygodin.api.service.CrudService;
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
13+
/**
14+
* Created by AnthoGdn on 27/03/17.
15+
*/
16+
@RestController
17+
@RequestMapping("api/experiences")
18+
public class ExperienceController extends CrudController<ExperienceDTO, ExperienceToCreateDTO> {
19+
20+
private static final Logger LOGGER = LoggerFactory.getLogger(ExperienceController.class);
21+
22+
@Autowired
23+
private CrudService<ExperienceDTO, ExperienceToCreateDTO> experienceService;
24+
25+
@Override
26+
protected Logger getLogger() {
27+
return LOGGER;
28+
}
29+
@Override
30+
protected CrudService getService() {
31+
return experienceService;
32+
}
33+
}
34+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package fr.anthonygodin.api.controller;
2+
3+
import fr.anthonygodin.api.dto.entity.InterestDTO;
4+
import fr.anthonygodin.api.dto.entity.InterestToCreateDTO;
5+
import fr.anthonygodin.api.service.CrudService;
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
13+
/**
14+
* Created by AnthoGdn on 26/03/17.
15+
*/
16+
@RestController
17+
@RequestMapping("api/interests")
18+
public class InterestController extends CrudController<InterestDTO, InterestToCreateDTO> {
19+
20+
private static final Logger LOGGER = LoggerFactory.getLogger(InterestController.class);
21+
22+
@Autowired
23+
private CrudService<InterestDTO, InterestToCreateDTO> interestService;
24+
25+
@Override
26+
protected Logger getLogger() {
27+
return LOGGER;
28+
}
29+
@Override
30+
protected CrudService getService() {
31+
return interestService;
32+
}
33+
}
34+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package fr.anthonygodin.api.controller;
2+
3+
import fr.anthonygodin.api.dto.entity.LanguageDTO;
4+
import fr.anthonygodin.api.dto.entity.LanguageToCreateDTO;
5+
import fr.anthonygodin.api.service.CrudService;
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
13+
/**
14+
* Created by AnthoGdn on 15/03/17.
15+
*/
16+
@RestController
17+
@RequestMapping("api/languages")
18+
public class LanguageController extends CrudController<LanguageDTO, LanguageToCreateDTO> {
19+
20+
private static final Logger LOGGER = LoggerFactory.getLogger(LanguageController.class);
21+
22+
@Autowired
23+
private CrudService<LanguageDTO, LanguageToCreateDTO> languageService;
24+
25+
@Override
26+
protected Logger getLogger() {
27+
return LOGGER;
28+
}
29+
@Override
30+
protected CrudService getService() {
31+
return languageService;
32+
}
33+
}
34+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package fr.anthonygodin.api.controller;
2+
3+
import fr.anthonygodin.api.dto.entity.ProjectDTO;
4+
import fr.anthonygodin.api.dto.entity.ProjectToCreateDTO;
5+
import fr.anthonygodin.api.service.CrudService;
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
/**
13+
* Created by AnthoGdn on 27/03/17.
14+
*/
15+
@RestController
16+
@RequestMapping("api/projects")
17+
public class ProjectController extends CrudController<ProjectDTO, ProjectToCreateDTO> {
18+
19+
private static final Logger LOGGER = LoggerFactory.getLogger(ProjectController.class);
20+
21+
@Autowired
22+
private CrudService<ProjectDTO, ProjectToCreateDTO> projectService;
23+
24+
@Override
25+
protected Logger getLogger() {
26+
return LOGGER;
27+
}
28+
@Override
29+
protected CrudService getService() {
30+
return projectService;
31+
}
32+
}
33+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package fr.anthonygodin.api.controller;
2+
3+
import fr.anthonygodin.api.dto.entity.ToolDTO;
4+
import fr.anthonygodin.api.dto.entity.ToolToCreateDTO;
5+
import fr.anthonygodin.api.service.CrudService;
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
/**
13+
* Created by AnthoGdn on 26/03/17.
14+
*/
15+
@RestController
16+
@RequestMapping("api/tools")
17+
public class ToolController extends CrudController<ToolDTO, ToolToCreateDTO> {
18+
19+
private static final Logger LOGGER = LoggerFactory.getLogger(ToolController.class);
20+
21+
@Autowired
22+
private CrudService<ToolDTO, ToolToCreateDTO> toolService;
23+
24+
@Override
25+
protected Logger getLogger() {
26+
return LOGGER;
27+
}
28+
@Override
29+
protected CrudService getService() {
30+
return toolService;
31+
}
32+
}
33+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package fr.anthonygodin.api.controller;
2+
3+
import fr.anthonygodin.api.dto.entity.TrainingDTO;
4+
import fr.anthonygodin.api.dto.entity.TrainingToCreateDTO;
5+
import fr.anthonygodin.api.service.CrudService;
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
/**
13+
* Created by AnthoGdn on 26/03/17.
14+
*/
15+
@RestController
16+
@RequestMapping("api/trainings")
17+
public class TrainingController extends CrudController<TrainingDTO, TrainingToCreateDTO> {
18+
19+
private static final Logger LOGGER = LoggerFactory.getLogger(TrainingController.class);
20+
21+
@Autowired
22+
private CrudService<TrainingDTO, TrainingToCreateDTO> trainingService;
23+
24+
@Override
25+
protected Logger getLogger() {
26+
return LOGGER;
27+
}
28+
@Override
29+
protected CrudService getService() {
30+
return trainingService;
31+
}
32+
}
33+

src/main/java/fr/anthonygodin/api/dao/.gitkeep

Whitespace-only changes.

src/main/java/fr/anthonygodin/api/domain/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)