mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-23 16:05:09 +00:00
Compare commits
10 Commits
6dd17a5561
...
a2840982e5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a2840982e5 | ||
![]() |
11e81e54fe | ||
![]() |
f892be4711 | ||
![]() |
f2468d26c9 | ||
![]() |
1490b29ec0 | ||
![]() |
43e6c6a608 | ||
![]() |
4afeecebe0 | ||
![]() |
90a3249a6a | ||
![]() |
6fbdee1b81 | ||
![]() |
bdc35519da |
52
.github/workflows/build.yml
vendored
52
.github/workflows/build.yml
vendored
@ -47,18 +47,56 @@ jobs:
|
||||
env:
|
||||
DISABLE_ADDITIONAL_FEATURES: false
|
||||
|
||||
- name: Upload Test Reports
|
||||
- name: Check Test Reports Exist
|
||||
id: check-reports
|
||||
if: always()
|
||||
run: |
|
||||
missing_reports=()
|
||||
|
||||
# Check for required test report directories
|
||||
if [ ! -d "stirling-pdf/build/reports/tests/" ]; then
|
||||
missing_reports+=("stirling-pdf/build/reports/tests/")
|
||||
fi
|
||||
if [ ! -d "stirling-pdf/build/test-results/" ]; then
|
||||
missing_reports+=("stirling-pdf/build/test-results/")
|
||||
fi
|
||||
if [ ! -d "common/build/reports/tests/" ]; then
|
||||
missing_reports+=("common/build/reports/tests/")
|
||||
fi
|
||||
if [ ! -d "common/build/test-results/" ]; then
|
||||
missing_reports+=("common/build/test-results/")
|
||||
fi
|
||||
if [ ! -d "proprietary/build/reports/tests/" ]; then
|
||||
missing_reports+=("proprietary/build/reports/tests/")
|
||||
fi
|
||||
if [ ! -d "proprietary/build/test-results/" ]; then
|
||||
missing_reports+=("proprietary/build/test-results/")
|
||||
fi
|
||||
|
||||
# Fail if any required reports are missing
|
||||
if [ ${#missing_reports[@]} -gt 0 ]; then
|
||||
echo "ERROR: The following required test report directories are missing:"
|
||||
printf '%s\n' "${missing_reports[@]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All required test report directories are present"
|
||||
|
||||
- name: Upload Test Reports
|
||||
if: steps.check-reports.outcome == 'success'
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: test-reports-jdk-${{ matrix.jdk-version }}
|
||||
path: |
|
||||
build/reports/tests/
|
||||
build/test-results/
|
||||
build/reports/problems/
|
||||
/common/build/reports/tests/
|
||||
/common/build/test-results/
|
||||
/common/build/reports/problems/
|
||||
stirling-pdf/build/reports/tests/
|
||||
stirling-pdf/build/test-results/
|
||||
stirling-pdf/build/reports/problems/
|
||||
common/build/reports/tests/
|
||||
common/build/test-results/
|
||||
common/build/reports/problems/
|
||||
proprietary/build/reports/tests/
|
||||
proprietary/build/test-results/
|
||||
proprietary/build/reports/problems/
|
||||
retention-days: 3
|
||||
|
||||
check-licence:
|
||||
|
@ -473,6 +473,7 @@ spotless {
|
||||
target sourceSets.main.allJava
|
||||
target project(':common').sourceSets.main.allJava
|
||||
target project(':proprietary').sourceSets.main.allJava
|
||||
target project(':stirling-pdf').sourceSets.main.allJava
|
||||
|
||||
googleJavaFormat("1.27.0").aosp().reorderImports(false)
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package stirling.software.common.configuration;
|
||||
|
||||
import io.github.pixee.security.SystemCommand;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -10,29 +8,22 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.thymeleaf.spring6.SpringTemplateEngine;
|
||||
import org.springframework.core.Ordered;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
|
||||
@Lazy
|
||||
|
@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.transaction.Transactional;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -256,7 +257,7 @@ public class UserController {
|
||||
} else {
|
||||
// Check if the selected team is Internal - prevent assigning to it
|
||||
Team selectedTeam = teamRepository.findById(effectiveTeamId).orElse(null);
|
||||
if (selectedTeam != null && selectedTeam.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||
if (selectedTeam != null && TeamService.INTERNAL_TEAM_NAME.equals(selectedTeam.getName())) {
|
||||
return new RedirectView("/adminSettings?messageType=internalTeamNotAccessible", true);
|
||||
}
|
||||
}
|
||||
@ -276,6 +277,7 @@ public class UserController {
|
||||
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@PostMapping("/admin/changeRole")
|
||||
@Transactional
|
||||
public RedirectView changeRole(
|
||||
@RequestParam(name = "username") String username,
|
||||
@RequestParam(name = "role") String role,
|
||||
@ -313,12 +315,12 @@ public class UserController {
|
||||
Team team = teamRepository.findById(teamId).orElse(null);
|
||||
if (team != null) {
|
||||
// Prevent assigning to Internal team
|
||||
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||
if (TeamService.INTERNAL_TEAM_NAME.equals(team.getName())) {
|
||||
return new RedirectView("/adminSettings?messageType=internalTeamNotAccessible", true);
|
||||
}
|
||||
|
||||
// Prevent moving users from Internal team
|
||||
if (user.getTeam() != null && user.getTeam().getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||
if (user.getTeam() != null && TeamService.INTERNAL_TEAM_NAME.equals(user.getTeam().getName())) {
|
||||
return new RedirectView("/adminSettings?messageType=cannotMoveInternalUsers", true);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
package stirling.software.proprietary.security.service;
|
||||
|
||||
import java.util.Optional;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import stirling.software.proprietary.model.Team;
|
||||
import stirling.software.proprietary.security.repository.TeamRepository;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class TeamServiceTest {
|
||||
|
||||
@Mock
|
||||
private TeamRepository teamRepository;
|
||||
|
||||
@InjectMocks
|
||||
private TeamService teamService;
|
||||
|
||||
@Test
|
||||
void getDefaultTeam() {
|
||||
var team = new Team();
|
||||
team.setName("Marleyans");
|
||||
|
||||
when(teamRepository.findByName(TeamService.DEFAULT_TEAM_NAME))
|
||||
.thenReturn(Optional.of(team));
|
||||
|
||||
Team result = teamService.getOrCreateDefaultTeam();
|
||||
|
||||
assertEquals(team, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDefaultTeam_whenRepositoryIsEmpty() {
|
||||
String teamName = "Default";
|
||||
var defaultTeam = new Team();
|
||||
defaultTeam.setId(1L);
|
||||
defaultTeam.setName(teamName);
|
||||
|
||||
when(teamRepository.findByName(teamName))
|
||||
.thenReturn(Optional.empty());
|
||||
when(teamRepository.save(any(Team.class))).thenReturn(defaultTeam);
|
||||
|
||||
Team result = teamService.getOrCreateDefaultTeam();
|
||||
|
||||
assertEquals(TeamService.DEFAULT_TEAM_NAME, result.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getInternalTeam() {
|
||||
var team = new Team();
|
||||
team.setName("Eldians");
|
||||
|
||||
when(teamRepository.findByName(TeamService.INTERNAL_TEAM_NAME))
|
||||
.thenReturn(Optional.of(team));
|
||||
|
||||
Team result = teamService.getOrCreateInternalTeam();
|
||||
|
||||
assertEquals(team, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void createInternalTeam_whenRepositoryIsEmpty() {
|
||||
String teamName = "Internal";
|
||||
Team internalTeam = new Team();
|
||||
internalTeam.setId(2L);
|
||||
internalTeam.setName(teamName);
|
||||
|
||||
when(teamRepository.findByName(teamName))
|
||||
.thenReturn(Optional.empty());
|
||||
when(teamRepository.save(any(Team.class))).thenReturn(internalTeam);
|
||||
when(teamRepository.findByName(TeamService.INTERNAL_TEAM_NAME))
|
||||
.thenReturn(Optional.empty());
|
||||
|
||||
Team result = teamService.getOrCreateInternalTeam();
|
||||
|
||||
assertEquals(internalTeam, result);
|
||||
}
|
||||
}
|
@ -0,0 +1,317 @@
|
||||
package stirling.software.proprietary.security.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.model.enumeration.Role;
|
||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||
import stirling.software.proprietary.model.Team;
|
||||
import stirling.software.proprietary.security.database.repository.AuthorityRepository;
|
||||
import stirling.software.proprietary.security.database.repository.UserRepository;
|
||||
import stirling.software.proprietary.security.model.AuthenticationType;
|
||||
import stirling.software.proprietary.security.model.User;
|
||||
import stirling.software.proprietary.security.repository.TeamRepository;
|
||||
import stirling.software.proprietary.security.session.SessionPersistentRegistry;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class UserServiceTest {
|
||||
|
||||
@Mock
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Mock
|
||||
private TeamRepository teamRepository;
|
||||
|
||||
@Mock
|
||||
private AuthorityRepository authorityRepository;
|
||||
|
||||
@Mock
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Mock
|
||||
private MessageSource messageSource;
|
||||
|
||||
@Mock
|
||||
private SessionPersistentRegistry sessionPersistentRegistry;
|
||||
|
||||
@Mock
|
||||
private DatabaseServiceInterface databaseService;
|
||||
|
||||
@Mock
|
||||
private ApplicationProperties.Security.OAUTH2 oauth2Properties;
|
||||
|
||||
@InjectMocks
|
||||
private UserService userService;
|
||||
|
||||
private Team mockTeam;
|
||||
private User mockUser;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
mockTeam = new Team();
|
||||
mockTeam.setId(1L);
|
||||
mockTeam.setName("Test Team");
|
||||
|
||||
mockUser = new User();
|
||||
mockUser.setId(1L);
|
||||
mockUser.setUsername("testuser");
|
||||
mockUser.setEnabled(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithUsernameAndAuthenticationType_Success() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
AuthenticationType authType = AuthenticationType.WEB;
|
||||
|
||||
when(teamRepository.findByName("Default")).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
userService.saveUser(username, authType);
|
||||
|
||||
// Then
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithUsernamePasswordAndTeamId_Success() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
String password = "password123";
|
||||
Long teamId = 1L;
|
||||
String encodedPassword = "encodedPassword123";
|
||||
|
||||
when(passwordEncoder.encode(password)).thenReturn(encodedPassword);
|
||||
when(teamRepository.findById(teamId)).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
User result = userService.saveUser(username, password, teamId);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
verify(passwordEncoder).encode(password);
|
||||
verify(teamRepository).findById(teamId);
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithTeamAndRole_Success() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
String password = "password123";
|
||||
String role = Role.ADMIN.getRoleId();
|
||||
boolean firstLogin = true;
|
||||
String encodedPassword = "encodedPassword123";
|
||||
|
||||
when(passwordEncoder.encode(password)).thenReturn(encodedPassword);
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
User result = userService.saveUser(username, password, mockTeam, role, firstLogin);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
verify(passwordEncoder).encode(password);
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithInvalidUsername_ThrowsException() throws Exception {
|
||||
// Given
|
||||
String invalidUsername = "ab"; // Too short (less than 3 characters)
|
||||
AuthenticationType authType = AuthenticationType.WEB;
|
||||
|
||||
// When & Then
|
||||
IllegalArgumentException exception = assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> userService.saveUser(invalidUsername, authType)
|
||||
);
|
||||
|
||||
verify(userRepository, never()).save(any(User.class));
|
||||
verify(databaseService, never()).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithNullPassword_Success() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
Long teamId = 1L;
|
||||
|
||||
when(teamRepository.findById(teamId)).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
User result = userService.saveUser(username, null, teamId);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
verify(passwordEncoder, never()).encode(anyString());
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithEmptyPassword_Success() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
String emptyPassword = "";
|
||||
Long teamId = 1L;
|
||||
|
||||
when(teamRepository.findById(teamId)).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
User result = userService.saveUser(username, emptyPassword, teamId);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
verify(passwordEncoder, never()).encode(anyString());
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithValidEmail_Success() throws Exception {
|
||||
// Given
|
||||
String emailUsername = "test@example.com";
|
||||
AuthenticationType authType = AuthenticationType.SSO;
|
||||
|
||||
when(teamRepository.findByName("Default")).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
userService.saveUser(emailUsername, authType);
|
||||
|
||||
// Then
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithReservedUsername_ThrowsException() throws Exception {
|
||||
// Given
|
||||
String reservedUsername = "all_users";
|
||||
AuthenticationType authType = AuthenticationType.WEB;
|
||||
|
||||
// When & Then
|
||||
IllegalArgumentException exception = assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> userService.saveUser(reservedUsername, authType)
|
||||
);
|
||||
|
||||
verify(userRepository, never()).save(any(User.class));
|
||||
verify(databaseService, never()).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithAnonymousUser_ThrowsException() throws Exception {
|
||||
// Given
|
||||
String anonymousUsername = "anonymoususer";
|
||||
AuthenticationType authType = AuthenticationType.WEB;
|
||||
|
||||
// When & Then
|
||||
IllegalArgumentException exception = assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> userService.saveUser(anonymousUsername, authType)
|
||||
);
|
||||
|
||||
verify(userRepository, never()).save(any(User.class));
|
||||
verify(databaseService, never()).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_DatabaseExportThrowsException_StillSavesUser() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
String password = "password123";
|
||||
Long teamId = 1L;
|
||||
String encodedPassword = "encodedPassword123";
|
||||
|
||||
when(passwordEncoder.encode(password)).thenReturn(encodedPassword);
|
||||
when(teamRepository.findById(teamId)).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doThrow(new SQLException("Database export failed")).when(databaseService).exportDatabase();
|
||||
|
||||
// When & Then
|
||||
assertThrows(SQLException.class, () -> userService.saveUser(username, password, teamId));
|
||||
|
||||
// Verify user was still saved before the exception
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithFirstLoginFlag_Success() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
String password = "password123";
|
||||
Long teamId = 1L;
|
||||
boolean firstLogin = true;
|
||||
boolean enabled = false;
|
||||
String encodedPassword = "encodedPassword123";
|
||||
|
||||
when(passwordEncoder.encode(password)).thenReturn(encodedPassword);
|
||||
when(teamRepository.findById(teamId)).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
userService.saveUser(username, password, teamId, firstLogin, enabled);
|
||||
|
||||
// Then
|
||||
verify(passwordEncoder).encode(password);
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSaveUser_WithCustomRole_Success() throws Exception {
|
||||
// Given
|
||||
String username = "testuser";
|
||||
String password = "password123";
|
||||
Long teamId = 1L;
|
||||
String customRole = Role.LIMITED_API_USER.getRoleId();
|
||||
String encodedPassword = "encodedPassword123";
|
||||
|
||||
when(passwordEncoder.encode(password)).thenReturn(encodedPassword);
|
||||
when(teamRepository.findById(teamId)).thenReturn(Optional.of(mockTeam));
|
||||
when(userRepository.save(any(User.class))).thenReturn(mockUser);
|
||||
doNothing().when(databaseService).exportDatabase();
|
||||
|
||||
// When
|
||||
userService.saveUser(username, password, teamId, customRole);
|
||||
|
||||
// Then
|
||||
verify(passwordEncoder).encode(password);
|
||||
verify(userRepository).save(any(User.class));
|
||||
verify(databaseService).exportDatabase();
|
||||
}
|
||||
|
||||
}
|
@ -13,8 +13,6 @@ import java.util.Properties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@ -210,7 +208,7 @@ public class SPDFApplication {
|
||||
if (arg.startsWith("--spring.profiles.active=")) {
|
||||
String[] provided = arg.substring(arg.indexOf('=') + 1).split(",");
|
||||
if (provided.length > 0) {
|
||||
log.info("#######0000000000000###############################");
|
||||
log.info("#######0000000000000###############################");
|
||||
return provided;
|
||||
}
|
||||
}
|
||||
@ -218,14 +216,16 @@ public class SPDFApplication {
|
||||
}
|
||||
log.info("######################################");
|
||||
// 2. Detect if SecurityConfiguration is present on classpath
|
||||
if (isClassPresent("stirling.software.proprietary.security.configuration.SecurityConfiguration")) {
|
||||
log.info("security");
|
||||
return new String[] { "security" };
|
||||
if (isClassPresent(
|
||||
"stirling.software.proprietary.security.configuration.SecurityConfiguration")) {
|
||||
log.info("security");
|
||||
return new String[] {"security"};
|
||||
} else {
|
||||
log.info("default");
|
||||
return new String[] { "default" };
|
||||
log.info("default");
|
||||
return new String[] {"default"};
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isClassPresent(String className) {
|
||||
try {
|
||||
Class.forName(className, false, SPDFApplication.class.getClassLoader());
|
||||
|
@ -25,9 +25,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
// Handler for external static resources
|
||||
registry.addResourceHandler("/**")
|
||||
.addResourceLocations(
|
||||
"file:" + InstallationPathConfig.getStaticPath(),
|
||||
"classpath:/static/"
|
||||
);
|
||||
"file:" + InstallationPathConfig.getStaticPath(), "classpath:/static/");
|
||||
registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
|
||||
registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
|
||||
// .setCachePeriod(0); // Optional: disable caching
|
||||
|
@ -69,7 +69,8 @@ public class EditTableOfContentsController {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> extractBookmarkItems(PDDocument document, PDDocumentOutline outline) throws Exception {
|
||||
private List<Map<String, Object>> extractBookmarkItems(
|
||||
PDDocument document, PDDocumentOutline outline) throws Exception {
|
||||
List<Map<String, Object>> bookmarks = new ArrayList<>();
|
||||
PDOutlineItem current = outline.getFirstChild();
|
||||
|
||||
@ -114,7 +115,8 @@ public class EditTableOfContentsController {
|
||||
return bookmarks;
|
||||
}
|
||||
|
||||
private Map<String, Object> processChild(PDDocument document, PDOutlineItem item) throws Exception {
|
||||
private Map<String, Object> processChild(PDDocument document, PDOutlineItem item)
|
||||
throws Exception {
|
||||
Map<String, Object> bookmark = new HashMap<>();
|
||||
|
||||
// Get bookmark title
|
||||
@ -154,8 +156,8 @@ public class EditTableOfContentsController {
|
||||
@Operation(
|
||||
summary = "Edit Table of Contents",
|
||||
description = "Add or edit bookmarks/table of contents in a PDF document.")
|
||||
public ResponseEntity<byte[]> editTableOfContents(@ModelAttribute EditTableOfContentsRequest request)
|
||||
throws Exception {
|
||||
public ResponseEntity<byte[]> editTableOfContents(
|
||||
@ModelAttribute EditTableOfContentsRequest request) throws Exception {
|
||||
MultipartFile file = request.getFileInput();
|
||||
PDDocument document = null;
|
||||
|
||||
@ -163,9 +165,9 @@ public class EditTableOfContentsController {
|
||||
document = pdfDocumentFactory.load(file);
|
||||
|
||||
// Parse the bookmark data from JSON
|
||||
List<BookmarkItem> bookmarks = objectMapper.readValue(
|
||||
request.getBookmarkData(),
|
||||
new TypeReference<List<BookmarkItem>>() {});
|
||||
List<BookmarkItem> bookmarks =
|
||||
objectMapper.readValue(
|
||||
request.getBookmarkData(), new TypeReference<List<BookmarkItem>>() {});
|
||||
|
||||
// Create a new document outline
|
||||
PDDocumentOutline outline = new PDDocumentOutline();
|
||||
@ -189,7 +191,8 @@ public class EditTableOfContentsController {
|
||||
}
|
||||
}
|
||||
|
||||
private void addBookmarksToOutline(PDDocument document, PDDocumentOutline outline, List<BookmarkItem> bookmarks) {
|
||||
private void addBookmarksToOutline(
|
||||
PDDocument document, PDDocumentOutline outline, List<BookmarkItem> bookmarks) {
|
||||
for (BookmarkItem bookmark : bookmarks) {
|
||||
PDOutlineItem item = createOutlineItem(document, bookmark);
|
||||
outline.addLast(item);
|
||||
@ -200,7 +203,8 @@ public class EditTableOfContentsController {
|
||||
}
|
||||
}
|
||||
|
||||
private void addChildBookmarks(PDDocument document, PDOutlineItem parent, List<BookmarkItem> children) {
|
||||
private void addChildBookmarks(
|
||||
PDDocument document, PDOutlineItem parent, List<BookmarkItem> children) {
|
||||
for (BookmarkItem child : children) {
|
||||
PDOutlineItem item = createOutlineItem(document, child);
|
||||
parent.addLast(item);
|
||||
|
@ -27,9 +27,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.common.util.WebResponseUtils;
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/general")
|
||||
|
@ -31,11 +31,11 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.SplitPdfByChaptersRequest;
|
||||
import stirling.software.common.model.PdfMetadata;
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.common.service.PdfMetadataService;
|
||||
import stirling.software.common.util.WebResponseUtils;
|
||||
import stirling.software.SPDF.model.api.SplitPdfByChaptersRequest;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/general")
|
||||
|
@ -31,9 +31,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import stirling.software.SPDF.model.api.SplitPdfBySectionsRequest;
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.common.util.WebResponseUtils;
|
||||
import stirling.software.SPDF.model.api.SplitPdfBySectionsRequest;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/general")
|
||||
|
@ -16,8 +16,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import io.github.pixee.security.Filenames;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.configuration.RuntimePathConfig;
|
||||
import stirling.software.common.model.api.converters.EmlToPdfRequest;
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
@ -39,9 +41,9 @@ public class ConvertEmlToPDF {
|
||||
summary = "Convert EML to PDF",
|
||||
description =
|
||||
"This endpoint converts EML (email) files to PDF format with extensive"
|
||||
+ " customization options. Features include font settings, image constraints, display modes, attachment handling,"
|
||||
+ " and HTML debug output. Input: EML file, Output: PDF"
|
||||
+ " or HTML file. Type: SISO")
|
||||
+ " customization options. Features include font settings, image constraints, display modes, attachment handling,"
|
||||
+ " and HTML debug output. Input: EML file, Output: PDF"
|
||||
+ " or HTML file. Type: SISO")
|
||||
public ResponseEntity<byte[]> convertEmlToPdf(@ModelAttribute EmlToPdfRequest request) {
|
||||
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
@ -94,7 +96,8 @@ public class ConvertEmlToPDF {
|
||||
try {
|
||||
byte[] pdfBytes =
|
||||
EmlToPdf.convertEmlToPdf(
|
||||
runtimePathConfig.getWeasyPrintPath(), // Use configured WeasyPrint path
|
||||
runtimePathConfig
|
||||
.getWeasyPrintPath(), // Use configured WeasyPrint path
|
||||
request,
|
||||
fileBytes,
|
||||
originalFilename,
|
||||
@ -119,12 +122,20 @@ public class ConvertEmlToPDF {
|
||||
.body("Conversion was interrupted".getBytes(StandardCharsets.UTF_8));
|
||||
} catch (IllegalArgumentException e) {
|
||||
String errorMessage = buildErrorMessage(e, originalFilename);
|
||||
log.error("EML to PDF conversion failed for {}: {}", originalFilename, errorMessage, e);
|
||||
log.error(
|
||||
"EML to PDF conversion failed for {}: {}",
|
||||
originalFilename,
|
||||
errorMessage,
|
||||
e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body(errorMessage.getBytes(StandardCharsets.UTF_8));
|
||||
} catch (RuntimeException e) {
|
||||
String errorMessage = buildErrorMessage(e, originalFilename);
|
||||
log.error("EML to PDF conversion failed for {}: {}", originalFilename, errorMessage, e);
|
||||
log.error(
|
||||
"EML to PDF conversion failed for {}: {}",
|
||||
originalFilename,
|
||||
errorMessage,
|
||||
e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body(errorMessage.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import stirling.software.common.model.api.GeneralFile;
|
||||
import stirling.software.common.configuration.RuntimePathConfig;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.model.api.GeneralFile;
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.common.util.FileToPdf;
|
||||
import stirling.software.common.util.WebResponseUtils;
|
||||
|
@ -36,8 +36,8 @@ import stirling.software.SPDF.model.PipelineConfig;
|
||||
import stirling.software.SPDF.model.PipelineOperation;
|
||||
import stirling.software.SPDF.model.PipelineResult;
|
||||
import stirling.software.SPDF.service.ApiDocService;
|
||||
import stirling.software.common.service.PostHogService;
|
||||
import stirling.software.common.configuration.RuntimePathConfig;
|
||||
import stirling.software.common.service.PostHogService;
|
||||
import stirling.software.common.util.FileMonitor;
|
||||
|
||||
@Service
|
||||
|
@ -184,7 +184,8 @@ public class RedactController {
|
||||
String pageNumbersInput = request.getPageNumbers();
|
||||
String[] parsedPageNumbers =
|
||||
pageNumbersInput != null ? pageNumbersInput.split(",") : new String[0];
|
||||
List<Integer> pageNumbers = GeneralUtils.parsePageList(parsedPageNumbers, pagesCount, false);
|
||||
List<Integer> pageNumbers =
|
||||
GeneralUtils.parsePageList(parsedPageNumbers, pagesCount, false);
|
||||
Collections.sort(pageNumbers);
|
||||
return pageNumbers;
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.SPDF.model.Dependency;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@ -48,9 +48,7 @@ public class HomeWebController {
|
||||
InputStream is = resource.getInputStream();
|
||||
String json = new String(is.readAllBytes(), StandardCharsets.UTF_8);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Map<String, List<Dependency>> data =
|
||||
mapper.readValue(json, new TypeReference<>() {
|
||||
});
|
||||
Map<String, List<Dependency>> data = mapper.readValue(json, new TypeReference<>() {});
|
||||
model.addAttribute("dependencies", data.get("dependencies"));
|
||||
} catch (IOException e) {
|
||||
log.error("exception", e);
|
||||
|
@ -4,15 +4,21 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class EditTableOfContentsRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "Bookmark structure in JSON format", example = "[{\"title\":\"Chapter 1\",\"pageNumber\":1,\"children\":[{\"title\":\"Section 1.1\",\"pageNumber\":2}]}]")
|
||||
@Schema(
|
||||
description = "Bookmark structure in JSON format",
|
||||
example =
|
||||
"[{\"title\":\"Chapter 1\",\"pageNumber\":1,\"children\":[{\"title\":\"Section 1.1\",\"pageNumber\":2}]}]")
|
||||
private String bookmarkData;
|
||||
|
||||
@Schema(description = "Whether to replace existing bookmarks or append to them", example = "true")
|
||||
@Schema(
|
||||
description = "Whether to replace existing bookmarks or append to them",
|
||||
example = "true")
|
||||
private Boolean replaceExisting;
|
||||
}
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
|
||||
@Data
|
||||
@ -11,31 +12,31 @@ import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
public class ConvertToImageRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(
|
||||
description = "The output image format",
|
||||
defaultValue = "png",
|
||||
allowableValues = {"png", "jpeg", "jpg", "gif", "webp"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The output image format",
|
||||
defaultValue = "png",
|
||||
allowableValues = {"png", "jpeg", "jpg", "gif", "webp"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String imageFormat;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Choose between a single image containing all pages or separate images for each"
|
||||
+ " page",
|
||||
defaultValue = "multiple",
|
||||
allowableValues = {"single", "multiple"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description =
|
||||
"Choose between a single image containing all pages or separate images for each"
|
||||
+ " page",
|
||||
defaultValue = "multiple",
|
||||
allowableValues = {"single", "multiple"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String singleOrMultiple;
|
||||
|
||||
@Schema(
|
||||
description = "The color type of the output image(s)",
|
||||
defaultValue = "color",
|
||||
allowableValues = {"color", "greyscale", "blackwhite"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The color type of the output image(s)",
|
||||
defaultValue = "color",
|
||||
allowableValues = {"color", "greyscale", "blackwhite"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String colorType;
|
||||
|
||||
@Schema(
|
||||
description = "The DPI (dots per inch) for the output image(s)",
|
||||
defaultValue = "300",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The DPI (dots per inch) for the output image(s)",
|
||||
defaultValue = "300",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer dpi;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
public class ContainsTextRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(
|
||||
description = "The text to check for",
|
||||
defaultValue = "text",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The text to check for",
|
||||
defaultValue = "text",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String text;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ import stirling.software.SPDF.model.api.PDFComparison;
|
||||
public class FileSizeRequest extends PDFComparison {
|
||||
|
||||
@Schema(
|
||||
description = "Size of the file in bytes",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
defaultValue = "0")
|
||||
description = "Size of the file in bytes",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
defaultValue = "0")
|
||||
private long fileSize;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ import stirling.software.SPDF.model.api.PDFComparison;
|
||||
public class PageRotationRequest extends PDFComparison {
|
||||
|
||||
@Schema(
|
||||
description = "Rotation in degrees",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
defaultValue = "0")
|
||||
description = "Rotation in degrees",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
defaultValue = "0")
|
||||
private int rotation;
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ import stirling.software.SPDF.model.api.PDFComparison;
|
||||
public class PageSizeRequest extends PDFComparison {
|
||||
|
||||
@Schema(
|
||||
description = "Standard Page Size",
|
||||
allowableValues = {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "LETTER", "LEGAL"},
|
||||
defaultValue = "A4",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Standard Page Size",
|
||||
allowableValues = {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "LETTER", "LEGAL"},
|
||||
defaultValue = "A4",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String standardPageSize;
|
||||
}
|
||||
|
@ -14,33 +14,33 @@ import stirling.software.common.model.api.PDFFile;
|
||||
public class OverlayPdfsRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"An array of PDF files to be used as overlays on the base PDF. The order in"
|
||||
+ " these files is applied based on the selected mode.",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description =
|
||||
"An array of PDF files to be used as overlays on the base PDF. The order in"
|
||||
+ " these files is applied based on the selected mode.",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private MultipartFile[] overlayFiles;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"The mode of overlaying: 'SequentialOverlay' for sequential application,"
|
||||
+ " 'InterleavedOverlay' for round-robin application, 'FixedRepeatOverlay'"
|
||||
+ " for fixed repetition based on provided counts",
|
||||
allowableValues = {"SequentialOverlay", "InterleavedOverlay", "FixedRepeatOverlay"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description =
|
||||
"The mode of overlaying: 'SequentialOverlay' for sequential application,"
|
||||
+ " 'InterleavedOverlay' for round-robin application, 'FixedRepeatOverlay'"
|
||||
+ " for fixed repetition based on provided counts",
|
||||
allowableValues = {"SequentialOverlay", "InterleavedOverlay", "FixedRepeatOverlay"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String overlayMode;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"An array of integers specifying the number of times each corresponding overlay"
|
||||
+ " file should be applied in the 'FixedRepeatOverlay' mode. This should"
|
||||
+ " match the length of the overlayFiles array.",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description =
|
||||
"An array of integers specifying the number of times each corresponding overlay"
|
||||
+ " file should be applied in the 'FixedRepeatOverlay' mode. This should"
|
||||
+ " match the length of the overlayFiles array.",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private int[] counts;
|
||||
|
||||
@Schema(
|
||||
description = "Overlay position 0 is Foregound, 1 is Background",
|
||||
allowableValues = {"0", "1"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
type = "number")
|
||||
description = "Overlay position 0 is Foregound, 1 is Background",
|
||||
allowableValues = {"0", "1"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
type = "number")
|
||||
private int overlayPosition;
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
public class AddStampRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(
|
||||
description = "The stamp type (text or image)",
|
||||
allowableValues = {"text", "image"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The stamp type (text or image)",
|
||||
allowableValues = {"text", "image"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String stampType;
|
||||
|
||||
@Schema(description = "The stamp text", defaultValue = "Stirling Software")
|
||||
@ -26,60 +26,60 @@ public class AddStampRequest extends PDFWithPageNums {
|
||||
private MultipartFile stampImage;
|
||||
|
||||
@Schema(
|
||||
description = "The selected alphabet of the stamp text",
|
||||
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
|
||||
defaultValue = "roman")
|
||||
description = "The selected alphabet of the stamp text",
|
||||
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
|
||||
defaultValue = "roman")
|
||||
private String alphabet = "roman";
|
||||
|
||||
@Schema(
|
||||
description = "The font size of the stamp text and image",
|
||||
defaultValue = "30",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The font size of the stamp text and image",
|
||||
defaultValue = "30",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float fontSize;
|
||||
|
||||
@Schema(
|
||||
description = "The rotation of the stamp in degrees",
|
||||
defaultValue = "0",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The rotation of the stamp in degrees",
|
||||
defaultValue = "0",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float rotation;
|
||||
|
||||
@Schema(
|
||||
description = "The opacity of the stamp (0.0 - 1.0)",
|
||||
defaultValue = "0.5",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The opacity of the stamp (0.0 - 1.0)",
|
||||
defaultValue = "0.5",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float opacity;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Position for stamp placement based on a 1-9 grid (1: bottom-left, 2: bottom-center,"
|
||||
+ " 3: bottom-right, 4: middle-left, 5: middle-center, 6: middle-right,"
|
||||
+ " 7: top-left, 8: top-center, 9: top-right)",
|
||||
allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"},
|
||||
defaultValue = "5",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description =
|
||||
"Position for stamp placement based on a 1-9 grid (1: bottom-left, 2: bottom-center,"
|
||||
+ " 3: bottom-right, 4: middle-left, 5: middle-center, 6: middle-right,"
|
||||
+ " 7: top-left, 8: top-center, 9: top-right)",
|
||||
allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"},
|
||||
defaultValue = "5",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private int position;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Override X coordinate for stamp placement. If set, it will override the"
|
||||
+ " position-based calculation. Negative value means no override.",
|
||||
defaultValue = "-1",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description =
|
||||
"Override X coordinate for stamp placement. If set, it will override the"
|
||||
+ " position-based calculation. Negative value means no override.",
|
||||
defaultValue = "-1",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float overrideX; // Default to -1 indicating no override
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Override Y coordinate for stamp placement. If set, it will override the"
|
||||
+ " position-based calculation. Negative value means no override.",
|
||||
defaultValue = "-1",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description =
|
||||
"Override Y coordinate for stamp placement. If set, it will override the"
|
||||
+ " position-based calculation. Negative value means no override.",
|
||||
defaultValue = "-1",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float overrideY; // Default to -1 indicating no override
|
||||
|
||||
@Schema(
|
||||
description = "Specifies the margin size for the stamp.",
|
||||
allowableValues = {"small", "medium", "large", "x-large"},
|
||||
defaultValue = "medium",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Specifies the margin size for the stamp.",
|
||||
allowableValues = {"small", "medium", "large", "x-large"},
|
||||
defaultValue = "medium",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String customMargin;
|
||||
|
||||
@Schema(description = "The color of the stamp text", defaultValue = "#d3d3d3")
|
||||
|
@ -14,71 +14,71 @@ import stirling.software.common.model.api.PDFFile;
|
||||
public class MetadataRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description = "Delete all metadata if set to true",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Delete all metadata if set to true",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean deleteAll;
|
||||
|
||||
@Schema(
|
||||
description = "The author of the document",
|
||||
defaultValue = "author",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The author of the document",
|
||||
defaultValue = "author",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String author;
|
||||
|
||||
@Schema(
|
||||
description = "The creation date of the document (format: yyyy/MM/dd HH:mm:ss)",
|
||||
pattern = "yyyy/MM/dd HH:mm:ss",
|
||||
defaultValue = "2023/10/01 12:00:00",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The creation date of the document (format: yyyy/MM/dd HH:mm:ss)",
|
||||
pattern = "yyyy/MM/dd HH:mm:ss",
|
||||
defaultValue = "2023/10/01 12:00:00",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String creationDate;
|
||||
|
||||
@Schema(
|
||||
description = "The creator of the document",
|
||||
defaultValue = "creator",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The creator of the document",
|
||||
defaultValue = "creator",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String creator;
|
||||
|
||||
@Schema(
|
||||
description = "The keywords for the document",
|
||||
defaultValue = "keywords",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The keywords for the document",
|
||||
defaultValue = "keywords",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String keywords;
|
||||
|
||||
@Schema(
|
||||
description = "The modification date of the document (format: yyyy/MM/dd HH:mm:ss)",
|
||||
pattern = "yyyy/MM/dd HH:mm:ss",
|
||||
defaultValue = "2023/10/01 12:00:00",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The modification date of the document (format: yyyy/MM/dd HH:mm:ss)",
|
||||
pattern = "yyyy/MM/dd HH:mm:ss",
|
||||
defaultValue = "2023/10/01 12:00:00",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String modificationDate;
|
||||
|
||||
@Schema(
|
||||
description = "The producer of the document",
|
||||
defaultValue = "producer",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The producer of the document",
|
||||
defaultValue = "producer",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String producer;
|
||||
|
||||
@Schema(
|
||||
description = "The subject of the document",
|
||||
defaultValue = "subject",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The subject of the document",
|
||||
defaultValue = "subject",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String subject;
|
||||
|
||||
@Schema(
|
||||
description = "The title of the document",
|
||||
defaultValue = "title",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The title of the document",
|
||||
defaultValue = "title",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String title;
|
||||
|
||||
@Schema(
|
||||
description = "The trapped status of the document",
|
||||
defaultValue = "False",
|
||||
allowableValues = {"True", "False", "Unknown"},
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
description = "The trapped status of the document",
|
||||
defaultValue = "False",
|
||||
allowableValues = {"True", "False", "Unknown"},
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String trapped;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Map list of key and value of custom parameters. Note these must start with"
|
||||
+ " customKey and customValue if they are non-standard")
|
||||
description =
|
||||
"Map list of key and value of custom parameters. Note these must start with"
|
||||
+ " customKey and customValue if they are non-standard")
|
||||
private Map<String, String> allRequestParams;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
|
@ -12,24 +12,24 @@ import stirling.software.common.model.api.PDFFile;
|
||||
public class AddPasswordRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"The owner password to be added to the PDF file (Restricts what can be done"
|
||||
+ " with the document once it is opened)",
|
||||
format = "password")
|
||||
description =
|
||||
"The owner password to be added to the PDF file (Restricts what can be done"
|
||||
+ " with the document once it is opened)",
|
||||
format = "password")
|
||||
private String ownerPassword;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"The password to be added to the PDF file (Restricts the opening of the"
|
||||
+ " document itself.)",
|
||||
format = "password")
|
||||
description =
|
||||
"The password to be added to the PDF file (Restricts the opening of the"
|
||||
+ " document itself.)",
|
||||
format = "password")
|
||||
private String password;
|
||||
|
||||
@Schema(
|
||||
description = "The length of the encryption key",
|
||||
allowableValues = {"40", "128", "256"},
|
||||
defaultValue = "256",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The length of the encryption key",
|
||||
allowableValues = {"40", "128", "256"},
|
||||
defaultValue = "256",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private int keyLength = 256;
|
||||
|
||||
@Schema(description = "Whether document assembly is prevented", defaultValue = "false")
|
||||
@ -39,8 +39,8 @@ public class AddPasswordRequest extends PDFFile {
|
||||
private Boolean preventExtractContent;
|
||||
|
||||
@Schema(
|
||||
description = "Whether content extraction for accessibility is prevented",
|
||||
defaultValue = "false")
|
||||
description = "Whether content extraction for accessibility is prevented",
|
||||
defaultValue = "false")
|
||||
private Boolean preventExtractForAccessibility;
|
||||
|
||||
@Schema(description = "Whether form filling is prevented", defaultValue = "false")
|
||||
@ -50,8 +50,8 @@ public class AddPasswordRequest extends PDFFile {
|
||||
private Boolean preventModify;
|
||||
|
||||
@Schema(
|
||||
description = "Whether modification of annotations is prevented",
|
||||
defaultValue = "false")
|
||||
description = "Whether modification of annotations is prevented",
|
||||
defaultValue = "false")
|
||||
private Boolean preventModifyAnnotations;
|
||||
|
||||
@Schema(description = "Whether printing of the document is prevented", defaultValue = "false")
|
||||
|
@ -14,19 +14,19 @@ import stirling.software.common.model.api.security.RedactionArea;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ManualRedactPdfRequest extends PDFWithPageNums {
|
||||
@Schema(
|
||||
description = "A list of areas that should be redacted",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "A list of areas that should be redacted",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<RedactionArea> redactions;
|
||||
|
||||
@Schema(
|
||||
description = "Convert the redacted PDF to an image",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Convert the redacted PDF to an image",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean convertPDFToImage;
|
||||
|
||||
@Schema(
|
||||
description = "The color used to fully redact certain pages",
|
||||
defaultValue = "#000000",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The color used to fully redact certain pages",
|
||||
defaultValue = "#000000",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String pageRedactionColor;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@ -11,38 +12,38 @@ import stirling.software.common.model.api.PDFFile;
|
||||
public class RedactPdfRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description = "List of text to redact from the PDF",
|
||||
defaultValue = "text,text2",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "List of text to redact from the PDF",
|
||||
defaultValue = "text,text2",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String listOfText;
|
||||
|
||||
@Schema(
|
||||
description = "Whether to use regex for the listOfText",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Whether to use regex for the listOfText",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean useRegex;
|
||||
|
||||
@Schema(
|
||||
description = "Whether to use whole word search",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Whether to use whole word search",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean wholeWordSearch;
|
||||
|
||||
@Schema(
|
||||
description = "The color for redaction",
|
||||
defaultValue = "#000000",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "The color for redaction",
|
||||
defaultValue = "#000000",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String redactColor;
|
||||
|
||||
@Schema(
|
||||
description = "Custom padding for redaction",
|
||||
type = "number",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Custom padding for redaction",
|
||||
type = "number",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float customPadding;
|
||||
|
||||
@Schema(
|
||||
description = "Convert the redacted PDF to an image",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Convert the redacted PDF to an image",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean convertPDFToImage;
|
||||
}
|
||||
|
@ -12,38 +12,38 @@ import stirling.software.common.model.api.PDFFile;
|
||||
public class SanitizePdfRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description = "Remove JavaScript actions from the PDF",
|
||||
defaultValue = "true",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Remove JavaScript actions from the PDF",
|
||||
defaultValue = "true",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeJavaScript;
|
||||
|
||||
@Schema(
|
||||
description = "Remove embedded files from the PDF",
|
||||
defaultValue = "true",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Remove embedded files from the PDF",
|
||||
defaultValue = "true",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeEmbeddedFiles;
|
||||
|
||||
@Schema(
|
||||
description = "Remove XMP metadata from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Remove XMP metadata from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeXMPMetadata;
|
||||
|
||||
@Schema(
|
||||
description = "Remove document info metadata from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Remove document info metadata from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeMetadata;
|
||||
|
||||
@Schema(
|
||||
description = "Remove links from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Remove links from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeLinks;
|
||||
|
||||
@Schema(
|
||||
description = "Remove fonts from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
description = "Remove fonts from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeFonts;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ import io.micrometer.core.instrument.search.Search;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import stirling.software.common.service.PostHogService;
|
||||
import stirling.software.SPDF.config.EndpointInspector;
|
||||
import stirling.software.common.service.PostHogService;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
@ -45,77 +45,77 @@
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.core:jackson-annotations",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.core:jackson-core",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-core",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.core:jackson-databind",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-dataformats-text",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.datatype:jackson-datatype-jdk8",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-modules-java8/jackson-datatype-jdk8",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.datatype:jackson-datatype-jsr310",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-modules-java8/jackson-datatype-jsr310",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.jaxrs:jackson-jaxrs-base",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-jaxrs-providers/jackson-jaxrs-base",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-jaxrs-providers/jackson-jaxrs-json-provider",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.module:jackson-module-jaxb-annotations",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-modules-base",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson.module:jackson-module-parameter-names",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-modules-java8/jackson-module-parameter-names",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.fasterxml.jackson:jackson-bom",
|
||||
"moduleUrl": "https://github.com/FasterXML/jackson-bom",
|
||||
"moduleVersion": "2.18.3",
|
||||
"moduleVersion": "2.19.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -161,14 +161,20 @@
|
||||
{
|
||||
"moduleName": "com.google.code.gson:gson",
|
||||
"moduleUrl": "https://github.com/google/gson",
|
||||
"moduleVersion": "2.11.0",
|
||||
"moduleVersion": "2.13.1",
|
||||
"moduleLicense": "Apache-2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.google.errorprone:error_prone_annotations",
|
||||
"moduleVersion": "2.11.0",
|
||||
"moduleLicense": "Apache 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "com.google.errorprone:error_prone_annotations",
|
||||
"moduleUrl": "https://errorprone.info/error_prone_annotations",
|
||||
"moduleVersion": "2.27.0",
|
||||
"moduleVersion": "2.38.0",
|
||||
"moduleLicense": "Apache 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -491,7 +497,7 @@
|
||||
{
|
||||
"moduleName": "com.zaxxer:HikariCP",
|
||||
"moduleUrl": "https://github.com/brettwooldridge/HikariCP",
|
||||
"moduleVersion": "5.1.0",
|
||||
"moduleVersion": "6.3.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -512,7 +518,7 @@
|
||||
{
|
||||
"moduleName": "commons-codec:commons-codec",
|
||||
"moduleUrl": "https://commons.apache.org/proper/commons-codec/",
|
||||
"moduleVersion": "1.17.2",
|
||||
"moduleVersion": "1.18.0",
|
||||
"moduleLicense": "Apache-2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -523,6 +529,20 @@
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "commons-io:commons-io",
|
||||
"moduleUrl": "https://commons.apache.org/proper/commons-io/",
|
||||
"moduleVersion": "2.11.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "commons-io:commons-io",
|
||||
"moduleUrl": "https://commons.apache.org/proper/commons-io/",
|
||||
"moduleVersion": "2.13.0",
|
||||
"moduleLicense": "Apache-2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "commons-io:commons-io",
|
||||
"moduleUrl": "https://commons.apache.org/proper/commons-io/",
|
||||
@ -546,7 +566,7 @@
|
||||
{
|
||||
"moduleName": "io.micrometer:micrometer-commons",
|
||||
"moduleUrl": "https://github.com/micrometer-metrics/micrometer",
|
||||
"moduleVersion": "1.14.6",
|
||||
"moduleVersion": "1.15.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -557,24 +577,31 @@
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "io.micrometer:micrometer-core",
|
||||
"moduleUrl": "https://github.com/micrometer-metrics/micrometer",
|
||||
"moduleVersion": "1.15.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "io.micrometer:micrometer-jakarta9",
|
||||
"moduleUrl": "https://github.com/micrometer-metrics/micrometer",
|
||||
"moduleVersion": "1.14.6",
|
||||
"moduleVersion": "1.15.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "io.micrometer:micrometer-observation",
|
||||
"moduleUrl": "https://github.com/micrometer-metrics/micrometer",
|
||||
"moduleVersion": "1.14.6",
|
||||
"moduleVersion": "1.15.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "io.micrometer:micrometer-registry-prometheus",
|
||||
"moduleUrl": "https://github.com/micrometer-metrics/micrometer",
|
||||
"moduleVersion": "1.14.6",
|
||||
"moduleVersion": "1.15.0",
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -683,6 +710,13 @@
|
||||
"moduleLicense": "GPL2 w/ CPE",
|
||||
"moduleLicenseUrl": "https://www.gnu.org/software/classpath/license.html"
|
||||
},
|
||||
{
|
||||
"moduleName": "jakarta.mail:jakarta.mail-api",
|
||||
"moduleUrl": "https://www.eclipse.org",
|
||||
"moduleVersion": "2.1.3",
|
||||
"moduleLicense": "GPL2 w/ CPE",
|
||||
"moduleLicenseUrl": "https://www.gnu.org/software/classpath/license.html"
|
||||
},
|
||||
{
|
||||
"moduleName": "jakarta.persistence:jakarta.persistence-api",
|
||||
"moduleUrl": "https://www.eclipse.org",
|
||||
@ -697,6 +731,13 @@
|
||||
"moduleLicense": "GPL2 w/ CPE",
|
||||
"moduleLicenseUrl": "https://www.gnu.org/software/classpath/license.html"
|
||||
},
|
||||
{
|
||||
"moduleName": "jakarta.servlet:jakarta.servlet-api",
|
||||
"moduleUrl": "https://www.eclipse.org",
|
||||
"moduleVersion": "6.1.0",
|
||||
"moduleLicense": "GPL2 w/ CPE",
|
||||
"moduleLicenseUrl": "https://www.gnu.org/software/classpath/license.html"
|
||||
},
|
||||
{
|
||||
"moduleName": "jakarta.transaction:jakarta.transaction-api",
|
||||
"moduleUrl": "https://projects.eclipse.org/projects/ee4j.jta",
|
||||
@ -776,7 +817,7 @@
|
||||
},
|
||||
{
|
||||
"moduleName": "net.bytebuddy:byte-buddy",
|
||||
"moduleVersion": "1.15.11",
|
||||
"moduleVersion": "1.17.5",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -835,6 +876,13 @@
|
||||
"moduleLicense": "Apache-2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.apache.commons:commons-text",
|
||||
"moduleUrl": "https://commons.apache.org/proper/commons-text",
|
||||
"moduleVersion": "1.10.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.apache.commons:commons-text",
|
||||
"moduleUrl": "https://commons.apache.org/proper/commons-text",
|
||||
@ -919,7 +967,7 @@
|
||||
{
|
||||
"moduleName": "org.apache.tomcat.embed:tomcat-embed-el",
|
||||
"moduleUrl": "https://tomcat.apache.org/",
|
||||
"moduleVersion": "10.1.40",
|
||||
"moduleVersion": "10.1.41",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
@ -957,6 +1005,13 @@
|
||||
"moduleLicense": "The Apache Software License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.bouncycastle:bcpkix-jdk18on",
|
||||
"moduleUrl": "https://www.bouncycastle.org/java.html",
|
||||
"moduleVersion": "1.72",
|
||||
"moduleLicense": "Bouncy Castle Licence",
|
||||
"moduleLicenseUrl": "https://www.bouncycastle.org/licence.html"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.bouncycastle:bcpkix-jdk18on",
|
||||
"moduleUrl": "https://www.bouncycastle.org/download/bouncy-castle-java/",
|
||||
@ -971,6 +1026,13 @@
|
||||
"moduleLicense": "Bouncy Castle Licence",
|
||||
"moduleLicenseUrl": "https://www.bouncycastle.org/licence.html"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.bouncycastle:bcutil-jdk18on",
|
||||
"moduleUrl": "https://www.bouncycastle.org/java.html",
|
||||
"moduleVersion": "1.72",
|
||||
"moduleLicense": "Bouncy Castle Licence",
|
||||
"moduleLicenseUrl": "https://www.bouncycastle.org/licence.html"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.bouncycastle:bcutil-jdk18on",
|
||||
"moduleUrl": "https://www.bouncycastle.org/download/bouncy-castle-java/",
|
||||
@ -1021,182 +1083,182 @@
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-client",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-common",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-servlet",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10:jetty-ee10-annotations",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10:jetty-ee10-plus",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10:jetty-ee10-servlet",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10:jetty-ee10-servlets",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.ee10:jetty-ee10-webapp",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.websocket:jetty-websocket-core-client",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.websocket:jetty-websocket-core-common",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.websocket:jetty-websocket-core-server",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.websocket:jetty-websocket-jetty-api",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty.websocket:jetty-websocket-jetty-common",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-alpn-client",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-client",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-ee",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-http",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-io",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-plus",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-security",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-server",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-session",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-util",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.eclipse.jetty:jetty-xml",
|
||||
"moduleUrl": "https://jetty.org/",
|
||||
"moduleVersion": "12.0.19",
|
||||
"moduleVersion": "12.0.21",
|
||||
"moduleLicense": "Eclipse Public License - Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.eclipse.org/legal/epl-2.0/"
|
||||
},
|
||||
@ -1238,7 +1300,7 @@
|
||||
{
|
||||
"moduleName": "org.hibernate.orm:hibernate-core",
|
||||
"moduleUrl": "https://www.hibernate.org/orm/6.6",
|
||||
"moduleVersion": "6.6.13.Final",
|
||||
"moduleVersion": "6.6.15.Final",
|
||||
"moduleLicense": "GNU Library General Public License v2.1 or later",
|
||||
"moduleLicenseUrl": "https://www.opensource.org/licenses/LGPL-2.1"
|
||||
},
|
||||
@ -1455,294 +1517,294 @@
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-actuator",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-actuator-autoconfigure",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-autoconfigure",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-devtools",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-actuator",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-data-jpa",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-jdbc",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-jetty",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-json",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-logging",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-mail",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-oauth2-client",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-security",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-thymeleaf",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-validation",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.boot:spring-boot-starter-web",
|
||||
"moduleUrl": "https://spring.io/projects/spring-boot",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.data:spring-data-commons",
|
||||
"moduleUrl": "https://spring.io/projects/spring-data",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.data:spring-data-jpa",
|
||||
"moduleUrl": "https://projects.spring.io/spring-data-jpa",
|
||||
"moduleVersion": "3.4.5",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-config",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-core",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-crypto",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-oauth2-client",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-oauth2-core",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-oauth2-jose",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-saml2-service-provider",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.security:spring-security-web",
|
||||
"moduleUrl": "https://spring.io/projects/spring-security",
|
||||
"moduleVersion": "6.4.5",
|
||||
"moduleVersion": "6.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework.session:spring-session-core",
|
||||
"moduleUrl": "https://spring.io/projects/spring-session",
|
||||
"moduleVersion": "3.4.3",
|
||||
"moduleVersion": "3.5.0",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-aop",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-aspects",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-beans",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-context",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-context-support",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-core",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-expression",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-jcl",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-jdbc",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-orm",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-tx",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-web",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.springframework:spring-webmvc",
|
||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||
"moduleVersion": "6.2.6",
|
||||
"moduleVersion": "6.2.7",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||
},
|
||||
@ -1786,14 +1848,14 @@
|
||||
{
|
||||
"moduleName": "org.webjars:webjars-locator-lite",
|
||||
"moduleUrl": "https://webjars.org",
|
||||
"moduleVersion": "1.0.1",
|
||||
"moduleVersion": "1.1.0",
|
||||
"moduleLicense": "MIT",
|
||||
"moduleLicenseUrl": "https://github.com/webjars/webjars-locator-lite/blob/main/LICENSE.md"
|
||||
},
|
||||
{
|
||||
"moduleName": "org.yaml:snakeyaml",
|
||||
"moduleUrl": "https://bitbucket.org/snakeyaml/snakeyaml",
|
||||
"moduleVersion": "2.3",
|
||||
"moduleVersion": "2.4",
|
||||
"moduleLicense": "Apache License, Version 2.0",
|
||||
"moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
},
|
||||
|
@ -77,15 +77,15 @@
|
||||
</div>
|
||||
|
||||
<!-- Alert Messages -->
|
||||
<div th:if="${addMessage}" class="alert alert-danger data-mb-3">
|
||||
<div th:if="${addMessage}" th:class="${#strings.contains(addMessage, 'Successfully') or #strings.contains(addMessage, 'Created') ? 'alert alert-success data-mb-3' : 'alert alert-danger data-mb-3'}">
|
||||
<span th:text="#{${addMessage}}">Default message if not found</span>
|
||||
</div>
|
||||
|
||||
<div th:if="${changeMessage}" class="alert alert-danger data-mb-3">
|
||||
<div th:if="${changeMessage}" th:class="${#strings.contains(changeMessage, 'Successfully') or #strings.contains(changeMessage, 'Created') ? 'alert alert-success data-mb-3' : 'alert alert-danger data-mb-3'}">
|
||||
<span th:text="#{${changeMessage}}">Default message if not found</span>
|
||||
</div>
|
||||
|
||||
<div th:if="${deleteMessage}" class="alert alert-danger data-mb-3">
|
||||
<div th:if="${deleteMessage}" th:class="${#strings.contains(deleteMessage, 'Successfully') or #strings.contains(deleteMessage, 'Created') ? 'alert alert-success data-mb-3' : 'alert alert-danger data-mb-3'}">
|
||||
<span th:text="#{${deleteMessage}}">Default message if not found</span>
|
||||
</div>
|
||||
|
||||
|
@ -28,13 +28,6 @@
|
||||
</div>
|
||||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{PDFToText.submit}"></button>
|
||||
</form>
|
||||
<p th:if="${@endpointConfiguration.isEndpointEnabled('pdf-to-rtf')}" class="mt-3" th:text="#{PDFToText.credit}"></p>
|
||||
<option th:if="${@endpointConfiguration.isEndpointEnabled('pdf-to-rtf')}" value="rtf">RTF</option>
|
||||
<option value="txt">TXT</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{PDFToText.submit}"></button>
|
||||
</form>
|
||||
<p th:if="${@endpointConfiguration.isEndpointEnabled('pdf-to-rtf')}" class="mt-3" th:text="#{PDFToText.credit}"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -277,6 +277,9 @@
|
||||
<div
|
||||
th:replace="~{fragments/navbarEntry :: navbarEntry('split-pdf-by-sections', 'grid_on', 'home.split-by-sections.title', 'home.split-by-sections.desc', 'split-by-sections.tags', 'advance')}">
|
||||
</div>
|
||||
<div
|
||||
th:replace="~{fragments/navbarEntry :: navbarEntry('edit-table-of-contents', 'bookmark_add', 'home.editTableOfContents.title', 'home.editTableOfContents.desc', 'editTableOfContents.tags', 'advance')}">
|
||||
</div>
|
||||
<div
|
||||
th:replace="~{fragments/navbarEntryCustom :: navbarEntry('split-pdf-by-chapters', '/images/split-chapters.svg#icon-split-chapters', 'home.splitPdfByChapters.title', 'home.splitPdfByChapters.desc', 'splitPdfByChapters.tags', 'advance')}">
|
||||
</div>
|
||||
|
@ -45,6 +45,9 @@
|
||||
<div class="newfeature"
|
||||
th:insert="~{fragments/navbarEntry :: navbarEntry('compress-pdf', 'zoom_in_map', 'home.compressPdfs.title', 'home.compressPdfs.desc', 'compressPDFs.tags', 'advance')}">
|
||||
</div>
|
||||
<div class="newfeature"
|
||||
th:insert="~{fragments/navbarEntry :: navbarEntry('edit-table-of-contents', 'bookmark_add', 'home.editTableOfContents.title', 'home.editTableOfContents.desc', 'editTableOfContents.tags', 'advance')}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,382 @@
|
||||
package stirling.software.SPDF.controller.api;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
|
||||
import org.apache.pdfbox.pdmodel.PDPage;
|
||||
import org.apache.pdfbox.pdmodel.PDPageTree;
|
||||
import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline;
|
||||
import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import stirling.software.SPDF.controller.api.EditTableOfContentsController.BookmarkItem;
|
||||
import stirling.software.SPDF.model.api.EditTableOfContentsRequest;
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class EditTableOfContentsControllerTest {
|
||||
|
||||
@Mock
|
||||
private CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Mock
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@InjectMocks
|
||||
private EditTableOfContentsController editTableOfContentsController;
|
||||
|
||||
private MockMultipartFile mockFile;
|
||||
private PDDocument mockDocument;
|
||||
private PDDocumentCatalog mockCatalog;
|
||||
private PDPageTree mockPages;
|
||||
private PDPage mockPage1;
|
||||
private PDPage mockPage2;
|
||||
private PDDocumentOutline mockOutline;
|
||||
private PDOutlineItem mockOutlineItem;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
mockFile = new MockMultipartFile("file", "test.pdf", "application/pdf", "PDF content".getBytes());
|
||||
mockDocument = mock(PDDocument.class);
|
||||
mockCatalog = mock(PDDocumentCatalog.class);
|
||||
mockPages = mock(PDPageTree.class);
|
||||
mockPage1 = mock(PDPage.class);
|
||||
mockPage2 = mock(PDPage.class);
|
||||
mockOutline = mock(PDDocumentOutline.class);
|
||||
mockOutlineItem = mock(PDOutlineItem.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExtractBookmarks_WithExistingBookmarks_Success() throws Exception {
|
||||
// Given
|
||||
when(pdfDocumentFactory.load(mockFile)).thenReturn(mockDocument);
|
||||
when(mockDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockCatalog.getDocumentOutline()).thenReturn(mockOutline);
|
||||
when(mockOutline.getFirstChild()).thenReturn(mockOutlineItem);
|
||||
|
||||
when(mockOutlineItem.getTitle()).thenReturn("Chapter 1");
|
||||
when(mockOutlineItem.findDestinationPage(mockDocument)).thenReturn(mockPage1);
|
||||
when(mockDocument.getPages()).thenReturn(mockPages);
|
||||
when(mockPages.indexOf(mockPage1)).thenReturn(0);
|
||||
when(mockOutlineItem.getFirstChild()).thenReturn(null);
|
||||
when(mockOutlineItem.getNextSibling()).thenReturn(null);
|
||||
|
||||
// When
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
Map<String, Object> bookmark = result.get(0);
|
||||
assertEquals("Chapter 1", bookmark.get("title"));
|
||||
assertEquals(1, bookmark.get("pageNumber")); // 1-based
|
||||
assertInstanceOf(List.class, bookmark.get("children"));
|
||||
|
||||
verify(mockDocument).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExtractBookmarks_NoOutline_ReturnsEmptyList() throws Exception {
|
||||
// Given
|
||||
when(pdfDocumentFactory.load(mockFile)).thenReturn(mockDocument);
|
||||
when(mockDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockCatalog.getDocumentOutline()).thenReturn(null);
|
||||
|
||||
// When
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isEmpty());
|
||||
verify(mockDocument).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExtractBookmarks_WithNestedBookmarks_Success() throws Exception {
|
||||
// Given
|
||||
PDOutlineItem childItem = mock(PDOutlineItem.class);
|
||||
|
||||
when(pdfDocumentFactory.load(mockFile)).thenReturn(mockDocument);
|
||||
when(mockDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockCatalog.getDocumentOutline()).thenReturn(mockOutline);
|
||||
when(mockOutline.getFirstChild()).thenReturn(mockOutlineItem);
|
||||
|
||||
// Parent bookmark
|
||||
when(mockOutlineItem.getTitle()).thenReturn("Chapter 1");
|
||||
when(mockOutlineItem.findDestinationPage(mockDocument)).thenReturn(mockPage1);
|
||||
when(mockDocument.getPages()).thenReturn(mockPages);
|
||||
when(mockPages.indexOf(mockPage1)).thenReturn(0);
|
||||
when(mockOutlineItem.getFirstChild()).thenReturn(childItem);
|
||||
when(mockOutlineItem.getNextSibling()).thenReturn(null);
|
||||
|
||||
// Child bookmark
|
||||
when(childItem.getTitle()).thenReturn("Section 1.1");
|
||||
when(childItem.findDestinationPage(mockDocument)).thenReturn(mockPage2);
|
||||
when(mockPages.indexOf(mockPage2)).thenReturn(1);
|
||||
when(childItem.getFirstChild()).thenReturn(null);
|
||||
when(childItem.getNextSibling()).thenReturn(null);
|
||||
|
||||
// When
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
Map<String, Object> parentBookmark = result.get(0);
|
||||
assertEquals("Chapter 1", parentBookmark.get("title"));
|
||||
assertEquals(1, parentBookmark.get("pageNumber"));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> children = (List<Map<String, Object>>) parentBookmark.get("children");
|
||||
assertEquals(1, children.size());
|
||||
|
||||
Map<String, Object> childBookmark = children.get(0);
|
||||
assertEquals("Section 1.1", childBookmark.get("title"));
|
||||
assertEquals(2, childBookmark.get("pageNumber"));
|
||||
|
||||
verify(mockDocument).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExtractBookmarks_PageNotFound_UsesPageOne() throws Exception {
|
||||
// Given
|
||||
when(pdfDocumentFactory.load(mockFile)).thenReturn(mockDocument);
|
||||
when(mockDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockCatalog.getDocumentOutline()).thenReturn(mockOutline);
|
||||
when(mockOutline.getFirstChild()).thenReturn(mockOutlineItem);
|
||||
|
||||
when(mockOutlineItem.getTitle()).thenReturn("Chapter 1");
|
||||
when(mockOutlineItem.findDestinationPage(mockDocument)).thenReturn(null); // Page not found
|
||||
when(mockOutlineItem.getFirstChild()).thenReturn(null);
|
||||
when(mockOutlineItem.getNextSibling()).thenReturn(null);
|
||||
|
||||
// When
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
Map<String, Object> bookmark = result.get(0);
|
||||
assertEquals("Chapter 1", bookmark.get("title"));
|
||||
assertEquals(1, bookmark.get("pageNumber")); // Default to page 1
|
||||
|
||||
verify(mockDocument).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEditTableOfContents_Success() throws Exception {
|
||||
// Given
|
||||
EditTableOfContentsRequest request = new EditTableOfContentsRequest();
|
||||
request.setFileInput(mockFile);
|
||||
request.setBookmarkData("[{\"title\":\"Chapter 1\",\"pageNumber\":1,\"children\":[]}]");
|
||||
request.setReplaceExisting(true);
|
||||
|
||||
List<BookmarkItem> bookmarks = new ArrayList<>();
|
||||
BookmarkItem bookmark = new BookmarkItem();
|
||||
bookmark.setTitle("Chapter 1");
|
||||
bookmark.setPageNumber(1);
|
||||
bookmark.setChildren(new ArrayList<>());
|
||||
bookmarks.add(bookmark);
|
||||
|
||||
when(pdfDocumentFactory.load(mockFile)).thenReturn(mockDocument);
|
||||
when(objectMapper.readValue(eq(request.getBookmarkData()), any(TypeReference.class))).thenReturn(bookmarks);
|
||||
when(mockDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockDocument.getNumberOfPages()).thenReturn(5);
|
||||
when(mockDocument.getPage(0)).thenReturn(mockPage1);
|
||||
|
||||
// Mock saving behavior
|
||||
doAnswer(invocation -> {
|
||||
ByteArrayOutputStream baos = invocation.getArgument(0);
|
||||
baos.write("mocked pdf content".getBytes());
|
||||
return null;
|
||||
}).when(mockDocument).save(any(ByteArrayOutputStream.class));
|
||||
|
||||
// When
|
||||
ResponseEntity<byte[]> result = editTableOfContentsController.editTableOfContents(request);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
assertNotNull(result.getBody());
|
||||
|
||||
ArgumentCaptor<PDDocumentOutline> outlineCaptor = ArgumentCaptor.forClass(PDDocumentOutline.class);
|
||||
verify(mockCatalog).setDocumentOutline(outlineCaptor.capture());
|
||||
|
||||
PDDocumentOutline capturedOutline = outlineCaptor.getValue();
|
||||
assertNotNull(capturedOutline);
|
||||
|
||||
verify(mockDocument).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEditTableOfContents_WithNestedBookmarks_Success() throws Exception {
|
||||
// Given
|
||||
EditTableOfContentsRequest request = new EditTableOfContentsRequest();
|
||||
request.setFileInput(mockFile);
|
||||
|
||||
String bookmarkJson = "[{\"title\":\"Chapter 1\",\"pageNumber\":1,\"children\":[{\"title\":\"Section 1.1\",\"pageNumber\":2,\"children\":[]}]}]";
|
||||
request.setBookmarkData(bookmarkJson);
|
||||
|
||||
List<BookmarkItem> bookmarks = new ArrayList<>();
|
||||
BookmarkItem parentBookmark = new BookmarkItem();
|
||||
parentBookmark.setTitle("Chapter 1");
|
||||
parentBookmark.setPageNumber(1);
|
||||
|
||||
BookmarkItem childBookmark = new BookmarkItem();
|
||||
childBookmark.setTitle("Section 1.1");
|
||||
childBookmark.setPageNumber(2);
|
||||
childBookmark.setChildren(new ArrayList<>());
|
||||
|
||||
List<BookmarkItem> children = new ArrayList<>();
|
||||
children.add(childBookmark);
|
||||
parentBookmark.setChildren(children);
|
||||
bookmarks.add(parentBookmark);
|
||||
|
||||
when(pdfDocumentFactory.load(mockFile)).thenReturn(mockDocument);
|
||||
when(objectMapper.readValue(eq(bookmarkJson), any(TypeReference.class))).thenReturn(bookmarks);
|
||||
when(mockDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockDocument.getNumberOfPages()).thenReturn(5);
|
||||
when(mockDocument.getPage(0)).thenReturn(mockPage1);
|
||||
when(mockDocument.getPage(1)).thenReturn(mockPage2);
|
||||
|
||||
doAnswer(invocation -> {
|
||||
ByteArrayOutputStream baos = invocation.getArgument(0);
|
||||
baos.write("mocked pdf content".getBytes());
|
||||
return null;
|
||||
}).when(mockDocument).save(any(ByteArrayOutputStream.class));
|
||||
|
||||
// When
|
||||
ResponseEntity<byte[]> result = editTableOfContentsController.editTableOfContents(request);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
verify(mockCatalog).setDocumentOutline(any(PDDocumentOutline.class));
|
||||
verify(mockDocument).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEditTableOfContents_PageNumberBounds_ClampsValues() throws Exception {
|
||||
// Given
|
||||
EditTableOfContentsRequest request = new EditTableOfContentsRequest();
|
||||
request.setFileInput(mockFile);
|
||||
request.setBookmarkData("[{\"title\":\"Chapter 1\",\"pageNumber\":-5,\"children\":[]},{\"title\":\"Chapter 2\",\"pageNumber\":100,\"children\":[]}]");
|
||||
|
||||
List<BookmarkItem> bookmarks = new ArrayList<>();
|
||||
|
||||
BookmarkItem bookmark1 = new BookmarkItem();
|
||||
bookmark1.setTitle("Chapter 1");
|
||||
bookmark1.setPageNumber(-5); // Negative page number
|
||||
bookmark1.setChildren(new ArrayList<>());
|
||||
|
||||
BookmarkItem bookmark2 = new BookmarkItem();
|
||||
bookmark2.setTitle("Chapter 2");
|
||||
bookmark2.setPageNumber(100); // Page number exceeds document pages
|
||||
bookmark2.setChildren(new ArrayList<>());
|
||||
|
||||
bookmarks.add(bookmark1);
|
||||
bookmarks.add(bookmark2);
|
||||
|
||||
when(pdfDocumentFactory.load(mockFile)).thenReturn(mockDocument);
|
||||
when(objectMapper.readValue(eq(request.getBookmarkData()), any(TypeReference.class))).thenReturn(bookmarks);
|
||||
when(mockDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockDocument.getNumberOfPages()).thenReturn(5);
|
||||
when(mockDocument.getPage(0)).thenReturn(mockPage1); // For negative page number
|
||||
when(mockDocument.getPage(4)).thenReturn(mockPage2); // For page number exceeding bounds
|
||||
|
||||
doAnswer(invocation -> {
|
||||
ByteArrayOutputStream baos = invocation.getArgument(0);
|
||||
baos.write("mocked pdf content".getBytes());
|
||||
return null;
|
||||
}).when(mockDocument).save(any(ByteArrayOutputStream.class));
|
||||
|
||||
// When
|
||||
ResponseEntity<byte[]> result = editTableOfContentsController.editTableOfContents(request);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
verify(mockDocument).getPage(0); // Clamped to first page
|
||||
verify(mockDocument).getPage(4); // Clamped to last page
|
||||
verify(mockDocument).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateOutlineItem_ValidPageNumber_Success() throws Exception {
|
||||
// Given
|
||||
BookmarkItem bookmark = new BookmarkItem();
|
||||
bookmark.setTitle("Test Chapter");
|
||||
bookmark.setPageNumber(3);
|
||||
|
||||
when(mockDocument.getNumberOfPages()).thenReturn(5);
|
||||
when(mockDocument.getPage(2)).thenReturn(mockPage1); // 0-indexed
|
||||
|
||||
// When
|
||||
Method createOutlineItemMethod = EditTableOfContentsController.class.getDeclaredMethod("createOutlineItem", PDDocument.class, BookmarkItem.class);
|
||||
createOutlineItemMethod.setAccessible(true);
|
||||
PDOutlineItem result = (PDOutlineItem) createOutlineItemMethod.invoke(editTableOfContentsController, mockDocument, bookmark);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
verify(mockDocument).getPage(2);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testBookmarkItem_GettersAndSetters() {
|
||||
// Given
|
||||
BookmarkItem bookmark = new BookmarkItem();
|
||||
List<BookmarkItem> children = new ArrayList<>();
|
||||
|
||||
// When
|
||||
bookmark.setTitle("Test Title");
|
||||
bookmark.setPageNumber(5);
|
||||
bookmark.setChildren(children);
|
||||
|
||||
// Then
|
||||
assertEquals("Test Title", bookmark.getTitle());
|
||||
assertEquals(5, bookmark.getPageNumber());
|
||||
assertEquals(children, bookmark.getChildren());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEditTableOfContents_IOExceptionDuringLoad_ThrowsException() throws Exception {
|
||||
// Given
|
||||
EditTableOfContentsRequest request = new EditTableOfContentsRequest();
|
||||
request.setFileInput(mockFile);
|
||||
|
||||
when(pdfDocumentFactory.load(mockFile)).thenThrow(new RuntimeException("Failed to load PDF"));
|
||||
|
||||
// When & Then
|
||||
assertThrows(RuntimeException.class, () -> editTableOfContentsController.editTableOfContents(request));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExtractBookmarks_IOExceptionDuringLoad_ThrowsException() throws Exception {
|
||||
// Given
|
||||
when(pdfDocumentFactory.load(mockFile)).thenThrow(new RuntimeException("Failed to load PDF"));
|
||||
|
||||
// When & Then
|
||||
assertThrows(RuntimeException.class, () -> editTableOfContentsController.extractBookmarks(mockFile));
|
||||
}
|
||||
}
|
@ -0,0 +1,279 @@
|
||||
package stirling.software.SPDF.controller.api;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
|
||||
import org.apache.pdfbox.pdmodel.PDPage;
|
||||
import org.apache.pdfbox.pdmodel.PDPageTree;
|
||||
import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class MergeControllerTest {
|
||||
|
||||
@Mock
|
||||
private CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@InjectMocks
|
||||
private MergeController mergeController;
|
||||
|
||||
private MockMultipartFile mockFile1;
|
||||
private MockMultipartFile mockFile2;
|
||||
private MockMultipartFile mockFile3;
|
||||
private PDDocument mockDocument;
|
||||
private PDDocument mockMergedDocument;
|
||||
private PDDocumentCatalog mockCatalog;
|
||||
private PDPageTree mockPages;
|
||||
private PDPage mockPage1;
|
||||
private PDPage mockPage2;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
mockFile1 = new MockMultipartFile("file1", "document1.pdf", "application/pdf", "PDF content 1".getBytes());
|
||||
mockFile2 = new MockMultipartFile("file2", "document2.pdf", "application/pdf", "PDF content 2".getBytes());
|
||||
mockFile3 = new MockMultipartFile("file3", "chapter3.pdf", "application/pdf", "PDF content 3".getBytes());
|
||||
|
||||
mockDocument = mock(PDDocument.class);
|
||||
mockMergedDocument = mock(PDDocument.class);
|
||||
mockCatalog = mock(PDDocumentCatalog.class);
|
||||
mockPages = mock(PDPageTree.class);
|
||||
mockPage1 = mock(PDPage.class);
|
||||
mockPage2 = mock(PDPage.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddTableOfContents_WithMultipleFiles_Success() throws Exception {
|
||||
// Given
|
||||
MultipartFile[] files = {mockFile1, mockFile2, mockFile3};
|
||||
|
||||
// Mock the merged document setup
|
||||
when(mockMergedDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockMergedDocument.getNumberOfPages()).thenReturn(6);
|
||||
when(mockMergedDocument.getPage(0)).thenReturn(mockPage1);
|
||||
when(mockMergedDocument.getPage(2)).thenReturn(mockPage2);
|
||||
when(mockMergedDocument.getPage(4)).thenReturn(mockPage1);
|
||||
|
||||
// Mock individual document loading for page count
|
||||
PDDocument doc1 = mock(PDDocument.class);
|
||||
PDDocument doc2 = mock(PDDocument.class);
|
||||
PDDocument doc3 = mock(PDDocument.class);
|
||||
|
||||
when(pdfDocumentFactory.load(mockFile1)).thenReturn(doc1);
|
||||
when(pdfDocumentFactory.load(mockFile2)).thenReturn(doc2);
|
||||
when(pdfDocumentFactory.load(mockFile3)).thenReturn(doc3);
|
||||
|
||||
when(doc1.getNumberOfPages()).thenReturn(2);
|
||||
when(doc2.getNumberOfPages()).thenReturn(2);
|
||||
when(doc3.getNumberOfPages()).thenReturn(2);
|
||||
|
||||
// When
|
||||
Method addTableOfContentsMethod = MergeController.class.getDeclaredMethod("addTableOfContents", PDDocument.class, MultipartFile[].class);
|
||||
addTableOfContentsMethod.setAccessible(true);
|
||||
addTableOfContentsMethod.invoke(mergeController, mockMergedDocument, files);
|
||||
|
||||
// Then
|
||||
ArgumentCaptor<PDDocumentOutline> outlineCaptor = ArgumentCaptor.forClass(PDDocumentOutline.class);
|
||||
verify(mockCatalog).setDocumentOutline(outlineCaptor.capture());
|
||||
|
||||
PDDocumentOutline capturedOutline = outlineCaptor.getValue();
|
||||
assertNotNull(capturedOutline);
|
||||
|
||||
// Verify that documents were loaded for page count
|
||||
verify(pdfDocumentFactory).load(mockFile1);
|
||||
verify(pdfDocumentFactory).load(mockFile2);
|
||||
verify(pdfDocumentFactory).load(mockFile3);
|
||||
|
||||
// Verify document closing
|
||||
verify(doc1).close();
|
||||
verify(doc2).close();
|
||||
verify(doc3).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddTableOfContents_WithSingleFile_Success() throws Exception {
|
||||
// Given
|
||||
MultipartFile[] files = {mockFile1};
|
||||
|
||||
when(mockMergedDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockMergedDocument.getNumberOfPages()).thenReturn(3);
|
||||
when(mockMergedDocument.getPage(0)).thenReturn(mockPage1);
|
||||
|
||||
PDDocument doc1 = mock(PDDocument.class);
|
||||
when(pdfDocumentFactory.load(mockFile1)).thenReturn(doc1);
|
||||
when(doc1.getNumberOfPages()).thenReturn(3);
|
||||
|
||||
// When
|
||||
Method addTableOfContentsMethod = MergeController.class.getDeclaredMethod("addTableOfContents", PDDocument.class, MultipartFile[].class);
|
||||
addTableOfContentsMethod.setAccessible(true);
|
||||
addTableOfContentsMethod.invoke(mergeController, mockMergedDocument, files);
|
||||
|
||||
// Then
|
||||
verify(mockCatalog).setDocumentOutline(any(PDDocumentOutline.class));
|
||||
verify(pdfDocumentFactory).load(mockFile1);
|
||||
verify(doc1).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddTableOfContents_WithEmptyArray_Success() throws Exception {
|
||||
// Given
|
||||
MultipartFile[] files = {};
|
||||
when(mockMergedDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
|
||||
// When
|
||||
Method addTableOfContentsMethod = MergeController.class.getDeclaredMethod("addTableOfContents", PDDocument.class, MultipartFile[].class);
|
||||
addTableOfContentsMethod.setAccessible(true);
|
||||
addTableOfContentsMethod.invoke(mergeController, mockMergedDocument, files);
|
||||
|
||||
// Then
|
||||
verify(mockMergedDocument).getDocumentCatalog();
|
||||
verify(mockCatalog).setDocumentOutline(any(PDDocumentOutline.class));
|
||||
verifyNoInteractions(pdfDocumentFactory);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddTableOfContents_WithIOException_HandlesGracefully() throws Exception {
|
||||
// Given
|
||||
MultipartFile[] files = {mockFile1, mockFile2};
|
||||
|
||||
when(mockMergedDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockMergedDocument.getNumberOfPages()).thenReturn(4);
|
||||
when(mockMergedDocument.getPage(anyInt())).thenReturn(mockPage1); // Use anyInt() to avoid stubbing conflicts
|
||||
|
||||
// First document loads successfully
|
||||
PDDocument doc1 = mock(PDDocument.class);
|
||||
when(pdfDocumentFactory.load(mockFile1)).thenReturn(doc1);
|
||||
when(doc1.getNumberOfPages()).thenReturn(2);
|
||||
|
||||
// Second document throws IOException
|
||||
when(pdfDocumentFactory.load(mockFile2)).thenThrow(new IOException("Failed to load document"));
|
||||
|
||||
// When
|
||||
Method addTableOfContentsMethod = MergeController.class.getDeclaredMethod("addTableOfContents", PDDocument.class, MultipartFile[].class);
|
||||
addTableOfContentsMethod.setAccessible(true);
|
||||
|
||||
// Should not throw exception
|
||||
assertDoesNotThrow(() ->
|
||||
addTableOfContentsMethod.invoke(mergeController, mockMergedDocument, files)
|
||||
);
|
||||
|
||||
// Then
|
||||
verify(mockCatalog).setDocumentOutline(any(PDDocumentOutline.class));
|
||||
verify(pdfDocumentFactory).load(mockFile1);
|
||||
verify(pdfDocumentFactory).load(mockFile2);
|
||||
verify(doc1).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddTableOfContents_FilenameWithoutExtension_UsesFullName() throws Exception {
|
||||
// Given
|
||||
MockMultipartFile fileWithoutExtension = new MockMultipartFile("file", "document_no_ext", "application/pdf", "PDF content".getBytes());
|
||||
MultipartFile[] files = {fileWithoutExtension};
|
||||
|
||||
when(mockMergedDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockMergedDocument.getNumberOfPages()).thenReturn(1);
|
||||
when(mockMergedDocument.getPage(0)).thenReturn(mockPage1);
|
||||
|
||||
PDDocument doc = mock(PDDocument.class);
|
||||
when(pdfDocumentFactory.load(fileWithoutExtension)).thenReturn(doc);
|
||||
when(doc.getNumberOfPages()).thenReturn(1);
|
||||
|
||||
// When
|
||||
Method addTableOfContentsMethod = MergeController.class.getDeclaredMethod("addTableOfContents", PDDocument.class, MultipartFile[].class);
|
||||
addTableOfContentsMethod.setAccessible(true);
|
||||
addTableOfContentsMethod.invoke(mergeController, mockMergedDocument, files);
|
||||
|
||||
// Then
|
||||
verify(mockCatalog).setDocumentOutline(any(PDDocumentOutline.class));
|
||||
verify(doc).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddTableOfContents_PageIndexExceedsDocumentPages_HandlesGracefully() throws Exception {
|
||||
// Given
|
||||
MultipartFile[] files = {mockFile1};
|
||||
|
||||
when(mockMergedDocument.getDocumentCatalog()).thenReturn(mockCatalog);
|
||||
when(mockMergedDocument.getNumberOfPages()).thenReturn(0); // No pages in merged document
|
||||
|
||||
PDDocument doc1 = mock(PDDocument.class);
|
||||
when(pdfDocumentFactory.load(mockFile1)).thenReturn(doc1);
|
||||
when(doc1.getNumberOfPages()).thenReturn(3);
|
||||
|
||||
// When
|
||||
Method addTableOfContentsMethod = MergeController.class.getDeclaredMethod("addTableOfContents", PDDocument.class, MultipartFile[].class);
|
||||
addTableOfContentsMethod.setAccessible(true);
|
||||
|
||||
// Should not throw exception
|
||||
assertDoesNotThrow(() ->
|
||||
addTableOfContentsMethod.invoke(mergeController, mockMergedDocument, files)
|
||||
);
|
||||
|
||||
// Then
|
||||
verify(mockCatalog).setDocumentOutline(any(PDDocumentOutline.class));
|
||||
verify(mockMergedDocument, never()).getPage(anyInt());
|
||||
verify(doc1).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMergeDocuments_Success() throws IOException {
|
||||
// Given
|
||||
PDDocument doc1 = mock(PDDocument.class);
|
||||
PDDocument doc2 = mock(PDDocument.class);
|
||||
List<PDDocument> documents = Arrays.asList(doc1, doc2);
|
||||
|
||||
PDPageTree pages1 = mock(PDPageTree.class);
|
||||
PDPageTree pages2 = mock(PDPageTree.class);
|
||||
PDPage page1 = mock(PDPage.class);
|
||||
PDPage page2 = mock(PDPage.class);
|
||||
|
||||
when(pdfDocumentFactory.createNewDocument()).thenReturn(mockMergedDocument);
|
||||
when(doc1.getPages()).thenReturn(pages1);
|
||||
when(doc2.getPages()).thenReturn(pages2);
|
||||
when(pages1.iterator()).thenReturn(Arrays.asList(page1).iterator());
|
||||
when(pages2.iterator()).thenReturn(Arrays.asList(page2).iterator());
|
||||
|
||||
// When
|
||||
PDDocument result = mergeController.mergeDocuments(documents);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
assertEquals(mockMergedDocument, result);
|
||||
verify(mockMergedDocument).addPage(page1);
|
||||
verify(mockMergedDocument).addPage(page2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMergeDocuments_EmptyList_ReturnsEmptyDocument() throws IOException {
|
||||
// Given
|
||||
List<PDDocument> documents = Arrays.asList();
|
||||
|
||||
when(pdfDocumentFactory.createNewDocument()).thenReturn(mockMergedDocument);
|
||||
|
||||
// When
|
||||
PDDocument result = mergeController.mergeDocuments(documents);
|
||||
|
||||
// Then
|
||||
assertNotNull(result);
|
||||
assertEquals(mockMergedDocument, result);
|
||||
verify(mockMergedDocument, never()).addPage(any(PDPage.class));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user