enableAlphaFunctionality

This commit is contained in:
Anthony Stirling 2023-12-26 20:10:37 +00:00
parent 0fb0cb8bca
commit 05977aa3a6
5 changed files with 35 additions and 10 deletions

View file

@ -56,9 +56,8 @@ public class ApiDocService {
JsonNode pathNode = entry.getValue(); JsonNode pathNode = entry.getValue();
if (pathNode.has("post")) { if (pathNode.has("post")) {
JsonNode postNode = pathNode.get("post"); JsonNode postNode = pathNode.get("post");
String operation = path.substring(1); // Assuming operation name is the path without leading '/' ApiEndpoint endpoint = new ApiEndpoint(path, postNode);
ApiEndpoint endpoint = new ApiEndpoint(operation, postNode); apiDocumentation.put(path, endpoint);
apiDocumentation.put(operation, endpoint);
} }
}); });
} catch (Exception e) { } catch (Exception e) {
@ -68,7 +67,6 @@ public class ApiDocService {
} }
public boolean isValidOperation(String operationName, Map<String, Object> parameters) { public boolean isValidOperation(String operationName, Map<String, Object> parameters) {
System.out.println(apiDocumentation);
if (!apiDocumentation.containsKey(operationName)) { if (!apiDocumentation.containsKey(operationName)) {
return false; return false;
} }

View file

@ -72,8 +72,14 @@ public class PipelineController {
@Autowired @Autowired
private ApiDocService apiDocService; private ApiDocService apiDocService;
@Scheduled(fixedRate = 60000) @Scheduled(fixedRate = 60000)
public void scanFolders() { public void scanFolders() {
if(!Boolean.TRUE.equals(applicationProperties.getSystem().getEnableAlphaFunctionality())) {
return;
}
Path watchedFolderPath = Paths.get(watchedFoldersDir); Path watchedFolderPath = Paths.get(watchedFoldersDir);
if (!Files.exists(watchedFolderPath)) { if (!Files.exists(watchedFolderPath)) {
try { try {
@ -453,6 +459,10 @@ public class PipelineController {
@PostMapping("/handleData") @PostMapping("/handleData")
public ResponseEntity<byte[]> handleData(@ModelAttribute HandleDataRequest request) { public ResponseEntity<byte[]> handleData(@ModelAttribute HandleDataRequest request) {
if(!Boolean.TRUE.equals(applicationProperties.getSystem().getEnableAlphaFunctionality())) {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
MultipartFile[] files = request.getFileInput(); MultipartFile[] files = request.getFileInput();
String jsonString = request.getJson(); String jsonString = request.getJson();
if(files == null) { if(files == null) {

View file

@ -176,6 +176,19 @@ public class ApplicationProperties {
private String customStaticFilePath; private String customStaticFilePath;
private Integer maxFileSize; private Integer maxFileSize;
private Boolean enableAlphaFunctionality;
public Boolean getEnableAlphaFunctionality() {
return enableAlphaFunctionality;
}
public void setEnableAlphaFunctionality(Boolean enableAlphaFunctionality) {
this.enableAlphaFunctionality = enableAlphaFunctionality;
}
public String getDefaultLocale() { public String getDefaultLocale() {
return defaultLocale; return defaultLocale;
} }
@ -218,12 +231,13 @@ public class ApplicationProperties {
@Override @Override
public String toString() { public String toString() {
return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility + ", rootURIPath=" return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility
+ rootURIPath + ", customStaticFilePath=" + customStaticFilePath + ", maxFileSize=" + maxFileSize + ", rootURIPath=" + rootURIPath + ", customStaticFilePath=" + customStaticFilePath
+ "]"; + ", maxFileSize=" + maxFileSize + ", enableAlphaFunctionality=" + enableAlphaFunctionality + "]";
} }
} }
public static class Ui { public static class Ui {

View file

@ -9,6 +9,7 @@ security:
system: system:
defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc) defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc)
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes)
#ui: #ui:
# appName: exampleAppName # Application's visible name # appName: exampleAppName # Application's visible name

View file

@ -343,7 +343,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
parameterInput = document.createElement('input'); parameterInput = document.createElement('input');
parameterInput.type = 'text'; parameterInput.type = 'text';
parameterInput.className = "form-control"; parameterInput.className = "form-control";
parameterInput.value = "automatedFileInput"; parameterInput.value = "FileInputPathToBeInputtedManuallyOffline";
} else { } else {
parameterInput = document.createElement('input'); parameterInput = document.createElement('input');
parameterInput.type = 'text'; parameterInput.type = 'text';
@ -480,7 +480,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
"outputDir": "{outputFolder}/{folderName}", "outputDir": "{outputFolder}/{folderName}",
"outputFileName": "{filename}-{pipelineName}-{date}-{time}" "outputFileName": "{filename}-{pipelineName}-{date}-{time}"
}, },
"outputDir": "httpWebRequest", "outputDir": "{outputFolder}",
"outputFileName": "{filename}" "outputFileName": "{filename}"
}; };
@ -488,6 +488,8 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
let operationName = pipelineList[i].querySelector('.operationName').textContent; let operationName = pipelineList[i].querySelector('.operationName').textContent;
let parameters = operationSettings[operationName] || {}; let parameters = operationSettings[operationName] || {};
parameters['fileInput'] = 'automated';
pipelineConfig.pipeline.push({ pipelineConfig.pipeline.push({
"operation": operationName, "operation": operationName,
"parameters": parameters "parameters": parameters