diff --git a/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-api/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorage.java b/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-api/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorage.java index 39d210af48..725d5fbed8 100644 --- a/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-api/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorage.java +++ b/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-api/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorage.java @@ -24,7 +24,7 @@ */ public interface ApiConnectorFileStorage { - void deleteApiConnectorDefinition(FileEntry componentFile); + void deleteApiConnectorDefinition(@NonNull FileEntry componentFile); void deleteApiConnectorSpecification(@NonNull FileEntry specificationFile); diff --git a/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-impl/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorageImpl.java b/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-impl/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorageImpl.java index 5ccf6f16a3..febf23f0a6 100644 --- a/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-impl/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorageImpl.java +++ b/server/ee/libs/platform/platform-api-connector/platform-api-connector-file-storage/platform-api-connector-file-storage-impl/src/main/java/com/bytechef/platform/apiconnector/file/storage/ApiConnectorFileStorageImpl.java @@ -20,7 +20,6 @@ import com.bytechef.file.storage.domain.FileEntry; import com.bytechef.file.storage.service.FileStorageService; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.apache.commons.lang3.Validate; import org.springframework.lang.NonNull; /** @@ -39,7 +38,7 @@ public ApiConnectorFileStorageImpl(FileStorageService fileStorageService) { } @Override - public void deleteApiConnectorDefinition(FileEntry componentFile) { + public void deleteApiConnectorDefinition(@NonNull FileEntry componentFile) { fileStorageService.deleteFile(API_CONNECTORS_DEFINITIONS_DIR, componentFile); } @@ -62,18 +61,12 @@ public String readApiConnectorSpecification(@NonNull FileEntry specificationFile @Override public FileEntry storeApiConnectorDefinition(String filename, @NonNull String definition) { - Validate.notNull(filename, "'filename' must not be null"); - Validate.notNull(definition, "'bytes' must not be null"); - return fileStorageService.storeFileContent( API_CONNECTORS_DEFINITIONS_DIR, filename, CompressionUtils.compress(definition)); } @Override public FileEntry storeApiConnectorSpecification(@NonNull String filename, @NonNull String definition) { - Validate.notNull(filename, "'filename' must not be null"); - Validate.notNull(definition, "'definition' must not be null"); - return fileStorageService.storeFileContent( API_CONNECTORS_SPECIFICATIONS_DIR, filename, CompressionUtils.compress(definition)); } diff --git a/server/libs/atlas/atlas-file-storage/atlas-file-storage-impl/src/main/java/com/bytechef/atlas/file/storage/TaskFileStorageImpl.java b/server/libs/atlas/atlas-file-storage/atlas-file-storage-impl/src/main/java/com/bytechef/atlas/file/storage/TaskFileStorageImpl.java index 5e8cfba9c5..35b42e5b56 100644 --- a/server/libs/atlas/atlas-file-storage/atlas-file-storage-impl/src/main/java/com/bytechef/atlas/file/storage/TaskFileStorageImpl.java +++ b/server/libs/atlas/atlas-file-storage/atlas-file-storage-impl/src/main/java/com/bytechef/atlas/file/storage/TaskFileStorageImpl.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.core.type.TypeReference; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Map; -import org.apache.commons.lang3.Validate; import org.springframework.lang.NonNull; /** @@ -52,8 +51,6 @@ public TaskFileStorageImpl(FileStorageService fileStorageService) { @Override public Map readJobOutputs(@NonNull FileEntry fileEntry) { - Validate.notNull(fileEntry, "'fileEntry' must not be null"); - return JsonUtils.read( CompressionUtils.decompressToString(fileStorageService.readFileToBytes(JOB_FILES_DIR, fileEntry)), new TypeReference<>() {}); @@ -61,8 +58,6 @@ public TaskFileStorageImpl(FileStorageService fileStorageService) { @Override public Object readTaskExecutionOutput(@NonNull FileEntry fileEntry) { - Validate.notNull(fileEntry, "'fileEntry' must not be null"); - return JsonUtils.read( CompressionUtils.decompressToString( fileStorageService.readFileToBytes(TASK_EXECUTION_FILES_DIR, fileEntry)), @@ -73,9 +68,6 @@ public Object readTaskExecutionOutput(@NonNull FileEntry fileEntry) { public FileEntry storeContextValue( long stackId, @NonNull Context.Classname classname, @NonNull Map value) { - Validate.notNull(classname, "'classname' must not be null"); - Validate.notNull(value, "'value' must not be null"); - return fileStorageService.storeFileContent( CONTEXT_FILES_DIR, classname + "_" + stackId + ".json", CompressionUtils.compress(JsonUtils.write(value))); } @@ -84,9 +76,6 @@ public FileEntry storeContextValue( public FileEntry storeContextValue( long stackId, int subStackId, @NonNull Context.Classname classname, @NonNull Map value) { - Validate.notNull(classname, "'classname' must not be null"); - Validate.notNull(value, "'value' must not be null"); - return fileStorageService.storeFileContent( CONTEXT_FILES_DIR, classname + "_" + stackId + "_" + subStackId + ".json", CompressionUtils.compress(JsonUtils.write(value))); @@ -94,16 +83,12 @@ public FileEntry storeContextValue( @Override public FileEntry storeJobOutputs(long jobId, @NonNull Map outputs) { - Validate.notNull(outputs, "'outputs' must not be null"); - return fileStorageService.storeFileContent( JOB_FILES_DIR, jobId + ".json", CompressionUtils.compress(JsonUtils.write(outputs))); } @Override public FileEntry storeTaskExecutionOutput(long taskExecutionId, @NonNull Object output) { - Validate.notNull(output, "'output' must not be null"); - return fileStorageService.storeFileContent( TASK_EXECUTION_FILES_DIR, taskExecutionId + ".json", CompressionUtils.compress(JsonUtils.write(output))); diff --git a/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-api/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorage.java b/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-api/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorage.java index ea1dcb1d8c..0a44a9386f 100644 --- a/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-api/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorage.java +++ b/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-api/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorage.java @@ -35,5 +35,5 @@ public interface CodeWorkflowFileStorage { FileEntry storeCodeWorkflowDefinition(@NonNull String filename, @NonNull String definition); - FileEntry storeCodeWorkflowFile(String filename, @NonNull byte[] bytes); + FileEntry storeCodeWorkflowFile(@NonNull String filename, @NonNull byte[] bytes); } diff --git a/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-impl/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorageImpl.java b/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-impl/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorageImpl.java index cd62aed47b..abeeacc24c 100644 --- a/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-impl/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorageImpl.java +++ b/server/libs/platform/platform-code-workflow/platform-code-workflow-file-storage/platform-code-workflow-file-storage-impl/src/main/java/com/bytechef/platform/codeworkflow/file/storage/CodeWorkflowFileStorageImpl.java @@ -21,7 +21,6 @@ import com.bytechef.file.storage.service.FileStorageService; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.net.URL; -import org.apache.commons.lang3.Validate; import org.springframework.lang.NonNull; /** @@ -67,10 +66,7 @@ public FileEntry storeCodeWorkflowDefinition(@NonNull String filename, @NonNull } @Override - public FileEntry storeCodeWorkflowFile(String filename, @NonNull byte[] bytes) { - Validate.notNull(filename, "'filename' must not be null"); - Validate.notNull(bytes, "'bytes' must not be null"); - + public FileEntry storeCodeWorkflowFile(@NonNull String filename, @NonNull byte[] bytes) { return fileStorageService.storeFileContent(CODE_WORKFLOWS_FILES_DIR, filename, bytes, false); } } diff --git a/server/libs/platform/platform-component/platform-component-service/src/main/java/com/bytechef/platform/component/definition/InMemoryFilesFileStorage.java b/server/libs/platform/platform-component/platform-component-service/src/main/java/com/bytechef/platform/component/definition/InMemoryFilesFileStorage.java index a68e936726..206d732cc9 100644 --- a/server/libs/platform/platform-component/platform-component-service/src/main/java/com/bytechef/platform/component/definition/InMemoryFilesFileStorage.java +++ b/server/libs/platform/platform-component/platform-component-service/src/main/java/com/bytechef/platform/component/definition/InMemoryFilesFileStorage.java @@ -21,6 +21,7 @@ import com.bytechef.platform.file.storage.FilesFileStorage; import com.bytechef.platform.file.storage.FilesFileStorageImpl; import java.io.InputStream; +import org.springframework.lang.NonNull; /** * @author Ivica Cardic @@ -30,22 +31,22 @@ public class InMemoryFilesFileStorage implements FilesFileStorage { private final FilesFileStorage filesFileStorage = new FilesFileStorageImpl(new Base64FileStorageService()); @Override - public InputStream getFileStream(FileEntry fileEntry) { + public InputStream getFileStream(@NonNull FileEntry fileEntry) { return filesFileStorage.getFileStream(fileEntry); } @Override - public String readFileToString(FileEntry fileEntry) { + public String readFileToString(@NonNull FileEntry fileEntry) { return filesFileStorage.readFileToString(fileEntry); } @Override - public FileEntry storeFileContent(String fileName, String data) { + public FileEntry storeFileContent(@NonNull String fileName, @NonNull String data) { return filesFileStorage.storeFileContent(fileName, data); } @Override - public FileEntry storeFileContent(String submittedFileName, InputStream inputStream) { + public FileEntry storeFileContent(@NonNull String submittedFileName, @NonNull InputStream inputStream) { return filesFileStorage.storeFileContent(submittedFileName, inputStream); } } diff --git a/server/libs/platform/platform-coordinator/src/main/java/com/bytechef/platform/coordinator/job/JobSyncExecutor.java b/server/libs/platform/platform-coordinator/src/main/java/com/bytechef/platform/coordinator/job/JobSyncExecutor.java index 7ebb25ec95..d77549c719 100644 --- a/server/libs/platform/platform-coordinator/src/main/java/com/bytechef/platform/coordinator/job/JobSyncExecutor.java +++ b/server/libs/platform/platform-coordinator/src/main/java/com/bytechef/platform/coordinator/job/JobSyncExecutor.java @@ -68,6 +68,7 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.core.task.AsyncTaskExecutor; import org.springframework.data.domain.Page; +import org.springframework.lang.NonNull; /** * @author Ivica Cardic @@ -81,7 +82,7 @@ public class JobSyncExecutor { private static final Executor executor = Executors.newCachedThreadPool(); @Override - public void execute(Runnable task) { + public void execute(@NonNull Runnable task) { String tenantId = TenantContext.getCurrentTenantId(); executor.execute( diff --git a/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-api/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorage.java b/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-api/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorage.java index 3ad6444e5c..7b7ff806bb 100644 --- a/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-api/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorage.java +++ b/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-api/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorage.java @@ -25,9 +25,9 @@ */ public interface CustomComponentFileStorage { - void deleteCustomComponentFile(FileEntry componentFile); + void deleteCustomComponentFile(@NonNull FileEntry componentFile); URL getCustomComponentFileURL(@NonNull FileEntry componentFile); - FileEntry storeCustomComponentFile(String filename, @NonNull byte[] bytes); + FileEntry storeCustomComponentFile(@NonNull String filename, @NonNull byte[] bytes); } diff --git a/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-impl/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorageImpl.java b/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-impl/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorageImpl.java index 51b095fea5..f3bd82f5e7 100644 --- a/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-impl/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorageImpl.java +++ b/server/libs/platform/platform-custom-component/platform-custom-component-file-storage/platform-custom-component-file-storage-impl/src/main/java/com/bytechef/platform/customcomponent/file/storage/CustomComponentFileStorageImpl.java @@ -20,7 +20,6 @@ import com.bytechef.file.storage.service.FileStorageService; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.net.URL; -import org.apache.commons.lang3.Validate; import org.springframework.lang.NonNull; /** @@ -38,7 +37,7 @@ public CustomComponentFileStorageImpl(FileStorageService fileStorageService) { } @Override - public void deleteCustomComponentFile(FileEntry componentFile) { + public void deleteCustomComponentFile(@NonNull FileEntry componentFile) { fileStorageService.deleteFile(CUSTOM_COMPONENTS_FILES_DIR, componentFile); } @@ -48,10 +47,7 @@ public URL getCustomComponentFileURL(@NonNull FileEntry componentFile) { } @Override - public FileEntry storeCustomComponentFile(String filename, @NonNull byte[] bytes) { - Validate.notNull(filename, "'filename' must not be null"); - Validate.notNull(bytes, "'bytes' must not be null"); - + public FileEntry storeCustomComponentFile(@NonNull String filename, @NonNull byte[] bytes) { return fileStorageService.storeFileContent(CUSTOM_COMPONENTS_FILES_DIR, filename, bytes, false); } } diff --git a/server/libs/platform/platform-file-storage/platform-file-storage-api/src/main/java/com/bytechef/platform/file/storage/FilesFileStorage.java b/server/libs/platform/platform-file-storage/platform-file-storage-api/src/main/java/com/bytechef/platform/file/storage/FilesFileStorage.java index 8eef910b3c..d972727fa8 100644 --- a/server/libs/platform/platform-file-storage/platform-file-storage-api/src/main/java/com/bytechef/platform/file/storage/FilesFileStorage.java +++ b/server/libs/platform/platform-file-storage/platform-file-storage-api/src/main/java/com/bytechef/platform/file/storage/FilesFileStorage.java @@ -18,17 +18,18 @@ import com.bytechef.file.storage.domain.FileEntry; import java.io.InputStream; +import org.springframework.lang.NonNull; /** * @author Ivica Cardic */ public interface FilesFileStorage { - InputStream getFileStream(FileEntry fileEntry); + InputStream getFileStream(@NonNull FileEntry fileEntry); - String readFileToString(FileEntry fileEntry); + String readFileToString(@NonNull FileEntry fileEntry); - FileEntry storeFileContent(String fileName, String data); + FileEntry storeFileContent(@NonNull String fileName, @NonNull String data); - FileEntry storeFileContent(String submittedFileName, InputStream inputStream); + FileEntry storeFileContent(@NonNull String submittedFileName, @NonNull InputStream inputStream); } diff --git a/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/FilesFileStorageImpl.java b/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/FilesFileStorageImpl.java index 5ea976296b..2df2ba8ddd 100644 --- a/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/FilesFileStorageImpl.java +++ b/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/FilesFileStorageImpl.java @@ -20,6 +20,7 @@ import com.bytechef.file.storage.service.FileStorageService; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.InputStream; +import org.springframework.lang.NonNull; /** * @author Ivica Cardic @@ -36,22 +37,22 @@ public FilesFileStorageImpl(FileStorageService fileStorageService) { } @Override - public InputStream getFileStream(FileEntry fileEntry) { + public InputStream getFileStream(@NonNull FileEntry fileEntry) { return fileStorageService.getFileStream(FILES_DIR, fileEntry); } @Override - public String readFileToString(FileEntry fileEntry) { + public String readFileToString(@NonNull FileEntry fileEntry) { return fileStorageService.readFileToString(FILES_DIR, fileEntry); } @Override - public FileEntry storeFileContent(String fileName, String data) { + public FileEntry storeFileContent(@NonNull String fileName, @NonNull String data) { return fileStorageService.storeFileContent(FILES_DIR, fileName, data); } @Override - public FileEntry storeFileContent(String submittedFileName, InputStream inputStream) { + public FileEntry storeFileContent(@NonNull String submittedFileName, @NonNull InputStream inputStream) { return fileStorageService.storeFileContent(FILES_DIR, submittedFileName, inputStream); } } diff --git a/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/TriggerFileStorageImpl.java b/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/TriggerFileStorageImpl.java index f45eb95e52..98023b07b6 100644 --- a/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/TriggerFileStorageImpl.java +++ b/server/libs/platform/platform-file-storage/platform-file-storage-impl/src/main/java/com/bytechef/platform/file/storage/TriggerFileStorageImpl.java @@ -21,7 +21,6 @@ import com.bytechef.file.storage.domain.FileEntry; import com.bytechef.file.storage.service.FileStorageService; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.apache.commons.lang3.Validate; import org.springframework.lang.NonNull; /** @@ -40,8 +39,6 @@ public TriggerFileStorageImpl(FileStorageService fileStorageService) { @Override public Object readTriggerExecutionOutput(@NonNull FileEntry fileEntry) { - Validate.notNull(fileEntry, "'fileEntry' must not be null"); - return JsonUtils.read( CompressionUtils.decompressToString( fileStorageService.readFileToBytes(TRIGGER_EXECUTION_FILES_DIR, fileEntry)), @@ -50,8 +47,6 @@ public Object readTriggerExecutionOutput(@NonNull FileEntry fileEntry) { @Override public FileEntry storeTriggerExecutionOutput(long triggerExecutionId, @NonNull Object output) { - Validate.notNull(output, "'output' must not be null"); - return fileStorageService.storeFileContent( TRIGGER_EXECUTION_FILES_DIR, triggerExecutionId + ".json", CompressionUtils.compress(JsonUtils.write(output)));