Revert "chore: Remove QueryDSL and add Errorprone (#31754)"
This reverts commit 7f9d31adbc.
This commit is contained in:
parent
7f9d31adbc
commit
66a24c692a
|
|
@ -1,11 +0,0 @@
|
|||
-Dcomment='http://errorprone.info/docs/installation'
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
|
||||
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
|
||||
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
|
||||
|
|
@ -99,6 +99,19 @@
|
|||
<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>
|
||||
|
|
@ -235,4 +248,25 @@
|
|||
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
|
@ -11,6 +12,7 @@ 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 {}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ 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;
|
||||
|
|
@ -65,6 +66,7 @@ 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;
|
||||
|
|
@ -81,6 +83,7 @@ public abstract class BaseDomain implements Persistable<String>, AppsmithDomain,
|
|||
return this.getId() == null;
|
||||
}
|
||||
|
||||
@QueryTransient
|
||||
@JsonView(Views.Internal.class)
|
||||
public boolean isDeleted() {
|
||||
return deletedAt != null;
|
||||
|
|
|
|||
|
|
@ -304,6 +304,18 @@
|
|||
<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>
|
||||
|
|
@ -457,6 +469,26 @@
|
|||
<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>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ 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;
|
||||
|
|
@ -34,6 +35,7 @@ import static com.appsmith.server.helpers.StringUtils.dotted;
|
|||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@QueryEntity
|
||||
@Document
|
||||
@FieldNameConstants
|
||||
public class Application extends BaseDomain implements Artifact {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
|
@ -11,6 +12,7 @@ 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 {}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ 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;
|
||||
|
|
@ -28,6 +29,7 @@ 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;
|
||||
|
||||
|
|
@ -210,6 +212,19 @@ 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`.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ 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;
|
||||
|
|
@ -90,6 +92,21 @@ 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(
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
<properties>
|
||||
<deploy.disabled>true</deploy.disabled>
|
||||
<error-prone.version>2.26.1</error-prone.version>
|
||||
<java.version>17</java.version>
|
||||
<javadoc.disabled>true</javadoc.disabled>
|
||||
<logback.version>1.4.14</logback.version>
|
||||
|
|
@ -75,34 +74,6 @@
|
|||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgs>
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
<arg>
|
||||
<!-- Ref: http://errorprone.info/docs/flags -->
|
||||
-Xplugin:ErrorProne \
|
||||
-XepDisableAllChecks
|
||||
</arg>
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>com.google.errorprone</groupId>
|
||||
<artifactId>error_prone_core</artifactId>
|
||||
<version>${error-prone.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user