Skip to content

Commit

Permalink
Refactor: Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
fjlopez committed Jun 10, 2024
1 parent f141969 commit 6c7e17b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.sitmun.domain.territory.Territory;

import java.util.List;
import java.util.Map;

@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ public class Application {
/**
* The JSP viewer to be loaded in this application when it is internal or a link to the
* external application.
*
* TODO Rename this property to "Url" and change the type to URL.
* TODO Rename this property to "Url" and change the type to URL.
*/
@Column(name = "APP_TEMPLATE", length = PersistenceConstants.SHORT_DESCRIPTION)
private String jspTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Envelope convertToEntityAttribute(String dbData) {
.maxY(extractDouble(values[3]))
.build();
} catch (Exception e) {
log.error('[' + dbData + "] cannot be parsed to Envelope", e);
log.error("[{}] cannot be parsed to Envelope", dbData, e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Point convertToEntityAttribute(String dbData) {
.y(extractDouble(values[1]))
.build();
} catch (Exception e) {
log.error('[' + dbData + "] cannot be parsed to Point", e);
log.error("[{}] cannot be parsed to Point", dbData, e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.stream.Collectors;

public class UserDetailsImplementation implements UserDetails {
private static final long serialVersionUID = 1L;

@Getter
private final Integer id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ class UserResourceTest {
@Autowired
private MockMvc mockMvc;
private User organizacionAdmin;
private User territory1User;
private User territory2User;

private Territory territory1;
private Territory territory2;


private Role organizacionAdminRole;
Expand All @@ -86,17 +81,17 @@ void init() {

territories = new ArrayList<>();
users = new ArrayList<>();
territory1 = Territory.builder()
.name("Territorio 1")
.code("")
.blocked(false)
.build();

territory2 = Territory.builder()
.name("Territorio 2")
.code("")
.blocked(false)
.build();
Territory territory1 = Territory.builder()
.name("Territorio 1")
.code("")
.blocked(false)
.build();

Territory territory2 = Territory.builder()
.name("Territorio 2")
.code("")
.blocked(false)
.build();
territories.add(territory1);
territories.add(territory2);

Expand All @@ -117,27 +112,27 @@ void init() {
users.add(organizacionAdmin);

// Territory 1 user
territory1User = User.builder()
.administrator(false)
.blocked(USER_BLOCKED)
.firstName(USER_FIRSTNAME)
.lastName(USER_LASTNAME)
.password(USER_PASSWORD)
.username(TERRITORY1_USER_USERNAME)
.build();
User territory1User = User.builder()
.administrator(false)
.blocked(USER_BLOCKED)
.firstName(USER_FIRSTNAME)
.lastName(USER_LASTNAME)
.password(USER_PASSWORD)
.username(TERRITORY1_USER_USERNAME)
.build();

territory1User = userRepository.save(territory1User);
users.add(territory1User);

// Territory 2 user
territory2User = User.builder()
.administrator(false)
.blocked(USER_BLOCKED)
.firstName(USER_FIRSTNAME)
.lastName(USER_LASTNAME)
.password(USER_PASSWORD)
.username(TERRITORY2_USER_USERNAME)
.build();
User territory2User = User.builder()
.administrator(false)
.blocked(USER_BLOCKED)
.firstName(USER_FIRSTNAME)
.lastName(USER_LASTNAME)
.password(USER_PASSWORD)
.username(TERRITORY2_USER_USERNAME)
.build();
territory2User = userRepository.save(territory2User);
users.add(territory2User);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ List<QueryParameter> extractParameters(Task task) {
return r;
}
).filter(Optional::isPresent).map(Optional::get).collect(joining(", "));
log.info("For Task " + task.getId() + " (task type = " + task.getType().getId() + ")" +
" parameter " + qp.getKey() + " not extracted: " + fail + " param rows not found");
log.info("For Task {} (task type = {}) parameter {} not extracted: {} param rows not found", task.getId(), task.getType().getId(), qp.getKey(), fail);
result = Optional.empty();
}
return result;
Expand Down

0 comments on commit 6c7e17b

Please sign in to comment.