Commit 19eb4d26a18c23c616fb76a1f7e66b84ba4ba688
1 parent
ed186bbb
Petites modifications des familles
Showing
6 changed files
with
26 additions
and
5 deletions
Show diff stats
... | ... | @@ -0,0 +1,19 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project version="4"> | |
3 | + <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> | |
4 | + <data-source source="LOCAL" name="bade@localhost" uuid="d63e2d8c-a4c6-4db5-9ff9-2f8eb96100ee"> | |
5 | + <driver-ref>mysql</driver-ref> | |
6 | + <synchronize>true</synchronize> | |
7 | + <jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver> | |
8 | + <jdbc-url>jdbc:mysql://localhost:3306/bade</jdbc-url> | |
9 | + <driver-properties> | |
10 | + <property name="autoReconnect" value="true" /> | |
11 | + <property name="zeroDateTimeBehavior" value="convertToNull" /> | |
12 | + <property name="tinyInt1isBit" value="false" /> | |
13 | + <property name="characterEncoding" value="utf8" /> | |
14 | + <property name="characterSetResults" value="utf8" /> | |
15 | + <property name="yearIsDateType" value="false" /> | |
16 | + </driver-properties> | |
17 | + </data-source> | |
18 | + </component> | |
19 | +</project> | |
0 | 20 | \ No newline at end of file | ... | ... |
etunicorn-server.iml
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | </content> |
11 | 11 | <orderEntry type="inheritedJdk" /> |
12 | 12 | <orderEntry type="sourceFolder" forTests="false" /> |
13 | + <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.6" level="project" /> | |
13 | 14 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-rest:1.4.4.RELEASE" level="project" /> |
14 | 15 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.4.4.RELEASE" level="project" /> |
15 | 16 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.4.4.RELEASE" level="project" /> | ... | ... |
src/main/java/etunicorn/Application.java
... | ... | @@ -10,6 +10,7 @@ import org.springframework.boot.SpringApplication; |
10 | 10 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
11 | 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
12 | 12 | import org.springframework.context.annotation.Bean; |
13 | +import org.springframework.context.annotation.Configuration; | |
13 | 14 | import org.springframework.jdbc.datasource.DriverManagerDataSource; |
14 | 15 | |
15 | 16 | import javax.sql.DataSource; |
... | ... | @@ -21,6 +22,7 @@ import javax.sql.DataSource; |
21 | 22 | */ |
22 | 23 | @SpringBootApplication |
23 | 24 | @EnableAutoConfiguration |
25 | +@Configuration | |
24 | 26 | public class Application { |
25 | 27 | |
26 | 28 | public static void main(String[] args) { |
... | ... | @@ -66,8 +68,8 @@ public class Application { |
66 | 68 | |
67 | 69 | // Properties additionalProperties() { |
68 | 70 | // Properties properties = new Properties(); |
69 | - // properties.setProperty("spring.jpa.hibernale.ddl-auto", "create-drop"); | |
70 | - // properties.setProperty("hibernate.hbm2ddl.auto", "create-drop"); | |
71 | + // properties.setProperty("spring.jpa.hibernate.ddl-auto", "update"); | |
72 | + // properties.setProperty("spring.jpa.database-platform", "org.hibernate.dialect.MySQL5Dialect"); | |
71 | 73 | // return properties; |
72 | 74 | // } |
73 | 75 | ... | ... |
src/main/java/etunicorn/SecurityInterceptor.java
... | ... | @@ -40,6 +40,7 @@ public class SecurityInterceptor extends HandlerInterceptorAdapter { |
40 | 40 | response.setHeader(header, headerValue); |
41 | 41 | } |
42 | 42 | } |
43 | + response.setStatus(responseEntity.getStatusCodeValue()); | |
43 | 44 | response.getWriter().write(responseEntity.getBody().toString()); |
44 | 45 | } |
45 | 46 | ... | ... |
src/main/java/etunicorn/controller/BaseController.java
... | ... | @@ -66,6 +66,7 @@ public class BaseController { |
66 | 66 | |
67 | 67 | public ResponseEntity generateError(HttpStatus status, Exception exception, String message) { |
68 | 68 | JSONObject json = generateErrorJSON(status, message); |
69 | + json.put("exception", exception.getClass().getCanonicalName()); | |
69 | 70 | json.put("error", exception.getMessage()); |
70 | 71 | // From http://stackoverflow.com/a/1149721 |
71 | 72 | StringWriter sw = new StringWriter(); | ... | ... |
src/main/java/etunicorn/controller/RoleController.java
... | ... | @@ -41,9 +41,6 @@ public class RoleController extends BaseController implements etunicorn.generate |
41 | 41 | @RestrictedTo("ROLE_ADD") |
42 | 42 | public ResponseEntity<?> updateRole(@Valid @RequestBody UpdateRoleRequest updateRoleRequest) { |
43 | 43 | Role oldRole = roleRepository.findByNom(updateRoleRequest.getNom()); |
44 | - if (oldRole != null) { | |
45 | - return generateError(HttpStatus.CONFLICT, "Un rôle avec le même nom existe déjà"); | |
46 | - } | |
47 | 44 | Role role = new Role(); |
48 | 45 | role.setNom(updateRoleRequest.getNom()); |
49 | 46 | try { | ... | ... |