Skip to content

Commit

Permalink
build(clean): remove unused code (#249)
Browse files Browse the repository at this point in the history
* build(clean): remove unused code
  • Loading branch information
dtrouillet authored Mar 20, 2022
1 parent 02b297f commit b5f83b6
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [11, 12, 13, 14, 15, 16, 17 ]
java: [15, 16, 17 ]
steps:
- uses: actions/checkout@v1
- name: Cache Maven Repo
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ These instructions will get you a copy of the project up and running on your loc

### Prerequisites

the project needs Java 8 and a PostgreSQL database.
the project needs Java 15+ and a PostgreSQL database.
To build the project, Maven 3+ is required.

:warning: You need a github token to get all maven package. Please read this article : https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry :warning:
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/fr/icdc/ebad/EbadApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

Expand Down Expand Up @@ -43,9 +42,15 @@ public static void main(String[] args) throws UnknownHostException {

ConfigurableApplicationContext applicationContext = app.run(args);
Environment env = applicationContext.getEnvironment();
APPLICATION_LOGGER.info("Access URLs:\n----------------------------------------------------------\n\t" +
"Local: \t\thttp://127.0.0.1:{}\n\t" +
"External: \thttp://{}:{}\n----------------------------------------------------------", env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"));
APPLICATION_LOGGER.info("""
Access URLs:
----------------------------------------------------------
\tLocal: \t\thttp://127.0.0.1:{}
\tExternal: \thttp://{}:{}
----------------------------------------------------------""",
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"));
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/main/java/fr/icdc/ebad/config/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public final class Constants {
public static final String SPRING_PROFILE_JWT = "jwt";
public static final String SPRING_PROFILE_TEST = "test";
public static final String SPRING_PROFILE_PRODUCTION = "prod";
public static final String SPRING_PROFILE_FAST = "fast";
public static final String ROLE_ADMIN = "ROLE_ADMIN";
public static final String ROLE_USER = "ROLE_USER";

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/fr/icdc/ebad/config/jwt/JwtConfiguration.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.icdc.ebad.config.jwt;

import fr.icdc.ebad.config.Constants;
import fr.icdc.ebad.security.jwt.JWTConfigurer;
import fr.icdc.ebad.security.jwt.TokenProvider;
import org.apache.commons.compress.utils.Lists;
Expand Down Expand Up @@ -28,7 +29,7 @@
import javax.annotation.PostConstruct;
import java.util.Arrays;

@Profile("jwt")
@Profile(Constants.SPRING_PROFILE_JWT)
@Configuration
@Import(SecurityProblemSupport.class)
@EnableWebSecurity
Expand Down
17 changes: 2 additions & 15 deletions src/main/java/fr/icdc/ebad/domain/ChaineAssociationId.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,16 @@

import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
* Created by dtrouillet on 13/06/2016.
*/
@Data
public class ChaineAssociationId implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
public long getBatch() {
return batch;
}

public void setBatch(long batch) {
this.batch = batch;
}

public long getChaine() {
return chaine;
}

public void setChaine(long chaine) {
this.chaine = chaine;
}

private int batchOrder;

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/fr/icdc/ebad/repository/ApiTokenRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import org.springframework.data.querydsl.binding.QuerydslBindings;
import org.springframework.data.querydsl.binding.SingleValueBinding;

import java.util.Optional;

public interface ApiTokenRepository extends JpaRepository<ApiToken, Long>, QuerydslPredicateExecutor<ApiToken>, QuerydslBinderCustomizer<QApiToken> {
@Override
default void customize(QuerydslBindings bindings, QApiToken root) {
Expand All @@ -23,5 +21,4 @@ default void customize(QuerydslBindings bindings, QApiToken root) {
}

Page<ApiToken> findAllByUserLogin(String login, Pageable pageable);
Optional<ApiToken> findApiTokenByToken(String key);
}
14 changes: 0 additions & 14 deletions src/main/java/fr/icdc/ebad/security/AuthoritiesConstants.java

This file was deleted.

25 changes: 1 addition & 24 deletions src/main/java/fr/icdc/ebad/web/rest/UserJWTController.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package fr.icdc.ebad.web.rest;

import com.fasterxml.jackson.annotation.JsonProperty;
import fr.icdc.ebad.domain.User;
import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.security.jwt.JWTConfigurer;
import fr.icdc.ebad.security.jwt.TokenProvider;
import fr.icdc.ebad.service.UserService;
import fr.icdc.ebad.service.util.EbadServiceException;
import fr.icdc.ebad.web.rest.dto.LoginDto;
import fr.icdc.ebad.web.rest.dto.UserDto;
import fr.icdc.ebad.mapper.MapStructMapper;
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.context.annotation.Profile;
Expand Down Expand Up @@ -63,26 +62,4 @@ public ResponseEntity<UserDto> authorize(@Valid @RequestBody LoginDto loginDto)
user.setToken(jwt);
return new ResponseEntity<>(mapStructMapper.convert(user), httpHeaders, HttpStatus.OK);
}


/**
* Object to return as body in JWT Authentication.
*/
static class JWTToken {

private String idToken;

JWTToken(String idToken) {
this.idToken = idToken;
}

@JsonProperty("id_token")
String getIdToken() {
return idToken;
}

void setIdToken(String idToken) {
this.idToken = idToken;
}
}
}
36 changes: 7 additions & 29 deletions src/main/java/fr/icdc/ebad/web/rest/dto/EnvironnementInfoDTO.java
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
package fr.icdc.ebad.web.rest.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
* Created by dtrouillet on 03/03/2016.
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EnvironnementInfoDTO {

private Long id;
private String diskSpace;
private Date dateTraitement;

public EnvironnementInfoDTO(Long id, String diskSpace, Date dateTraitement) {
this.id = id;
this.diskSpace = diskSpace;
this.dateTraitement = dateTraitement;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getDiskSpace() {
return diskSpace;
}

public void setDiskSpace(String diskSpace) {
this.diskSpace = diskSpace;
}

public Date getDateTraitement() {
return dateTraitement;
}

public void setDateTraitement(Date dateTraitement) {
this.dateTraitement = dateTraitement;
}
}
7 changes: 4 additions & 3 deletions src/main/java/fr/icdc/ebad/web/rest/dto/ManagedUserDto.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package fr.icdc.ebad.web.rest.dto;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Size;

Expand All @@ -11,6 +13,8 @@
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
public class ManagedUserDto extends UserAccountDto {

public static final int PASSWORD_MIN_LENGTH = 4;
Expand All @@ -20,7 +24,4 @@ public class ManagedUserDto extends UserAccountDto {
@Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH)
private String password;

public ManagedUserDto() {
// Empty constructor needed for Jackson.
}
}
28 changes: 4 additions & 24 deletions src/main/java/fr/icdc/ebad/web/rest/dto/RolesDTO.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
package fr.icdc.ebad.web.rest.dto;

import lombok.Data;

/**
* Created by dtrouillet on 07/03/2016.
*/

@Data
public class RolesDTO {
private String loginUser;
private boolean roleUser;
private boolean roleAdmin;

public boolean isRoleUser() {
return roleUser;
}

public void setRoleUser(boolean roleUser) {
this.roleUser = roleUser;
}

public boolean isRoleAdmin() {
return roleAdmin;
}

public void setRoleAdmin(boolean roleAdmin) {
this.roleAdmin = roleAdmin;
}

public String getLoginUser() {
return loginUser;
}

public void setLoginUser(String loginUser) {
this.loginUser = loginUser;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fr.icdc.ebad.web.rest.errors;

import java.net.URI;

public final class ErrorConstants {

Expand All @@ -9,14 +8,6 @@ public final class ErrorConstants {
public static final String ERR_CLIENT_FAILURE = "error.clientFailure";
public static final String ERR_FORBIDDEN = "error.forbidden";
public static final String ERR_VALIDATION = "error.validation";
public static final String PROBLEM_BASE_URL = "http://www.github?io";
public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message");
public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation");
public static final URI PARAMETERIZED_TYPE = URI.create(PROBLEM_BASE_URL + "/parameterized");
public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password");
public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used");
public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used");
public static final URI EMAIL_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-found");

private ErrorConstants() {
}
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/fr/icdc/ebad/web/rest/errors/FieldErrorVM.java

This file was deleted.

0 comments on commit b5f83b6

Please sign in to comment.