Revert "chore: GitSynced and BranchAware are two different types (#32… (#32965)
This commit is contained in:
parent
f31140f33e
commit
7edd5c5a2f
|
|
@ -4,6 +4,7 @@ import com.appsmith.external.helpers.Identifiable;
|
||||||
import com.appsmith.external.views.FromRequest;
|
import com.appsmith.external.views.FromRequest;
|
||||||
import com.appsmith.external.views.Git;
|
import com.appsmith.external.views.Git;
|
||||||
import com.appsmith.external.views.Views;
|
import com.appsmith.external.views.Views;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonView;
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@ -91,6 +92,12 @@ public abstract class BaseDomain implements Persistable<String>, AppsmithDomain,
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
public Set<String> userPermissions = new HashSet<>();
|
public Set<String> userPermissions = new HashSet<>();
|
||||||
|
|
||||||
|
// This field will only be used for git related functionality to sync the action object across different instances.
|
||||||
|
// This field will be deprecated once we move to the new git sync implementation.
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
@JsonView({Views.Internal.class, Git.class})
|
||||||
|
String gitSyncId;
|
||||||
|
|
||||||
public void sanitiseToExportDBObject() {
|
public void sanitiseToExportDBObject() {
|
||||||
this.setCreatedAt(null);
|
this.setCreatedAt(null);
|
||||||
this.setUpdatedAt(null);
|
this.setUpdatedAt(null);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import static com.appsmith.external.helpers.StringUtils.dotted;
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@FieldNameConstants
|
@FieldNameConstants
|
||||||
public abstract class BranchAwareDomain extends GitSyncedDomain {
|
public abstract class BranchAwareDomain extends BaseDomain {
|
||||||
// This field will be used to store the default/root resource IDs for branched resources generated for git
|
// This field will be used to store the default/root resource IDs for branched resources generated for git
|
||||||
// connected applications and will be used to connect resources across the branches
|
// connected applications and will be used to connect resources across the branches
|
||||||
@JsonView(Views.Internal.class)
|
@JsonView(Views.Internal.class)
|
||||||
|
|
@ -23,7 +23,7 @@ public abstract class BranchAwareDomain extends GitSyncedDomain {
|
||||||
super.sanitiseToExportDBObject();
|
super.sanitiseToExportDBObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Fields extends GitSyncedDomain.Fields {
|
public static class Fields extends BaseDomain.Fields {
|
||||||
public static final String defaultResources_applicationId =
|
public static final String defaultResources_applicationId =
|
||||||
dotted(defaultResources, DefaultResources.Fields.applicationId);
|
dotted(defaultResources, DefaultResources.Fields.applicationId);
|
||||||
public static final String defaultResources_branchName =
|
public static final String defaultResources_branchName =
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import java.util.Set;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Document
|
@Document
|
||||||
@FieldNameConstants
|
@FieldNameConstants
|
||||||
public class Datasource extends GitSyncedDomain {
|
public class Datasource extends BranchAwareDomain {
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
public static final String DEFAULT_NAME_PREFIX = "Untitled datasource";
|
public static final String DEFAULT_NAME_PREFIX = "Untitled datasource";
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import static com.appsmith.external.constants.PluginConstants.DEFAULT_REST_DATAS
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Document
|
@Document
|
||||||
@FieldNameConstants
|
@FieldNameConstants
|
||||||
public class DatasourceStorage extends GitSyncedDomain {
|
public class DatasourceStorage extends BaseDomain {
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String datasourceId;
|
String datasourceId;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package com.appsmith.external.models;
|
|
||||||
|
|
||||||
import com.appsmith.external.views.Git;
|
|
||||||
import com.appsmith.external.views.Views;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonView;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.experimental.FieldNameConstants;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@FieldNameConstants
|
|
||||||
public abstract class GitSyncedDomain extends BaseDomain {
|
|
||||||
// This field will only be used for git related functionality to sync the action object across different instances.
|
|
||||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
|
||||||
@JsonView({Views.Internal.class, Git.class})
|
|
||||||
String gitSyncId;
|
|
||||||
|
|
||||||
public static class Fields extends BaseDomain.Fields {}
|
|
||||||
}
|
|
||||||
|
|
@ -310,8 +310,10 @@ public class ApplicationImportServiceCEImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applicationJson.getCustomJSLibList() != null) {
|
if (applicationJson.getCustomJSLibList() != null) {
|
||||||
List<CustomJSLib> importedCustomJSLibList =
|
List<CustomJSLib> importedCustomJSLibList = applicationJson.getCustomJSLibList().stream()
|
||||||
applicationJson.getCustomJSLibList().stream().collect(Collectors.toList());
|
.peek(customJSLib -> customJSLib.setGitSyncId(
|
||||||
|
null)) // setting this null so that this custom js lib can be imported again
|
||||||
|
.collect(Collectors.toList());
|
||||||
applicationJson.setCustomJSLibList(importedCustomJSLibList);
|
applicationJson.setCustomJSLibList(importedCustomJSLibList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.appsmith.server.domains.ce;
|
package com.appsmith.server.domains.ce;
|
||||||
|
|
||||||
import com.appsmith.external.models.BaseDomain;
|
|
||||||
import com.appsmith.external.models.BranchAwareDomain;
|
import com.appsmith.external.models.BranchAwareDomain;
|
||||||
import com.appsmith.external.views.Git;
|
import com.appsmith.external.views.Git;
|
||||||
import com.appsmith.external.views.Views;
|
import com.appsmith.external.views.Views;
|
||||||
|
|
@ -23,7 +22,7 @@ import java.util.Set;
|
||||||
@ToString
|
@ToString
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@FieldNameConstants
|
@FieldNameConstants
|
||||||
public class CustomJSLibCE extends BaseDomain {
|
public class CustomJSLibCE extends BranchAwareDomain {
|
||||||
/* Library name */
|
/* Library name */
|
||||||
@JsonView({Views.Public.class, Git.class})
|
@JsonView({Views.Public.class, Git.class})
|
||||||
String name;
|
String name;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.appsmith.server.imports.importable.artifactbased;
|
package com.appsmith.server.imports.importable.artifactbased;
|
||||||
|
|
||||||
import com.appsmith.external.models.BaseDomain;
|
import com.appsmith.external.models.BaseDomain;
|
||||||
import com.appsmith.external.models.GitSyncedDomain;
|
|
||||||
import com.appsmith.server.domains.Artifact;
|
import com.appsmith.server.domains.Artifact;
|
||||||
import com.appsmith.server.domains.Context;
|
import com.appsmith.server.domains.Context;
|
||||||
import com.appsmith.server.dtos.ImportingMetaDTO;
|
import com.appsmith.server.dtos.ImportingMetaDTO;
|
||||||
|
|
@ -36,19 +35,11 @@ public interface ArtifactBasedImportableServiceCE<T extends BaseDomain, U extend
|
||||||
MappedImportableResourcesDTO mappedImportableResourcesDTO,
|
MappedImportableResourcesDTO mappedImportableResourcesDTO,
|
||||||
Map<String, T> entityInCurrentArtifact,
|
Map<String, T> entityInCurrentArtifact,
|
||||||
T entity) {
|
T entity) {
|
||||||
if (entity instanceof GitSyncedDomain gitSyncedEntity) {
|
return entityInCurrentArtifact.get(entity.getGitSyncId());
|
||||||
return entityInCurrentArtifact.get(gitSyncedEntity.getGitSyncId());
|
|
||||||
} else {
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default T getExistingEntityInOtherBranchForImportedEntity(
|
default T getExistingEntityInOtherBranchForImportedEntity(
|
||||||
MappedImportableResourcesDTO mappedImportableResourcesDTO, Map<String, T> entityInOtherArtifact, T entity) {
|
MappedImportableResourcesDTO mappedImportableResourcesDTO, Map<String, T> entityInOtherArtifact, T entity) {
|
||||||
if (entity instanceof GitSyncedDomain gitSyncedEntity) {
|
return entityInOtherArtifact.get(entity.getGitSyncId());
|
||||||
return entityInOtherArtifact.get(gitSyncedEntity.getGitSyncId());
|
|
||||||
} else {
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import com.appsmith.external.converters.ISOStringToInstantConverter;
|
||||||
import com.appsmith.external.models.BaseDomain;
|
import com.appsmith.external.models.BaseDomain;
|
||||||
import com.appsmith.external.models.BranchAwareDomain;
|
import com.appsmith.external.models.BranchAwareDomain;
|
||||||
import com.appsmith.external.models.Datasource;
|
import com.appsmith.external.models.Datasource;
|
||||||
import com.appsmith.external.models.GitSyncedDomain;
|
|
||||||
import com.appsmith.external.models.PluginType;
|
import com.appsmith.external.models.PluginType;
|
||||||
import com.appsmith.external.models.Policy;
|
import com.appsmith.external.models.Policy;
|
||||||
import com.appsmith.server.acl.AclPermission;
|
import com.appsmith.server.acl.AclPermission;
|
||||||
|
|
@ -116,7 +115,7 @@ public class DatabaseChangelog2 {
|
||||||
ActionCollection.class,
|
ActionCollection.class,
|
||||||
makeIndex(
|
makeIndex(
|
||||||
defaultResources + "." + FieldName.APPLICATION_ID,
|
defaultResources + "." + FieldName.APPLICATION_ID,
|
||||||
GitSyncedDomain.Fields.gitSyncId,
|
BaseDomain.Fields.gitSyncId,
|
||||||
FieldName.DELETED)
|
FieldName.DELETED)
|
||||||
.named("defaultApplicationId_gitSyncId_deleted"));
|
.named("defaultApplicationId_gitSyncId_deleted"));
|
||||||
|
|
||||||
|
|
@ -125,7 +124,7 @@ public class DatabaseChangelog2 {
|
||||||
NewAction.class,
|
NewAction.class,
|
||||||
makeIndex(
|
makeIndex(
|
||||||
defaultResources + "." + FieldName.APPLICATION_ID,
|
defaultResources + "." + FieldName.APPLICATION_ID,
|
||||||
GitSyncedDomain.Fields.gitSyncId,
|
BaseDomain.Fields.gitSyncId,
|
||||||
FieldName.DELETED)
|
FieldName.DELETED)
|
||||||
.named("defaultApplicationId_gitSyncId_deleted"));
|
.named("defaultApplicationId_gitSyncId_deleted"));
|
||||||
|
|
||||||
|
|
@ -134,7 +133,7 @@ public class DatabaseChangelog2 {
|
||||||
NewPage.class,
|
NewPage.class,
|
||||||
makeIndex(
|
makeIndex(
|
||||||
defaultResources + "." + FieldName.APPLICATION_ID,
|
defaultResources + "." + FieldName.APPLICATION_ID,
|
||||||
GitSyncedDomain.Fields.gitSyncId,
|
BaseDomain.Fields.gitSyncId,
|
||||||
FieldName.DELETED)
|
FieldName.DELETED)
|
||||||
.named("defaultApplicationId_gitSyncId_deleted"));
|
.named("defaultApplicationId_gitSyncId_deleted"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.appsmith.server.migrations.db.ce;
|
package com.appsmith.server.migrations.db.ce;
|
||||||
|
|
||||||
import com.appsmith.external.models.GitSyncedDomain;
|
|
||||||
import com.appsmith.server.domains.NewAction;
|
import com.appsmith.server.domains.NewAction;
|
||||||
import io.mongock.api.annotations.ChangeUnit;
|
import io.mongock.api.annotations.ChangeUnit;
|
||||||
import io.mongock.api.annotations.Execution;
|
import io.mongock.api.annotations.Execution;
|
||||||
|
|
@ -41,14 +40,14 @@ public class Migration051AddNewActionCollectionIdIndex {
|
||||||
|
|
||||||
Document unpublishedDoc = new Document();
|
Document unpublishedDoc = new Document();
|
||||||
unpublishedDoc.put(NewAction.Fields.unpublishedAction_collectionId, 1);
|
unpublishedDoc.put(NewAction.Fields.unpublishedAction_collectionId, 1);
|
||||||
unpublishedDoc.put(GitSyncedDomain.Fields.deletedAt, 1);
|
unpublishedDoc.put(NewAction.Fields.deletedAt, 1);
|
||||||
Index unpublishedCollectionIdIndex =
|
Index unpublishedCollectionIdIndex =
|
||||||
new CompoundIndexDefinition(unpublishedDoc).named(unpublishedCollectionIdIndexName);
|
new CompoundIndexDefinition(unpublishedDoc).named(unpublishedCollectionIdIndexName);
|
||||||
ensureIndexes(mongoTemplate, NewAction.class, unpublishedCollectionIdIndex);
|
ensureIndexes(mongoTemplate, NewAction.class, unpublishedCollectionIdIndex);
|
||||||
|
|
||||||
Document publishedDoc = new Document();
|
Document publishedDoc = new Document();
|
||||||
publishedDoc.put(NewAction.Fields.publishedAction_collectionId, 1);
|
publishedDoc.put(NewAction.Fields.publishedAction_collectionId, 1);
|
||||||
publishedDoc.put(GitSyncedDomain.Fields.deletedAt, 1);
|
publishedDoc.put(NewAction.Fields.deletedAt, 1);
|
||||||
Index publishedCollectionIdIndex =
|
Index publishedCollectionIdIndex =
|
||||||
new CompoundIndexDefinition(publishedDoc).named(publishedCollectionIdIndexName);
|
new CompoundIndexDefinition(publishedDoc).named(publishedCollectionIdIndexName);
|
||||||
ensureIndexes(mongoTemplate, NewAction.class, publishedCollectionIdIndex);
|
ensureIndexes(mongoTemplate, NewAction.class, publishedCollectionIdIndex);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user