diff --git a/openbas-framework/src/main/java/io/openbas/executors/tanium/service/TaniumExecutorService.java b/openbas-framework/src/main/java/io/openbas/executors/tanium/service/TaniumExecutorService.java index fc4c53735a..f34c3434ac 100644 --- a/openbas-framework/src/main/java/io/openbas/executors/tanium/service/TaniumExecutorService.java +++ b/openbas-framework/src/main/java/io/openbas/executors/tanium/service/TaniumExecutorService.java @@ -22,7 +22,10 @@ import java.time.LocalDateTime; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.Optional; import java.util.logging.Level; import static java.time.Instant.now; diff --git a/openbas-model/src/main/java/io/openbas/database/model/AttackPattern.java b/openbas-model/src/main/java/io/openbas/database/model/AttackPattern.java index 5d8bda2f0c..56c535a037 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/AttackPattern.java +++ b/openbas-model/src/main/java/io/openbas/database/model/AttackPattern.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import io.hypersistence.utils.hibernate.type.array.StringArrayType; import io.openbas.annotation.Queryable; import io.openbas.database.audit.ModelBaseListener; import io.openbas.helper.MonoIdDeserializer; @@ -10,7 +9,6 @@ import jakarta.persistence.*; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import org.hibernate.annotations.Type; import org.hibernate.annotations.UuidGenerator; import java.time.Instant; @@ -56,12 +54,10 @@ public class AttackPattern implements Base { @NotBlank private String externalId; - @Type(StringArrayType.class) @Column(name = "attack_pattern_platforms", columnDefinition = "text[]") @JsonProperty("attack_pattern_platforms") private String[] platforms = new String[0]; - @Type(StringArrayType.class) @Column(name = "attack_pattern_permissions_required", columnDefinition = "text[]") @JsonProperty("attack_pattern_permissions_required") private String[] permissionsRequired = new String[0]; diff --git a/openbas-model/src/main/java/io/openbas/database/model/Communication.java b/openbas-model/src/main/java/io/openbas/database/model/Communication.java index 8091fe468f..42af7f9819 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/Communication.java +++ b/openbas-model/src/main/java/io/openbas/database/model/Communication.java @@ -3,15 +3,16 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import io.hypersistence.utils.hibernate.type.array.StringArrayType; import io.openbas.database.audit.ModelBaseListener; import io.openbas.helper.MonoIdDeserializer; import io.openbas.helper.MultiIdListDeserializer; import jakarta.persistence.*; +import jakarta.persistence.*; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Setter; import org.apache.commons.lang3.StringUtils; +import org.hibernate.annotations.UuidGenerator; import org.hibernate.annotations.Type; import org.hibernate.annotations.UuidGenerator; @@ -63,7 +64,6 @@ public class Communication implements Base { @JsonProperty("communication_content_html") private String contentHtml; - @Type(StringArrayType.class) @Column(name = "communication_attachments", columnDefinition = "text[]") @JsonProperty("communication_attachments") private String[] attachments; diff --git a/openbas-model/src/main/java/io/openbas/database/model/Endpoint.java b/openbas-model/src/main/java/io/openbas/database/model/Endpoint.java index 6fb96e738f..d7cd7f6c72 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/Endpoint.java +++ b/openbas-model/src/main/java/io/openbas/database/model/Endpoint.java @@ -1,7 +1,6 @@ package io.openbas.database.model; import com.fasterxml.jackson.annotation.JsonProperty; -import io.hypersistence.utils.hibernate.type.array.StringArrayType; import io.openbas.annotation.Ipv4OrIpv6Constraint; import io.openbas.annotation.Queryable; import io.openbas.database.audit.ModelBaseListener; @@ -10,7 +9,6 @@ import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; -import org.hibernate.annotations.Type; @EqualsAndHashCode(callSuper = true) @Data @@ -52,7 +50,6 @@ public enum PLATFORM_TYPE { @Queryable(filterable = true) @NotEmpty @Ipv4OrIpv6Constraint - @Type(StringArrayType.class) @Column(name = "endpoint_ips") @JsonProperty("endpoint_ips") private String[] ips; @@ -81,7 +78,6 @@ public enum PLATFORM_TYPE { @NotNull private PLATFORM_ARCH arch; - @Type(StringArrayType.class) @Column(name = "endpoint_mac_addresses") @JsonProperty("endpoint_mac_addresses") private String[] macAddresses; diff --git a/openbas-model/src/main/java/io/openbas/database/model/Executor.java b/openbas-model/src/main/java/io/openbas/database/model/Executor.java index 32a7924d50..ca6d663432 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/Executor.java +++ b/openbas-model/src/main/java/io/openbas/database/model/Executor.java @@ -2,14 +2,12 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import io.hypersistence.utils.hibernate.type.array.StringArrayType; import io.openbas.database.audit.ModelBaseListener; import jakarta.persistence.*; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; -import org.hibernate.annotations.Type; import java.time.Instant; import java.util.Objects; @@ -39,7 +37,7 @@ public class Executor implements Base { @NotBlank private String type; - @Type(StringArrayType.class) + @Getter @Column(name = "executor_platforms", columnDefinition = "text[]") @JsonProperty("executor_platforms") private String[] platforms = new String[0]; diff --git a/openbas-model/src/main/java/io/openbas/database/model/InjectorContract.java b/openbas-model/src/main/java/io/openbas/database/model/InjectorContract.java index 3c464389c4..fd0d61c0e4 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/InjectorContract.java +++ b/openbas-model/src/main/java/io/openbas/database/model/InjectorContract.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.node.ObjectNode; -import io.hypersistence.utils.hibernate.type.array.StringArrayType; import io.hypersistence.utils.hibernate.type.basic.PostgreSQLHStoreType; import io.openbas.annotation.Queryable; import io.openbas.database.audit.ModelBaseListener; @@ -63,7 +62,6 @@ public class InjectorContract implements Base { @JsonProperty("injector_contract_needs_executor") private Boolean needsExecutor = false; - @Type(StringArrayType.class) @Column(name = "injector_contract_platforms", columnDefinition = "text[]") @JsonProperty("injector_contract_platforms") private String[] platforms = new String[0]; diff --git a/openbas-model/src/main/java/io/openbas/database/model/Mitigation.java b/openbas-model/src/main/java/io/openbas/database/model/Mitigation.java index dd54253422..aee7863e8f 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/Mitigation.java +++ b/openbas-model/src/main/java/io/openbas/database/model/Mitigation.java @@ -55,7 +55,6 @@ public class Mitigation implements Base { @NotBlank private String externalId; - @Type(StringArrayType.class) @Column(name = "mitigation_log_sources", columnDefinition = "text[]") @JsonProperty("mitigation_log_sources") private String[] logSources = new String[0]; diff --git a/openbas-model/src/main/java/io/openbas/database/model/Payload.java b/openbas-model/src/main/java/io/openbas/database/model/Payload.java index 3af21a9948..466685beb0 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/Payload.java +++ b/openbas-model/src/main/java/io/openbas/database/model/Payload.java @@ -66,7 +66,6 @@ public enum PAYLOAD_STATUS { @JsonProperty("payload_description") private String description; - @Type(StringArrayType.class) @Column(name = "payload_platforms", columnDefinition = "text[]") @JsonProperty("payload_platforms") private String[] platforms = new String[0];