Skip to content

Commit

Permalink
style: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-Guillemin committed Jan 11, 2024
1 parent 1151cf4 commit 2c0898d
Show file tree
Hide file tree
Showing 55 changed files with 3,397 additions and 3,370 deletions.
16 changes: 16 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See http://EditorConfig.org for more information

# top-most EditorConfig file
root = true

# Every File
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false
4 changes: 2 additions & 2 deletions backend/etc/license-mappings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<license-lookup xmlns="https://source.jasig.org/schemas/maven-notice-plugin/license-lookup"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://source.jasig.org/schemas/maven-notice-plugin/license-lookup https://source.jasig.org/schemas/maven-notice-plugin/license-lookup/license-lookup-v1.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://source.jasig.org/schemas/maven-notice-plugin/license-lookup https://source.jasig.org/schemas/maven-notice-plugin/license-lookup/license-lookup-v1.0.xsd">
</license-lookup>
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ public static void main(String[] args) throws UnknownHostException {

Environment env = app.run(args).getEnvironment();
log.info(
"Access URLs:" +
"\n----------------------------------------------------------" +
"\n\tLocal: \t\thttp://127.0.0.1:{}" +
"\n\tExternal: \thttp://{}:{}" +
"\n\tProfiles: \t{}" +
"\n----------------------------------------------------------",
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getProperty("spring.profiles.active")
"Access URLs:" +
"\n----------------------------------------------------------" +
"\n\tLocal: \t\thttp://127.0.0.1:{}" +
"\n\tExternal: \thttp://{}:{}" +
"\n\tProfiles: \t{}" +
"\n----------------------------------------------------------",
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getProperty("spring.profiles.active")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application
.profiles(addDefaultProfile())
.bannerMode(Banner.Mode.OFF)
.sources(ParametabApplication.class);
.profiles(addDefaultProfile())
.bannerMode(Banner.Mode.OFF)
.sources(ParametabApplication.class);
}

private String addDefaultProfile() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@Configuration
@EnableCaching
public class CacheConfig {


@Bean
public CacheManager cacheManager() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

public class Constants {

private Constants() {
throw new IllegalStateException("Utility class");
}
private Constants() {
throw new IllegalStateException("Utility class");
}

public static final String PROPERTIES_TO_JSON_DELIMITER = "\", \"";
public static final String PROPERTIES_TO_JSON_PREFIX = "[ \"";
public static final String PROPERTIES_TO_JSON_SUFFIX = "\" ]";
public static final String PROPERTIES_TO_JSON_DELIMITER = "\", \"";
public static final String PROPERTIES_TO_JSON_PREFIX = "[ \"";
public static final String PROPERTIES_TO_JSON_SUFFIX = "\" ]";

public static final String SPRING_PROFILE_DEVELOPMENT = "dev";
public static final String SPRING_PROFILE_PRODUCTION = "prod";
public static final String SPRING_PROFILE_TEST = "test";
public static final String SPRING_PROFILE_DEVELOPMENT = "dev";
public static final String SPRING_PROFILE_PRODUCTION = "prod";
public static final String SPRING_PROFILE_TEST = "test";

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@
@Slf4j
public class CorsConfiguration {

private final CorsProperties corsProperties;
private final CorsProperties corsProperties;

public CorsConfiguration(ParametabProperties parametabProperties) {
this.corsProperties = parametabProperties.getCors();
}
public CorsConfiguration(ParametabProperties parametabProperties) {
this.corsProperties = parametabProperties.getCors();
}

@Bean
CorsConfigurationSource corsConfigurationSource() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
@Bean
CorsConfigurationSource corsConfigurationSource() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();

if (log.isWarnEnabled()) log.warn("CORS: {}", corsProperties.isEnable());
if (corsProperties.isEnable()) {
org.springframework.web.cors.CorsConfiguration configuration = new org.springframework.web.cors.CorsConfiguration();
if (log.isWarnEnabled()) log.warn("CORS: {}", corsProperties.isEnable());
if (corsProperties.isEnable()) {
org.springframework.web.cors.CorsConfiguration configuration = new org.springframework.web.cors.CorsConfiguration();

configuration.setAllowCredentials(corsProperties.isAllowCredentials());
configuration.setAllowedOrigins(corsProperties.getAllowedOrigins());
configuration.setExposedHeaders(corsProperties.getExposedHeaders());
configuration.setAllowedHeaders(corsProperties.getAllowedHeaders());
configuration.setAllowedMethods(corsProperties.getAllowedMethods());
configuration.setAllowCredentials(corsProperties.isAllowCredentials());
configuration.setAllowedOrigins(corsProperties.getAllowedOrigins());
configuration.setExposedHeaders(corsProperties.getExposedHeaders());
configuration.setAllowedHeaders(corsProperties.getAllowedHeaders());
configuration.setAllowedMethods(corsProperties.getAllowedMethods());

source.registerCorsConfiguration("/**", configuration);
}
source.registerCorsConfiguration("/**", configuration);
}

return source;
}
return source;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

@Configuration
@ConfigurationProperties(
prefix = "app",
ignoreUnknownFields = false
prefix = "app",
ignoreUnknownFields = false
)
@Data
@Validated
Expand All @@ -49,10 +49,10 @@ private void init() throws JsonProcessingException {
@Override
public String toString() {
return "{\n"
+ cors + ",\n"
+ security + ",\n"
+ soffit + "\n"
+ "\n}";
+ cors + ",\n"
+ security + ",\n"
+ soffit + "\n"
+ "\n}";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@
@Data
public class CorsProperties {

private boolean enable;
private boolean allowCredentials;
private List<String> allowedOrigins;
private List<String> exposedHeaders;
private List<String> allowedHeaders;
private List<String> allowedMethods;
private boolean enable;
private boolean allowCredentials;
private List<String> allowedOrigins;
private List<String> exposedHeaders;
private List<String> allowedHeaders;
private List<String> allowedMethods;

@Override
public String toString() {
return "\"CorsProperties\": {" +
"\n\t\"enable\": " + enable +
",\n\t\"allowCredentials\": " + allowCredentials +
",\n\t\"allowedOrigins\": " + allowedOrigins.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
",\n\t\"exposedHeaders\": " + exposedHeaders.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
",\n\t\"allowedHeaders\": " + allowedHeaders.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
",\n\t\"allowedMethods\": " + allowedMethods.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
"\n}";
}
@Override
public String toString() {
return "\"CorsProperties\": {" +
"\n\t\"enable\": " + enable +
",\n\t\"allowCredentials\": " + allowCredentials +
",\n\t\"allowedOrigins\": " + allowedOrigins.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
",\n\t\"exposedHeaders\": " + exposedHeaders.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
",\n\t\"allowedHeaders\": " + allowedHeaders.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
",\n\t\"allowedMethods\": " + allowedMethods.stream()
.map(String::valueOf)
.collect(Collectors.joining(PROPERTIES_TO_JSON_DELIMITER, PROPERTIES_TO_JSON_PREFIX, PROPERTIES_TO_JSON_SUFFIX)) +
"\n}";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
@Data
public class SoffitProperties {

private String jwtSignatureKey;
private String jwtSignatureKey;

@Override
public String toString() {
return "\"SoffitProperties\": {" +
"\n\t\"jwtSignatureKey\": \"" + jwtSignatureKey + "\"" +
"\n}";
}
@Override
public String toString() {
return "\"SoffitProperties\": {" +
"\n\t\"jwtSignatureKey\": \"" + jwtSignatureKey + "\"" +
"\n}";
}

}
32 changes: 16 additions & 16 deletions backend/src/main/java/fr/recia/paramuseretab/dao/IStructureDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@
*/
package fr.recia.paramuseretab.dao;

import java.util.Collection;

import fr.recia.paramuseretab.model.Structure;
import fr.recia.paramuseretab.web.DTOStructure;

import java.util.Collection;

public interface IStructureDao {

/**
* Find all structure.
*
* @return a never null Collection which may be empty
*/
Collection<? extends Structure> findAllStructures();
/**
* Find all structure.
*
* @return a never null Collection which may be empty
*/
Collection<? extends Structure> findAllStructures();

/**
* Find a Structure.
*
* @param id Id of the structure to find.
* @return the Structure found.
*/
Structure findOneStructureById(final String id);
/**
* Find a Structure.
*
* @param id Id of the structure to find.
* @return the Structure found.
*/
Structure findOneStructureById(final String id);

void saveStructure(DTOStructure dto, String customName, String siteWeb, String logo, String id);
void saveStructure(DTOStructure dto, String customName, String siteWeb, String logo, String id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

public interface IUserDao {

void saveCurrentStructure(String userId, Structure struct);
void saveCurrentStructure(String userId, Structure struct);

Person retrievePersonFromLdap(String userId);
Person retrievePersonFromLdap(String userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface IStructureFormatter {

/**
* Formatter used in visitor pattern
*
*
* @param input UniteAdministrativeImmatriculee to format
* @return The UniteAdministrativeImmatriculee object formatted
*/
Expand Down
Loading

0 comments on commit 2c0898d

Please sign in to comment.