chore: Remove QueryDSL (#32074)

Another attempt at removing QueryDSL. This time, it seems to be working
without very many shenanigans, which throws question on what the hell I
was doing in the previous attempt. 😭

All tests and Sanity Cypress passes on EE at
https://github.com/appsmithorg/appsmith-ee/pull/3805.
This commit is contained in:
Shrikant Sharat Kandula 2024-03-26 21:28:16 +05:30 committed by GitHub
parent 062aaeb6b5
commit 36577ad7cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 0 additions and 107 deletions

View File

@ -99,19 +99,6 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-mongodb</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
@ -248,25 +235,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,7 +1,6 @@
package com.appsmith.external.models;
import com.appsmith.external.models.ce.ActionCE_DTO;
import com.querydsl.core.annotations.QueryEmbeddable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ -12,7 +11,6 @@ import lombok.experimental.FieldNameConstants;
@Setter
@NoArgsConstructor
@ToString(callSuper = true)
@QueryEmbeddable
@FieldNameConstants
public class ActionDTO extends ActionCE_DTO {
public static class Fields extends ActionCE_DTO.Fields {}

View File

@ -4,7 +4,6 @@ import com.appsmith.external.helpers.Identifiable;
import com.appsmith.external.views.Views;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import com.querydsl.core.annotations.QueryTransient;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@ -66,7 +65,6 @@ public abstract class BaseDomain implements Persistable<String>, AppsmithDomain,
*/
@Deprecated(forRemoval = true)
@JsonView(Views.Internal.class)
@QueryTransient
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
protected Boolean deleted = false;
@ -83,7 +81,6 @@ public abstract class BaseDomain implements Persistable<String>, AppsmithDomain,
return this.getId() == null;
}
@QueryTransient
@JsonView(Views.Internal.class)
public boolean isDeleted() {
return deletedAt != null;

View File

@ -304,18 +304,6 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-mongodb</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
@ -469,26 +457,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor</processor>
<options>
<querydsl.listAccessors>true</querydsl.listAccessors>
</options>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -6,7 +6,6 @@ import com.appsmith.server.constants.ArtifactType;
import com.appsmith.server.dtos.CustomJSLibContextDTO;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import com.querydsl.core.annotations.QueryEntity;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -35,7 +34,6 @@ import static com.appsmith.server.helpers.StringUtils.dotted;
@Setter
@ToString
@NoArgsConstructor
@QueryEntity
@Document
@FieldNameConstants
public class Application extends BaseDomain implements Artifact {

View File

@ -1,7 +1,6 @@
package com.appsmith.server.dtos;
import com.appsmith.server.dtos.ce.ActionCollectionCE_DTO;
import com.querydsl.core.annotations.QueryEmbeddable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ -12,7 +11,6 @@ import lombok.experimental.FieldNameConstants;
@Setter
@NoArgsConstructor
@ToString(callSuper = true)
@QueryEmbeddable
@FieldNameConstants
public class ActionCollectionDTO extends ActionCollectionCE_DTO {
public static class Fields extends ActionCollectionCE_DTO.Fields {}

View File

@ -13,7 +13,6 @@ import com.appsmith.server.domains.User;
import com.appsmith.server.dtos.ApplicationJson;
import com.appsmith.server.helpers.CollectionUtils;
import com.appsmith.server.repositories.CacheableRepositoryHelper;
import com.querydsl.core.types.Path;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
@ -29,7 +28,6 @@ import java.util.stream.Collectors;
import static com.appsmith.server.constants.ResourceModes.EDIT;
import static com.appsmith.server.constants.ResourceModes.VIEW;
import static com.appsmith.server.repositories.BaseAppsmithRepositoryImpl.fieldName;
import static org.springframework.data.mongodb.core.query.Criteria.where;
import static org.springframework.data.mongodb.core.query.Query.query;
@ -212,19 +210,6 @@ public class MigrationHelperMethods {
return query((new Criteria()).andOperator(pluginIdMatchesSuppliedPluginId, isNotDeleted));
}
/**
* Here 'id' refers to the ObjectId which is used to uniquely identify each Mongo document. 'path' refers to the
* path in the Query DSL object that indicates which field in a document should be matched against the `id`.
* `type` is a POJO class type that indicates which collection we are interested in. eg. path=QNewAction
* .newAction.id, type=NewAction.class
*/
public static <T extends BaseDomain> T fetchDomainObjectUsingId(
String id, MongoTemplate mongoTemplate, Path path, Class<T> type) {
final T domainObject =
mongoTemplate.findOne(query(where(fieldName(path)).is(id)), type);
return domainObject;
}
/**
* Here 'id' refers to the ObjectId which is used to uniquely identify each Mongo document. 'path' refers to the
* path in the Query DSL object that indicates which field in a document should be matched against the `id`.

View File

@ -13,8 +13,6 @@ import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.client.model.UpdateOneModel;
import com.mongodb.client.model.WriteModel;
import com.querydsl.core.types.Path;
import jakarta.validation.constraints.NotNull;
import lombok.NonNull;
import org.bson.Document;
import org.bson.types.ObjectId;
@ -92,21 +90,6 @@ public abstract class BaseAppsmithRepositoryCEImpl<T extends BaseDomain> {
(Class<T>) GenericTypeResolver.resolveTypeArgument(getClass(), BaseAppsmithRepositoryCEImpl.class);
}
public static String fieldName(Path<?> path) {
return Optional.ofNullable(path).map(p -> p.getMetadata().getName()).orElse("");
}
public static String completeFieldName(@NotNull Path<?> path) {
StringBuilder sb = new StringBuilder();
while (!path.getMetadata().isRoot()) {
sb.insert(0, "." + fieldName(path));
path = path.getMetadata().getParent();
}
sb.deleteCharAt(0);
return sb.toString();
}
public static Criteria notDeleted() {
return new Criteria()
.andOperator(