formatting
This commit is contained in:
@@ -9,14 +9,16 @@ public class ApiEndpoint {
|
||||
private String name;
|
||||
private Map<String, JsonNode> parameters;
|
||||
private String description;
|
||||
|
||||
|
||||
public ApiEndpoint(String name, JsonNode postNode) {
|
||||
this.name = name;
|
||||
this.parameters = new HashMap<>();
|
||||
postNode.path("parameters").forEach(paramNode -> {
|
||||
String paramName = paramNode.path("name").asText();
|
||||
parameters.put(paramName, paramNode);
|
||||
});
|
||||
postNode.path("parameters")
|
||||
.forEach(
|
||||
paramNode -> {
|
||||
String paramName = paramNode.path("name").asText();
|
||||
parameters.put(paramName, paramNode);
|
||||
});
|
||||
this.description = postNode.path("description").asText();
|
||||
}
|
||||
|
||||
@@ -32,11 +34,9 @@ public class ApiEndpoint {
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiEndpoint [name=" + name + ", parameters=" + parameters + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiEndpoint [name=" + name + ", parameters=" + parameters + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package stirling.software.SPDF.model;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
@@ -16,9 +17,10 @@ public class ApiKeyAuthenticationToken extends AbstractAuthenticationToken {
|
||||
setAuthenticated(false);
|
||||
}
|
||||
|
||||
public ApiKeyAuthenticationToken(Object principal, String apiKey, Collection<? extends GrantedAuthority> authorities) {
|
||||
public ApiKeyAuthenticationToken(
|
||||
Object principal, String apiKey, Collection<? extends GrantedAuthority> authorities) {
|
||||
super(authorities);
|
||||
this.principal = principal; // principal can be a UserDetails object
|
||||
this.principal = principal; // principal can be a UserDetails object
|
||||
this.credentials = apiKey;
|
||||
super.setAuthenticated(true); // this authentication is trusted
|
||||
}
|
||||
@@ -36,7 +38,8 @@ public class ApiKeyAuthenticationToken extends AbstractAuthenticationToken {
|
||||
@Override
|
||||
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
|
||||
if (isAuthenticated) {
|
||||
throw new IllegalArgumentException("Cannot set this token to trusted. Use constructor which takes a GrantedAuthority list instead.");
|
||||
throw new IllegalArgumentException(
|
||||
"Cannot set this token to trusted. Use constructor which takes a GrantedAuthority list instead.");
|
||||
}
|
||||
super.setAuthenticated(false);
|
||||
}
|
||||
|
||||
@@ -12,357 +12,376 @@ import stirling.software.SPDF.config.YamlPropertySourceFactory;
|
||||
@ConfigurationProperties(prefix = "")
|
||||
@PropertySource(value = "file:./configs/settings.yml", factory = YamlPropertySourceFactory.class)
|
||||
public class ApplicationProperties {
|
||||
private Security security;
|
||||
private System system;
|
||||
private Ui ui;
|
||||
private Endpoints endpoints;
|
||||
private Metrics metrics;
|
||||
private AutomaticallyGenerated automaticallyGenerated;
|
||||
private AutoPipeline autoPipeline;
|
||||
|
||||
public AutoPipeline getAutoPipeline() {
|
||||
return autoPipeline != null ? autoPipeline : new AutoPipeline();
|
||||
}
|
||||
|
||||
public void setAutoPipeline(AutoPipeline autoPipeline) {
|
||||
this.autoPipeline = autoPipeline;
|
||||
}
|
||||
|
||||
public Security getSecurity() {
|
||||
return security != null ? security : new Security();
|
||||
}
|
||||
|
||||
public void setSecurity(Security security) {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
public System getSystem() {
|
||||
return system != null ? system : new System();
|
||||
}
|
||||
|
||||
public void setSystem(System system) {
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
public Ui getUi() {
|
||||
return ui != null ? ui : new Ui();
|
||||
}
|
||||
|
||||
public void setUi(Ui ui) {
|
||||
this.ui = ui;
|
||||
}
|
||||
|
||||
public Endpoints getEndpoints() {
|
||||
return endpoints != null ? endpoints : new Endpoints();
|
||||
}
|
||||
|
||||
public void setEndpoints(Endpoints endpoints) {
|
||||
this.endpoints = endpoints;
|
||||
}
|
||||
|
||||
public Metrics getMetrics() {
|
||||
return metrics != null ? metrics : new Metrics();
|
||||
}
|
||||
|
||||
public void setMetrics(Metrics metrics) {
|
||||
this.metrics = metrics;
|
||||
}
|
||||
|
||||
public AutomaticallyGenerated getAutomaticallyGenerated() {
|
||||
return automaticallyGenerated != null ? automaticallyGenerated : new AutomaticallyGenerated();
|
||||
}
|
||||
|
||||
public void setAutomaticallyGenerated(AutomaticallyGenerated automaticallyGenerated) {
|
||||
this.automaticallyGenerated = automaticallyGenerated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApplicationProperties [security=" + security + ", system=" + system + ", ui=" + ui + ", endpoints="
|
||||
+ endpoints + ", metrics=" + metrics + ", automaticallyGenerated=" + automaticallyGenerated
|
||||
+ ", autoPipeline=" + autoPipeline + "]";
|
||||
}
|
||||
|
||||
public static class AutoPipeline {
|
||||
private String outputFolder;
|
||||
|
||||
public String getOutputFolder() {
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
public void setOutputFolder(String outputFolder) {
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutoPipeline [outputFolder=" + outputFolder + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public static class Security {
|
||||
private Boolean enableLogin;
|
||||
private Boolean csrfDisabled;
|
||||
private InitialLogin initialLogin;
|
||||
private int loginAttemptCount;
|
||||
private long loginResetTimeMinutes;
|
||||
|
||||
|
||||
public int getLoginAttemptCount() {
|
||||
return loginAttemptCount;
|
||||
}
|
||||
|
||||
public void setLoginAttemptCount(int loginAttemptCount) {
|
||||
this.loginAttemptCount = loginAttemptCount;
|
||||
}
|
||||
|
||||
public long getLoginResetTimeMinutes() {
|
||||
return loginResetTimeMinutes;
|
||||
}
|
||||
|
||||
public void setLoginResetTimeMinutes(long loginResetTimeMinutes) {
|
||||
this.loginResetTimeMinutes = loginResetTimeMinutes;
|
||||
}
|
||||
|
||||
public InitialLogin getInitialLogin() {
|
||||
return initialLogin != null ? initialLogin : new InitialLogin();
|
||||
}
|
||||
|
||||
public void setInitialLogin(InitialLogin initialLogin) {
|
||||
this.initialLogin = initialLogin;
|
||||
}
|
||||
|
||||
public Boolean getEnableLogin() {
|
||||
return enableLogin;
|
||||
}
|
||||
|
||||
public void setEnableLogin(Boolean enableLogin) {
|
||||
this.enableLogin = enableLogin;
|
||||
}
|
||||
|
||||
public Boolean getCsrfDisabled() {
|
||||
return csrfDisabled;
|
||||
}
|
||||
|
||||
public void setCsrfDisabled(Boolean csrfDisabled) {
|
||||
this.csrfDisabled = csrfDisabled;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Security [enableLogin=" + enableLogin + ", initialLogin=" + initialLogin + ", csrfDisabled="
|
||||
+ csrfDisabled + "]";
|
||||
}
|
||||
|
||||
public static class InitialLogin {
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InitialLogin [username=" + username + ", password=" + (password != null && !password.isEmpty() ? "MASKED" : "NULL") + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class System {
|
||||
private String defaultLocale;
|
||||
private Boolean googlevisibility;
|
||||
private String rootURIPath;
|
||||
private String customStaticFilePath;
|
||||
private Integer maxFileSize;
|
||||
|
||||
private Boolean enableAlphaFunctionality;
|
||||
|
||||
|
||||
|
||||
|
||||
public Boolean getEnableAlphaFunctionality() {
|
||||
return enableAlphaFunctionality;
|
||||
}
|
||||
|
||||
public void setEnableAlphaFunctionality(Boolean enableAlphaFunctionality) {
|
||||
this.enableAlphaFunctionality = enableAlphaFunctionality;
|
||||
}
|
||||
|
||||
public String getDefaultLocale() {
|
||||
return defaultLocale;
|
||||
}
|
||||
|
||||
public void setDefaultLocale(String defaultLocale) {
|
||||
this.defaultLocale = defaultLocale;
|
||||
}
|
||||
|
||||
public Boolean getGooglevisibility() {
|
||||
return googlevisibility;
|
||||
}
|
||||
|
||||
public void setGooglevisibility(Boolean googlevisibility) {
|
||||
this.googlevisibility = googlevisibility;
|
||||
}
|
||||
|
||||
public String getRootURIPath() {
|
||||
return rootURIPath;
|
||||
}
|
||||
|
||||
public void setRootURIPath(String rootURIPath) {
|
||||
this.rootURIPath = rootURIPath;
|
||||
}
|
||||
|
||||
public String getCustomStaticFilePath() {
|
||||
return customStaticFilePath;
|
||||
}
|
||||
|
||||
public void setCustomStaticFilePath(String customStaticFilePath) {
|
||||
this.customStaticFilePath = customStaticFilePath;
|
||||
}
|
||||
|
||||
public Integer getMaxFileSize() {
|
||||
return maxFileSize;
|
||||
}
|
||||
|
||||
public void setMaxFileSize(Integer maxFileSize) {
|
||||
this.maxFileSize = maxFileSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility
|
||||
+ ", rootURIPath=" + rootURIPath + ", customStaticFilePath=" + customStaticFilePath
|
||||
+ ", maxFileSize=" + maxFileSize + ", enableAlphaFunctionality=" + enableAlphaFunctionality + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class Ui {
|
||||
private String appName;
|
||||
private String homeDescription;
|
||||
private String appNameNavbar;
|
||||
|
||||
public String getAppName() {
|
||||
if(appName != null && appName.trim().length() == 0)
|
||||
return null;
|
||||
return appName;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public String getHomeDescription() {
|
||||
if(homeDescription != null && homeDescription.trim().length() == 0)
|
||||
return null;
|
||||
return homeDescription;
|
||||
}
|
||||
|
||||
public void setHomeDescription(String homeDescription) {
|
||||
this.homeDescription = homeDescription;
|
||||
}
|
||||
|
||||
public String getAppNameNavbar() {
|
||||
if(appNameNavbar != null && appNameNavbar.trim().length() == 0)
|
||||
return null;
|
||||
return appNameNavbar;
|
||||
}
|
||||
|
||||
public void setAppNameNavbar(String appNameNavbar) {
|
||||
this.appNameNavbar = appNameNavbar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInterface [appName=" + appName + ", homeDescription=" + homeDescription + ", appNameNavbar=" + appNameNavbar + "]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Endpoints {
|
||||
private List<String> toRemove;
|
||||
private List<String> groupsToRemove;
|
||||
|
||||
public List<String> getToRemove() {
|
||||
return toRemove;
|
||||
}
|
||||
|
||||
public void setToRemove(List<String> toRemove) {
|
||||
this.toRemove = toRemove;
|
||||
}
|
||||
|
||||
public List<String> getGroupsToRemove() {
|
||||
return groupsToRemove;
|
||||
}
|
||||
|
||||
public void setGroupsToRemove(List<String> groupsToRemove) {
|
||||
this.groupsToRemove = groupsToRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Endpoints [toRemove=" + toRemove + ", groupsToRemove=" + groupsToRemove + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class Metrics {
|
||||
private Boolean enabled;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Metrics [enabled=" + enabled + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class AutomaticallyGenerated {
|
||||
private String key;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutomaticallyGenerated [key=" + (key != null && !key.isEmpty() ? "MASKED" : "NULL") + "]";
|
||||
}
|
||||
|
||||
}
|
||||
private Security security;
|
||||
private System system;
|
||||
private Ui ui;
|
||||
private Endpoints endpoints;
|
||||
private Metrics metrics;
|
||||
private AutomaticallyGenerated automaticallyGenerated;
|
||||
private AutoPipeline autoPipeline;
|
||||
|
||||
public AutoPipeline getAutoPipeline() {
|
||||
return autoPipeline != null ? autoPipeline : new AutoPipeline();
|
||||
}
|
||||
|
||||
public void setAutoPipeline(AutoPipeline autoPipeline) {
|
||||
this.autoPipeline = autoPipeline;
|
||||
}
|
||||
|
||||
public Security getSecurity() {
|
||||
return security != null ? security : new Security();
|
||||
}
|
||||
|
||||
public void setSecurity(Security security) {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
public System getSystem() {
|
||||
return system != null ? system : new System();
|
||||
}
|
||||
|
||||
public void setSystem(System system) {
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
public Ui getUi() {
|
||||
return ui != null ? ui : new Ui();
|
||||
}
|
||||
|
||||
public void setUi(Ui ui) {
|
||||
this.ui = ui;
|
||||
}
|
||||
|
||||
public Endpoints getEndpoints() {
|
||||
return endpoints != null ? endpoints : new Endpoints();
|
||||
}
|
||||
|
||||
public void setEndpoints(Endpoints endpoints) {
|
||||
this.endpoints = endpoints;
|
||||
}
|
||||
|
||||
public Metrics getMetrics() {
|
||||
return metrics != null ? metrics : new Metrics();
|
||||
}
|
||||
|
||||
public void setMetrics(Metrics metrics) {
|
||||
this.metrics = metrics;
|
||||
}
|
||||
|
||||
public AutomaticallyGenerated getAutomaticallyGenerated() {
|
||||
return automaticallyGenerated != null
|
||||
? automaticallyGenerated
|
||||
: new AutomaticallyGenerated();
|
||||
}
|
||||
|
||||
public void setAutomaticallyGenerated(AutomaticallyGenerated automaticallyGenerated) {
|
||||
this.automaticallyGenerated = automaticallyGenerated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApplicationProperties [security="
|
||||
+ security
|
||||
+ ", system="
|
||||
+ system
|
||||
+ ", ui="
|
||||
+ ui
|
||||
+ ", endpoints="
|
||||
+ endpoints
|
||||
+ ", metrics="
|
||||
+ metrics
|
||||
+ ", automaticallyGenerated="
|
||||
+ automaticallyGenerated
|
||||
+ ", autoPipeline="
|
||||
+ autoPipeline
|
||||
+ "]";
|
||||
}
|
||||
|
||||
public static class AutoPipeline {
|
||||
private String outputFolder;
|
||||
|
||||
public String getOutputFolder() {
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
public void setOutputFolder(String outputFolder) {
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutoPipeline [outputFolder=" + outputFolder + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Security {
|
||||
private Boolean enableLogin;
|
||||
private Boolean csrfDisabled;
|
||||
private InitialLogin initialLogin;
|
||||
private int loginAttemptCount;
|
||||
private long loginResetTimeMinutes;
|
||||
|
||||
public int getLoginAttemptCount() {
|
||||
return loginAttemptCount;
|
||||
}
|
||||
|
||||
public void setLoginAttemptCount(int loginAttemptCount) {
|
||||
this.loginAttemptCount = loginAttemptCount;
|
||||
}
|
||||
|
||||
public long getLoginResetTimeMinutes() {
|
||||
return loginResetTimeMinutes;
|
||||
}
|
||||
|
||||
public void setLoginResetTimeMinutes(long loginResetTimeMinutes) {
|
||||
this.loginResetTimeMinutes = loginResetTimeMinutes;
|
||||
}
|
||||
|
||||
public InitialLogin getInitialLogin() {
|
||||
return initialLogin != null ? initialLogin : new InitialLogin();
|
||||
}
|
||||
|
||||
public void setInitialLogin(InitialLogin initialLogin) {
|
||||
this.initialLogin = initialLogin;
|
||||
}
|
||||
|
||||
public Boolean getEnableLogin() {
|
||||
return enableLogin;
|
||||
}
|
||||
|
||||
public void setEnableLogin(Boolean enableLogin) {
|
||||
this.enableLogin = enableLogin;
|
||||
}
|
||||
|
||||
public Boolean getCsrfDisabled() {
|
||||
return csrfDisabled;
|
||||
}
|
||||
|
||||
public void setCsrfDisabled(Boolean csrfDisabled) {
|
||||
this.csrfDisabled = csrfDisabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Security [enableLogin="
|
||||
+ enableLogin
|
||||
+ ", initialLogin="
|
||||
+ initialLogin
|
||||
+ ", csrfDisabled="
|
||||
+ csrfDisabled
|
||||
+ "]";
|
||||
}
|
||||
|
||||
public static class InitialLogin {
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InitialLogin [username="
|
||||
+ username
|
||||
+ ", password="
|
||||
+ (password != null && !password.isEmpty() ? "MASKED" : "NULL")
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class System {
|
||||
private String defaultLocale;
|
||||
private Boolean googlevisibility;
|
||||
private String rootURIPath;
|
||||
private String customStaticFilePath;
|
||||
private Integer maxFileSize;
|
||||
|
||||
private Boolean enableAlphaFunctionality;
|
||||
|
||||
public Boolean getEnableAlphaFunctionality() {
|
||||
return enableAlphaFunctionality;
|
||||
}
|
||||
|
||||
public void setEnableAlphaFunctionality(Boolean enableAlphaFunctionality) {
|
||||
this.enableAlphaFunctionality = enableAlphaFunctionality;
|
||||
}
|
||||
|
||||
public String getDefaultLocale() {
|
||||
return defaultLocale;
|
||||
}
|
||||
|
||||
public void setDefaultLocale(String defaultLocale) {
|
||||
this.defaultLocale = defaultLocale;
|
||||
}
|
||||
|
||||
public Boolean getGooglevisibility() {
|
||||
return googlevisibility;
|
||||
}
|
||||
|
||||
public void setGooglevisibility(Boolean googlevisibility) {
|
||||
this.googlevisibility = googlevisibility;
|
||||
}
|
||||
|
||||
public String getRootURIPath() {
|
||||
return rootURIPath;
|
||||
}
|
||||
|
||||
public void setRootURIPath(String rootURIPath) {
|
||||
this.rootURIPath = rootURIPath;
|
||||
}
|
||||
|
||||
public String getCustomStaticFilePath() {
|
||||
return customStaticFilePath;
|
||||
}
|
||||
|
||||
public void setCustomStaticFilePath(String customStaticFilePath) {
|
||||
this.customStaticFilePath = customStaticFilePath;
|
||||
}
|
||||
|
||||
public Integer getMaxFileSize() {
|
||||
return maxFileSize;
|
||||
}
|
||||
|
||||
public void setMaxFileSize(Integer maxFileSize) {
|
||||
this.maxFileSize = maxFileSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "System [defaultLocale="
|
||||
+ defaultLocale
|
||||
+ ", googlevisibility="
|
||||
+ googlevisibility
|
||||
+ ", rootURIPath="
|
||||
+ rootURIPath
|
||||
+ ", customStaticFilePath="
|
||||
+ customStaticFilePath
|
||||
+ ", maxFileSize="
|
||||
+ maxFileSize
|
||||
+ ", enableAlphaFunctionality="
|
||||
+ enableAlphaFunctionality
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Ui {
|
||||
private String appName;
|
||||
private String homeDescription;
|
||||
private String appNameNavbar;
|
||||
|
||||
public String getAppName() {
|
||||
if (appName != null && appName.trim().length() == 0) return null;
|
||||
return appName;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public String getHomeDescription() {
|
||||
if (homeDescription != null && homeDescription.trim().length() == 0) return null;
|
||||
return homeDescription;
|
||||
}
|
||||
|
||||
public void setHomeDescription(String homeDescription) {
|
||||
this.homeDescription = homeDescription;
|
||||
}
|
||||
|
||||
public String getAppNameNavbar() {
|
||||
if (appNameNavbar != null && appNameNavbar.trim().length() == 0) return null;
|
||||
return appNameNavbar;
|
||||
}
|
||||
|
||||
public void setAppNameNavbar(String appNameNavbar) {
|
||||
this.appNameNavbar = appNameNavbar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInterface [appName="
|
||||
+ appName
|
||||
+ ", homeDescription="
|
||||
+ homeDescription
|
||||
+ ", appNameNavbar="
|
||||
+ appNameNavbar
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Endpoints {
|
||||
private List<String> toRemove;
|
||||
private List<String> groupsToRemove;
|
||||
|
||||
public List<String> getToRemove() {
|
||||
return toRemove;
|
||||
}
|
||||
|
||||
public void setToRemove(List<String> toRemove) {
|
||||
this.toRemove = toRemove;
|
||||
}
|
||||
|
||||
public List<String> getGroupsToRemove() {
|
||||
return groupsToRemove;
|
||||
}
|
||||
|
||||
public void setGroupsToRemove(List<String> groupsToRemove) {
|
||||
this.groupsToRemove = groupsToRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Endpoints [toRemove=" + toRemove + ", groupsToRemove=" + groupsToRemove + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Metrics {
|
||||
private Boolean enabled;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Metrics [enabled=" + enabled + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class AutomaticallyGenerated {
|
||||
private String key;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutomaticallyGenerated [key="
|
||||
+ (key != null && !key.isEmpty() ? "MASKED" : "NULL")
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package stirling.software.SPDF.model;
|
||||
|
||||
public class AttemptCounter {
|
||||
private int attemptCount;
|
||||
private long lastAttemptTime;
|
||||
|
||||
@@ -13,19 +13,15 @@ import jakarta.persistence.Table;
|
||||
@Table(name = "authorities")
|
||||
public class Authority {
|
||||
|
||||
public Authority() {
|
||||
public Authority() {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Authority(String authority, User user) {
|
||||
this.authority = authority;
|
||||
this.user = user;
|
||||
user.getAuthorities().add(this);
|
||||
}
|
||||
public Authority(String authority, User user) {
|
||||
this.authority = authority;
|
||||
this.user = user;
|
||||
user.getAuthorities().add(this);
|
||||
}
|
||||
|
||||
|
||||
@Id
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@@ -36,29 +32,27 @@ public class Authority {
|
||||
@JoinColumn(name = "user_id")
|
||||
private User user;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAuthority() {
|
||||
return authority;
|
||||
}
|
||||
public String getAuthority() {
|
||||
return authority;
|
||||
}
|
||||
|
||||
public void setAuthority(String authority) {
|
||||
this.authority = authority;
|
||||
}
|
||||
public void setAuthority(String authority) {
|
||||
this.authority = authority;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package stirling.software.SPDF.model;
|
||||
|
||||
public class PDFText {
|
||||
private final int pageIndex;
|
||||
private final float x1;
|
||||
@@ -39,4 +40,4 @@ public class PDFText {
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,38 +24,37 @@ public class PersistentLogin {
|
||||
@Column(name = "last_used", nullable = false)
|
||||
private Date lastUsed;
|
||||
|
||||
public String getSeries() {
|
||||
return series;
|
||||
}
|
||||
public String getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(String series) {
|
||||
this.series = series;
|
||||
}
|
||||
public void setSeries(String series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Date getLastUsed() {
|
||||
return lastUsed;
|
||||
}
|
||||
public Date getLastUsed() {
|
||||
return lastUsed;
|
||||
}
|
||||
|
||||
public void setLastUsed(Date lastUsed) {
|
||||
this.lastUsed = lastUsed;
|
||||
}
|
||||
public void setLastUsed(Date lastUsed) {
|
||||
this.lastUsed = lastUsed;
|
||||
}
|
||||
|
||||
|
||||
// Getters, setters, etc.
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package stirling.software.SPDF.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@@ -14,7 +15,6 @@ public class PipelineConfig {
|
||||
@JsonProperty("outputFileName")
|
||||
private String outputPattern;
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -46,6 +46,4 @@ public class PipelineConfig {
|
||||
public void setOutputPattern(String outputPattern) {
|
||||
this.outputPattern = outputPattern;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,30 +3,27 @@ package stirling.software.SPDF.model;
|
||||
import java.util.Map;
|
||||
|
||||
public class PipelineOperation {
|
||||
private String operation;
|
||||
private Map<String, Object> parameters;
|
||||
private String operation;
|
||||
private Map<String, Object> parameters;
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
public Map<String, Object> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
public void setParameters(Map<String, Object> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public void setParameters(Map<String, Object> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PipelineOperation [operation=" + operation + ", parameters=" + parameters + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PipelineOperation [operation=" + operation + ", parameters=" + parameters + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package stirling.software.SPDF.model;
|
||||
|
||||
public enum Role {
|
||||
|
||||
// Unlimited access
|
||||
|
||||
// Unlimited access
|
||||
ADMIN("ROLE_ADMIN", Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
|
||||
// Unlimited access
|
||||
@@ -15,12 +16,11 @@ public enum Role {
|
||||
|
||||
// 0 API calls per day and 20 web calls
|
||||
WEB_ONLY_USER("ROLE_WEB_ONLY_USER", 0, 20),
|
||||
|
||||
|
||||
INTERNAL_API_USER("STIRLING-PDF-BACKEND-API-USER", Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
|
||||
DEMO_USER("ROLE_DEMO_USER", 100, 100);
|
||||
|
||||
INTERNAL_API_USER("STIRLING-PDF-BACKEND-API-USER", Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
|
||||
DEMO_USER("ROLE_DEMO_USER", 100, 100);
|
||||
|
||||
private final String roleId;
|
||||
private final int apiCallsPerDay;
|
||||
private final int webCallsPerDay;
|
||||
@@ -42,7 +42,7 @@ public enum Role {
|
||||
public int getWebCallsPerDay() {
|
||||
return webCallsPerDay;
|
||||
}
|
||||
|
||||
|
||||
public static Role fromString(String roleId) {
|
||||
for (Role role : Role.values()) {
|
||||
if (role.getRoleId().equalsIgnoreCase(roleId)) {
|
||||
@@ -51,5 +51,4 @@ public enum Role {
|
||||
}
|
||||
throw new IllegalArgumentException("No Role defined for id: " + roleId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
package stirling.software.SPDF.model;
|
||||
|
||||
public enum SortTypes {
|
||||
REVERSE_ORDER, DUPLEX_SORT, BOOKLET_SORT, SIDE_STITCH_BOOKLET_SORT, ODD_EVEN_SPLIT, REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST,
|
||||
}
|
||||
REVERSE_ORDER,
|
||||
DUPLEX_SORT,
|
||||
BOOKLET_SORT,
|
||||
SIDE_STITCH_BOOKLET_SORT,
|
||||
ODD_EVEN_SPLIT,
|
||||
REMOVE_FIRST,
|
||||
REMOVE_LAST,
|
||||
REMOVE_FIRST_AND_LAST,
|
||||
}
|
||||
|
||||
@@ -19,15 +19,16 @@ import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.MapKeyColumn;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
public class User {
|
||||
|
||||
@Id
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "user_id")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Column(name = "username", unique = true)
|
||||
private String username;
|
||||
|
||||
@@ -36,13 +37,13 @@ public class User {
|
||||
|
||||
@Column(name = "apiKey")
|
||||
private String apiKey;
|
||||
|
||||
|
||||
@Column(name = "enabled")
|
||||
private boolean enabled;
|
||||
|
||||
@Column(name = "isFirstLogin")
|
||||
private Boolean isFirstLogin = false;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "user")
|
||||
private Set<Authority> authorities = new HashSet<>();
|
||||
|
||||
@@ -50,85 +51,83 @@ public class User {
|
||||
@MapKeyColumn(name = "setting_key")
|
||||
@Column(name = "setting_value")
|
||||
@CollectionTable(name = "user_settings", joinColumns = @JoinColumn(name = "user_id"))
|
||||
private Map<String, String> settings = new HashMap<>(); // Key-value pairs of settings.
|
||||
private Map<String, String> settings = new HashMap<>(); // Key-value pairs of settings.
|
||||
|
||||
|
||||
public boolean isFirstLogin() {
|
||||
return isFirstLogin != null && isFirstLogin;
|
||||
}
|
||||
public boolean isFirstLogin() {
|
||||
return isFirstLogin != null && isFirstLogin;
|
||||
}
|
||||
|
||||
public void setFirstLogin(boolean isFirstLogin) {
|
||||
this.isFirstLogin = isFirstLogin;
|
||||
}
|
||||
public void setFirstLogin(boolean isFirstLogin) {
|
||||
this.isFirstLogin = isFirstLogin;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public Map<String, String> getSettings() {
|
||||
return settings;
|
||||
}
|
||||
public Map<String, String> getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public void setSettings(Map<String, String> settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
public void setSettings(Map<String, String> settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public Set<Authority> getAuthorities() {
|
||||
return authorities;
|
||||
}
|
||||
public Set<Authority> getAuthorities() {
|
||||
return authorities;
|
||||
}
|
||||
|
||||
public void setAuthorities(Set<Authority> authorities) {
|
||||
this.authorities = authorities;
|
||||
}
|
||||
|
||||
public void addAuthorities(Set<Authority> authorities) {
|
||||
this.authorities.addAll(authorities);
|
||||
}
|
||||
public void addAuthority(Authority authorities) {
|
||||
this.authorities.add(authorities);
|
||||
}
|
||||
|
||||
public String getRolesAsString() {
|
||||
return this.authorities.stream()
|
||||
.map(Authority::getAuthority)
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
public void setAuthorities(Set<Authority> authorities) {
|
||||
this.authorities = authorities;
|
||||
}
|
||||
|
||||
public void addAuthorities(Set<Authority> authorities) {
|
||||
this.authorities.addAll(authorities);
|
||||
}
|
||||
|
||||
public void addAuthority(Authority authorities) {
|
||||
this.authorities.add(authorities);
|
||||
}
|
||||
|
||||
public String getRolesAsString() {
|
||||
return this.authorities.stream()
|
||||
.map(Authority::getAuthority)
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -12,6 +13,6 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class GeneralFile {
|
||||
|
||||
@Schema(description = "The input file")
|
||||
private MultipartFile fileInput;
|
||||
@Schema(description = "The input file")
|
||||
private MultipartFile fileInput;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -11,6 +12,6 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class ImageFile {
|
||||
@Schema(description = "The input image file")
|
||||
@Schema(description = "The input image file")
|
||||
private MultipartFile fileInput;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,15 @@ package stirling.software.SPDF.model.api;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class MultiplePDFFiles {
|
||||
@Schema(description = "The input PDF files", type = "array", format = "binary")
|
||||
@Schema(description = "The input PDF files", type = "array", format = "binary")
|
||||
private MultipartFile[] fileInput;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PDFComparison extends PDFFile {
|
||||
|
||||
@Schema(description = "The comparison type, accepts Greater, Equal, Less than", allowableValues = {
|
||||
"Greater", "Equal", "Less" })
|
||||
|
||||
@Schema(
|
||||
description = "The comparison type, accepts Greater, Equal, Less than",
|
||||
allowableValues = {"Greater", "Equal", "Less"})
|
||||
private String comparator;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PDFComparisonAndCount extends PDFComparison {
|
||||
@Schema(description = "Count")
|
||||
@Schema(description = "Count")
|
||||
private String pageCount;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package stirling.software.SPDF.model.api;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
public class PDFFile {
|
||||
@Schema(description = "The input PDF file")
|
||||
@Schema(description = "The input PDF file")
|
||||
private MultipartFile fileInput;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PDFWithImageFormatRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The output image format e.g., 'png', 'jpeg', or 'gif'",
|
||||
allowableValues = { "png", "jpeg", "gif" })
|
||||
@Schema(
|
||||
description = "The output image format e.g., 'png', 'jpeg', or 'gif'",
|
||||
allowableValues = {"png", "jpeg", "gif"})
|
||||
private String format;
|
||||
}
|
||||
|
||||
@@ -7,36 +7,38 @@ import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PDFWithPageNums extends PDFFile {
|
||||
|
||||
@Schema(description = "The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')\"")
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')\"")
|
||||
private String pageNumbers;
|
||||
|
||||
@Hidden
|
||||
public List<Integer> getPageNumbersList(){
|
||||
int pageCount = 0;
|
||||
try {
|
||||
pageCount = PDDocument.load(getFileInput().getInputStream()).getNumberOfPages();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return GeneralUtils.parsePageString(pageNumbers, pageCount);
|
||||
|
||||
}
|
||||
|
||||
@Hidden
|
||||
public List<Integer> getPageNumbersList(PDDocument doc){
|
||||
int pageCount = 0;
|
||||
pageCount = doc.getNumberOfPages();
|
||||
return GeneralUtils.parsePageString(pageNumbers, pageCount);
|
||||
|
||||
}
|
||||
|
||||
@Hidden
|
||||
public List<Integer> getPageNumbersList() {
|
||||
int pageCount = 0;
|
||||
try {
|
||||
pageCount = PDDocument.load(getFileInput().getInputStream()).getNumberOfPages();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return GeneralUtils.parsePageString(pageNumbers, pageCount);
|
||||
}
|
||||
|
||||
@Hidden
|
||||
public List<Integer> getPageNumbersList(PDDocument doc) {
|
||||
int pageCount = 0;
|
||||
pageCount = doc.getNumberOfPages();
|
||||
return GeneralUtils.parsePageString(pageNumbers, pageCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PDFWithPageSize extends PDFFile {
|
||||
|
||||
@Schema(description = "The scale of pages in the output PDF. Acceptable values are A0-A6, LETTER, LEGAL.",
|
||||
allowableValues = {
|
||||
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "LETTER", "LEGAL"
|
||||
})
|
||||
private String pageSize;
|
||||
@Schema(
|
||||
description =
|
||||
"The scale of pages in the output PDF. Acceptable values are A0-A6, LETTER, LEGAL.",
|
||||
allowableValues = {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "LETTER", "LEGAL"})
|
||||
private String pageSize;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SplitPdfBySectionsRequest extends PDFFile {
|
||||
@Schema(description = "Number of horizontal divisions for each PDF page", example = "2")
|
||||
@Schema(description = "Number of horizontal divisions for each PDF page", example = "2")
|
||||
private int horizontalDivisions;
|
||||
|
||||
@Schema(description = "Number of vertical divisions for each PDF page", example = "2")
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
package stirling.software.SPDF.model.api.converters;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ConvertToImageRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The output image format", allowableValues = {"png", "jpeg", "jpg", "gif"})
|
||||
@Schema(
|
||||
description = "The output image format",
|
||||
allowableValues = {"png", "jpeg", "jpg", "gif"})
|
||||
private String imageFormat;
|
||||
|
||||
@Schema(description = "Choose between a single image containing all pages or separate images for each page", allowableValues = {"single", "multiple"})
|
||||
@Schema(
|
||||
description =
|
||||
"Choose between a single image containing all pages or separate images for each page",
|
||||
allowableValues = {"single", "multiple"})
|
||||
private String singleOrMultiple;
|
||||
|
||||
@Schema(description = "The color type of the output image(s)", allowableValues = {"color", "greyscale", "blackwhite"})
|
||||
@Schema(
|
||||
description = "The color type of the output image(s)",
|
||||
allowableValues = {"color", "greyscale", "blackwhite"})
|
||||
private String colorType;
|
||||
|
||||
@Schema(description = "The DPI (dots per inch) for the output image(s)")
|
||||
|
||||
@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api.converters;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -13,15 +14,18 @@ public class ConvertToPdfRequest {
|
||||
@Schema(description = "The input images to be converted to a PDF file")
|
||||
private MultipartFile[] fileInput;
|
||||
|
||||
@Schema(description = "Option to determine how the image will fit onto the page",
|
||||
allowableValues = { "fillPage", "fitDocumentToImage", "maintainAspectRatio" })
|
||||
@Schema(
|
||||
description = "Option to determine how the image will fit onto the page",
|
||||
allowableValues = {"fillPage", "fitDocumentToImage", "maintainAspectRatio"})
|
||||
private String fitOption;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "The color type of the output image(s)", allowableValues = {"color", "greyscale", "blackwhite"})
|
||||
@Schema(
|
||||
description = "The color type of the output image(s)",
|
||||
allowableValues = {"color", "greyscale", "blackwhite"})
|
||||
private String colorType;
|
||||
|
||||
@Schema(description = "Whether to automatically rotate the images to better fit the PDF page", example = "true")
|
||||
@Schema(
|
||||
description = "Whether to automatically rotate the images to better fit the PDF page",
|
||||
example = "true")
|
||||
private boolean autoRotate;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package stirling.software.SPDF.model.api.converters;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PdfToPresentationRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The output Presentation format", allowableValues = {"ppt", "pptx", "odp"})
|
||||
@Schema(
|
||||
description = "The output Presentation format",
|
||||
allowableValues = {"ppt", "pptx", "odp"})
|
||||
private String outputFormat;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package stirling.software.SPDF.model.api.converters;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PdfToTextOrRTFRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The output Text or RTF format", allowableValues = {"rtf", "txt:Text"})
|
||||
@Schema(
|
||||
description = "The output Text or RTF format",
|
||||
allowableValues = {"rtf", "txt:Text"})
|
||||
private String outputFormat;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package stirling.software.SPDF.model.api.converters;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PdfToWordRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The output Word document format", allowableValues = {"doc", "docx", "odt"})
|
||||
@Schema(
|
||||
description = "The output Word document format",
|
||||
allowableValues = {"doc", "docx", "odt"})
|
||||
private String outputFormat;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package stirling.software.SPDF.model.api.converters;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package stirling.software.SPDF.model.api.extract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PDFFilePage extends PDFFile {
|
||||
|
||||
|
||||
@Schema(description = "Number of chosen page", type = "number")
|
||||
private int pageId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package stirling.software.SPDF.model.api.filter;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ContainsTextRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(description = "The text to check for", required = true)
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package stirling.software.SPDF.model.api.filter;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFComparison;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class FileSizeRequest extends PDFComparison {
|
||||
|
||||
@Schema(description = "File Size", required = true)
|
||||
private String fileSize;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package stirling.software.SPDF.model.api.filter;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFComparison;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PageRotationRequest extends PDFComparison {
|
||||
|
||||
@Schema(description = "Rotation in degrees", required = true)
|
||||
private int rotation;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package stirling.software.SPDF.model.api.filter;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFComparison;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PageSizeRequest extends PDFComparison {
|
||||
|
||||
@Schema(description = "Standard Page Size", required = true)
|
||||
private String standardPageSize;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CropPdfForm extends PDFFile {
|
||||
|
||||
|
||||
@Schema(description = "The x-coordinate of the top-left corner of the crop area", type = "number")
|
||||
@Schema(
|
||||
description = "The x-coordinate of the top-left corner of the crop area",
|
||||
type = "number")
|
||||
private float x;
|
||||
|
||||
@Schema(description = "The y-coordinate of the top-left corner of the crop area", type = "number")
|
||||
@Schema(
|
||||
description = "The y-coordinate of the top-left corner of the crop area",
|
||||
type = "number")
|
||||
private float y;
|
||||
|
||||
@Schema(description = "The width of the crop area", type = "number")
|
||||
@@ -21,4 +26,3 @@ public class CropPdfForm extends PDFFile {
|
||||
@Schema(description = "The height of the crop area", type = "number")
|
||||
private float height;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MergeMultiplePagesRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The number of pages to fit onto a single sheet in the output PDF.",
|
||||
type = "integer", allowableValues = {"2", "3", "4", "9", "16"})
|
||||
@Schema(
|
||||
description = "The number of pages to fit onto a single sheet in the output PDF.",
|
||||
type = "integer",
|
||||
allowableValues = {"2", "3", "4", "9", "16"})
|
||||
private int pagesPerSheet;
|
||||
|
||||
|
||||
@Schema(description = "Boolean for if you wish to add border around the pages")
|
||||
private boolean addBorder;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.MultiplePDFFiles;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MergePdfsRequest extends MultiplePDFFiles {
|
||||
|
||||
@Schema(description = "The type of sorting to be applied on the input files before merging.",
|
||||
|
||||
@Schema(
|
||||
description = "The type of sorting to be applied on the input files before merging.",
|
||||
allowableValues = {
|
||||
"orderProvided",
|
||||
"byFileName",
|
||||
"byDateModified",
|
||||
"byDateCreated",
|
||||
"orderProvided",
|
||||
"byFileName",
|
||||
"byDateModified",
|
||||
"byDateCreated",
|
||||
"byPDFTitle"
|
||||
},
|
||||
},
|
||||
defaultValue = "orderProvided")
|
||||
private String sortType = "orderProvided";
|
||||
}
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OverlayPdfsRequest extends 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.")
|
||||
@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.")
|
||||
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", required = true)
|
||||
@Schema(
|
||||
description =
|
||||
"The mode of overlaying: 'SequentialOverlay' for sequential application, 'InterleavedOverlay' for round-robin application, 'FixedRepeatOverlay' for fixed repetition based on provided counts",
|
||||
required = true)
|
||||
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.", required = false)
|
||||
@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.",
|
||||
required = false)
|
||||
private int[] counts;
|
||||
|
||||
|
||||
@Schema(description = "Overlay position 0 is Foregound, 1 is Background")
|
||||
private int overlayPosition;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.SortTypes;
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RearrangePagesRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(implementation = SortTypes.class, description = "The custom mode for page rearrangement. Valid values are:\n"
|
||||
+ "REVERSE_ORDER: Reverses the order of all pages.\n"
|
||||
+ "DUPLEX_SORT: Sorts pages as if all fronts were scanned then all backs in reverse (1, n, 2, n-1, ...). "
|
||||
+ "BOOKLET_SORT: Arranges pages for booklet printing (last, first, second, second last, ...).\n"
|
||||
+ "ODD_EVEN_SPLIT: Splits and arranges pages into odd and even numbered pages.\n"
|
||||
+ "REMOVE_FIRST: Removes the first page.\n" + "REMOVE_LAST: Removes the last page.\n"
|
||||
+ "REMOVE_FIRST_AND_LAST: Removes both the first and the last pages.\n")
|
||||
@Schema(
|
||||
implementation = SortTypes.class,
|
||||
description =
|
||||
"The custom mode for page rearrangement. Valid values are:\n"
|
||||
+ "REVERSE_ORDER: Reverses the order of all pages.\n"
|
||||
+ "DUPLEX_SORT: Sorts pages as if all fronts were scanned then all backs in reverse (1, n, 2, n-1, ...). "
|
||||
+ "BOOKLET_SORT: Arranges pages for booklet printing (last, first, second, second last, ...).\n"
|
||||
+ "ODD_EVEN_SPLIT: Splits and arranges pages into odd and even numbered pages.\n"
|
||||
+ "REMOVE_FIRST: Removes the first page.\n"
|
||||
+ "REMOVE_LAST: Removes the last page.\n"
|
||||
+ "REMOVE_FIRST_AND_LAST: Removes both the first and the last pages.\n")
|
||||
private String customMode;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RotatePDFRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The angle by which to rotate the PDF file. This should be a multiple of 90.", example = "90")
|
||||
@Schema(
|
||||
description =
|
||||
"The angle by which to rotate the PDF file. This should be a multiple of 90.",
|
||||
example = "90")
|
||||
private Integer angle;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFWithPageSize;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ScalePagesRequest extends PDFWithPageSize {
|
||||
|
||||
@Schema(description = "The scale of the content on the pages of the output PDF. Acceptable values are floats.")
|
||||
@Schema(
|
||||
description =
|
||||
"The scale of the content on the pages of the output PDF. Acceptable values are floats.")
|
||||
private float scaleFactor;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SplitPdfBySizeOrCountRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "Determines the type of split: 0 for size, 1 for page count, 2 for document count", required = false, defaultValue = "0")
|
||||
private int splitType;
|
||||
@Schema(
|
||||
description =
|
||||
"Determines the type of split: 0 for size, 1 for page count, 2 for document count",
|
||||
required = false,
|
||||
defaultValue = "0")
|
||||
private int splitType;
|
||||
|
||||
|
||||
@Schema(description = "Value for split: size in MB (e.g., '10MB') or number of pages (e.g., '5')", required = false, defaultValue = "10MB")
|
||||
@Schema(
|
||||
description =
|
||||
"Value for split: size in MB (e.g., '10MB') or number of pages (e.g., '5')",
|
||||
required = false,
|
||||
defaultValue = "10MB")
|
||||
private String splitValue;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package stirling.software.SPDF.model.api.misc;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AddPageNumbersRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(description = "Custom margin: small/medium/large", allowableValues = {"small", "medium", "large"})
|
||||
@Schema(
|
||||
description = "Custom margin: small/medium/large",
|
||||
allowableValues = {"small", "medium", "large"})
|
||||
private String customMargin;
|
||||
|
||||
@Schema(description = "Position: 1 of 9 positions", minimum = "1", maximum = "9")
|
||||
@@ -21,6 +24,8 @@ public class AddPageNumbersRequest extends PDFWithPageNums {
|
||||
@Schema(description = "Which pages to number, default all")
|
||||
private String pagesToNumber;
|
||||
|
||||
@Schema(description = "Custom text: defaults to just number but can have things like \"Page {n} of {p}\"")
|
||||
@Schema(
|
||||
description =
|
||||
"Custom text: defaults to just number but can have things like \"Page {n} of {p}\"")
|
||||
private String customText;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package stirling.software.SPDF.model.api.misc;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AutoSplitPdfRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "Flag indicating if the duplex mode is active, where the page after the divider also gets removed.", required = false, defaultValue = "false")
|
||||
@Schema(
|
||||
description =
|
||||
"Flag indicating if the duplex mode is active, where the page after the divider also gets removed.",
|
||||
required = false,
|
||||
defaultValue = "false")
|
||||
private boolean duplexMode;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package stirling.software.SPDF.model.api.misc;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ExtractHeaderRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "Flag indicating whether to use the first text as a fallback if no suitable title is found. Defaults to false.", required = false, defaultValue = "false")
|
||||
@Schema(
|
||||
description =
|
||||
"Flag indicating whether to use the first text as a fallback if no suitable title is found. Defaults to false.",
|
||||
required = false,
|
||||
defaultValue = "false")
|
||||
private boolean useFirstTextAsFallback;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api.misc;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -12,18 +13,33 @@ public class ExtractImageScansRequest {
|
||||
@Schema(description = "The input file containing image scans", required = true)
|
||||
private MultipartFile fileInput;
|
||||
|
||||
@Schema(description = "The angle threshold for the image scan extraction", defaultValue = "5", example = "5")
|
||||
@Schema(
|
||||
description = "The angle threshold for the image scan extraction",
|
||||
defaultValue = "5",
|
||||
example = "5")
|
||||
private int angleThreshold = 5;
|
||||
|
||||
@Schema(description = "The tolerance for the image scan extraction", defaultValue = "20", example = "20")
|
||||
@Schema(
|
||||
description = "The tolerance for the image scan extraction",
|
||||
defaultValue = "20",
|
||||
example = "20")
|
||||
private int tolerance = 20;
|
||||
|
||||
@Schema(description = "The minimum area for the image scan extraction", defaultValue = "8000", example = "8000")
|
||||
@Schema(
|
||||
description = "The minimum area for the image scan extraction",
|
||||
defaultValue = "8000",
|
||||
example = "8000")
|
||||
private int minArea = 8000;
|
||||
|
||||
@Schema(description = "The minimum contour area for the image scan extraction", defaultValue = "500", example = "500")
|
||||
@Schema(
|
||||
description = "The minimum contour area for the image scan extraction",
|
||||
defaultValue = "500",
|
||||
example = "500")
|
||||
private int minContourArea = 500;
|
||||
|
||||
@Schema(description = "The border size for the image scan extraction", defaultValue = "1", example = "1")
|
||||
private int borderSize =1;
|
||||
@Schema(
|
||||
description = "The border size for the image scan extraction",
|
||||
defaultValue = "1",
|
||||
example = "1")
|
||||
private int borderSize = 1;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ package stirling.software.SPDF.model.api.misc;
|
||||
import java.util.Map;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MetadataRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "Delete all metadata if set to true")
|
||||
@@ -41,6 +42,8 @@ public class MetadataRequest extends PDFFile {
|
||||
@Schema(description = "The trapped status of the document")
|
||||
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")
|
||||
@Schema(
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package stirling.software.SPDF.model.api.misc;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OptimizePdfRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The level of optimization to apply to the PDF file. Higher values indicate greater compression but may reduce quality.",
|
||||
allowableValues = { "1", "2", "3", "4", "5" })
|
||||
@Schema(
|
||||
description =
|
||||
"The level of optimization to apply to the PDF file. Higher values indicate greater compression but may reduce quality.",
|
||||
allowableValues = {"1", "2", "3", "4", "5"})
|
||||
private Integer optimizeLevel;
|
||||
|
||||
@Schema(description = "The expected output size, e.g. '100MB', '25KB', etc.")
|
||||
|
||||
@@ -3,23 +3,30 @@ package stirling.software.SPDF.model.api.misc;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OverlayImageRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The image file to be overlaid onto the PDF.")
|
||||
private MultipartFile imageFile;
|
||||
|
||||
@Schema(description = "The x-coordinate at which to place the top-left corner of the image.", example = "0")
|
||||
@Schema(
|
||||
description = "The x-coordinate at which to place the top-left corner of the image.",
|
||||
example = "0")
|
||||
private float x;
|
||||
|
||||
@Schema(description = "The y-coordinate at which to place the top-left corner of the image.", example = "0")
|
||||
@Schema(
|
||||
description = "The y-coordinate at which to place the top-left corner of the image.",
|
||||
example = "0")
|
||||
private float y;
|
||||
|
||||
@Schema(description = "Whether to overlay the image onto every page of the PDF.", example = "false")
|
||||
@Schema(
|
||||
description = "Whether to overlay the image onto every page of the PDF.",
|
||||
example = "false")
|
||||
private boolean everyPage;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ package stirling.software.SPDF.model.api.misc;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ProcessPdfWithOcrRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "List of languages to use in OCR processing")
|
||||
@@ -26,10 +27,15 @@ public class ProcessPdfWithOcrRequest extends PDFFile {
|
||||
@Schema(description = "Clean the final output if set to true")
|
||||
private boolean cleanFinal;
|
||||
|
||||
@Schema(description = "Specify the OCR type, e.g., 'skip-text', 'force-ocr', or 'Normal'", allowableValues = {"skip-text", "force-ocr", "Normal"})
|
||||
@Schema(
|
||||
description = "Specify the OCR type, e.g., 'skip-text', 'force-ocr', or 'Normal'",
|
||||
allowableValues = {"skip-text", "force-ocr", "Normal"})
|
||||
private String ocrType;
|
||||
|
||||
@Schema(description = "Specify the OCR render type, either 'hocr' or 'sandwich'", allowableValues = {"hocr", "sandwich"}, defaultValue = "hocr")
|
||||
@Schema(
|
||||
description = "Specify the OCR render type, either 'hocr' or 'sandwich'",
|
||||
allowableValues = {"hocr", "sandwich"},
|
||||
defaultValue = "hocr")
|
||||
private String ocrRenderType = "hocr";
|
||||
|
||||
@Schema(description = "Remove images from the output PDF if set to true")
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package stirling.software.SPDF.model.api.misc;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RemoveBlankPagesRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The threshold value to determine blank pages", example = "10", defaultValue = "10")
|
||||
@Schema(
|
||||
description = "The threshold value to determine blank pages",
|
||||
example = "10",
|
||||
defaultValue = "10")
|
||||
private int threshold = 10;
|
||||
|
||||
@Schema(description = "The percentage of white color on a page to consider it as blank", example = "99.9", defaultValue = "99.9")
|
||||
@Schema(
|
||||
description = "The percentage of white color on a page to consider it as blank",
|
||||
example = "99.9",
|
||||
defaultValue = "99.9")
|
||||
private float whitePercent = 99.9f;
|
||||
}
|
||||
|
||||
@@ -1,30 +1,44 @@
|
||||
package stirling.software.SPDF.model.api.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
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)", defaultValue = "")
|
||||
@Schema(
|
||||
description =
|
||||
"The owner password to be added to the PDF file (Restricts what can be done with the document once it is opened)",
|
||||
defaultValue = "")
|
||||
private String ownerPassword;
|
||||
|
||||
@Schema(description = "The password to be added to the PDF file (Restricts the opening of the document itself.)", defaultValue = "")
|
||||
@Schema(
|
||||
description =
|
||||
"The password to be added to the PDF file (Restricts the opening of the document itself.)",
|
||||
defaultValue = "")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "The length of the encryption key", allowableValues = {"40", "128", "256"}, defaultValue = "256")
|
||||
@Schema(
|
||||
description = "The length of the encryption key",
|
||||
allowableValues = {"40", "128", "256"},
|
||||
defaultValue = "256")
|
||||
private int keyLength = 256;
|
||||
|
||||
@Schema(description = "Whether the document assembly is allowed", example = "false")
|
||||
private boolean canAssembleDocument;
|
||||
|
||||
@Schema(description = "Whether content extraction for accessibility is allowed", example = "false")
|
||||
@Schema(
|
||||
description = "Whether content extraction for accessibility is allowed",
|
||||
example = "false")
|
||||
private boolean canExtractContent;
|
||||
|
||||
@Schema(description = "Whether content extraction for accessibility is allowed", example = "false")
|
||||
@Schema(
|
||||
description = "Whether content extraction for accessibility is allowed",
|
||||
example = "false")
|
||||
private boolean canExtractForAccessibility;
|
||||
|
||||
@Schema(description = "Whether form filling is allowed", example = "false")
|
||||
|
||||
@@ -3,17 +3,19 @@ package stirling.software.SPDF.model.api.security;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AddWatermarkRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The watermark type (text or image)",
|
||||
allowableValues = {"text", "image"},
|
||||
required = true)
|
||||
@Schema(
|
||||
description = "The watermark type (text or image)",
|
||||
allowableValues = {"text", "image"},
|
||||
required = true)
|
||||
private String watermarkType;
|
||||
|
||||
@Schema(description = "The watermark text")
|
||||
@@ -22,8 +24,9 @@ public class AddWatermarkRequest extends PDFFile {
|
||||
@Schema(description = "The watermark image")
|
||||
private MultipartFile watermarkImage;
|
||||
|
||||
@Schema(description = "The selected alphabet",
|
||||
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
|
||||
@Schema(
|
||||
description = "The selected alphabet",
|
||||
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
|
||||
defaultValue = "roman")
|
||||
private String alphabet = "roman";
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package stirling.software.SPDF.model.api.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PDFPasswordRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The password of the PDF file", required = true)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package stirling.software.SPDF.model.api.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RedactPdfRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "List of text to redact from the PDF", type = "string", required = true)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package stirling.software.SPDF.model.api.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SanitizePdfRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "Remove JavaScript actions from the PDF", defaultValue = "false")
|
||||
|
||||
@@ -3,18 +3,23 @@ package stirling.software.SPDF.model.api.security;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SignPDFWithCertRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "The type of the digital certificate", allowableValues = { "PKCS12", "PEM" })
|
||||
@Schema(
|
||||
description = "The type of the digital certificate",
|
||||
allowableValues = {"PKCS12", "PEM"})
|
||||
private String certType;
|
||||
|
||||
@Schema(description = "The private key for the digital certificate (required for PEM type certificates)")
|
||||
@Schema(
|
||||
description =
|
||||
"The private key for the digital certificate (required for PEM type certificates)")
|
||||
private MultipartFile privateKeyFile;
|
||||
|
||||
@Schema(description = "The digital certificate (required for PEM type certificates)")
|
||||
@@ -38,6 +43,8 @@ public class SignPDFWithCertRequest extends PDFFile {
|
||||
@Schema(description = "The name of the signer")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "The page number where the signature should be visible. This is required if showSignature is set to true")
|
||||
@Schema(
|
||||
description =
|
||||
"The page number where the signature should be visible. This is required if showSignature is set to true")
|
||||
private Integer pageNumber;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user