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.Git;
|
||||
import com.appsmith.external.views.Views;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
|
@ -91,6 +92,12 @@ public abstract class BaseDomain implements Persistable<String>, AppsmithDomain,
|
|||
@JsonView(Views.Public.class)
|
||||
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() {
|
||||
this.setCreatedAt(null);
|
||||
this.setUpdatedAt(null);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import static com.appsmith.external.helpers.StringUtils.dotted;
|
|||
@Setter
|
||||
@Getter
|
||||
@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
|
||||
// connected applications and will be used to connect resources across the branches
|
||||
@JsonView(Views.Internal.class)
|
||||
|
|
@ -23,7 +23,7 @@ public abstract class BranchAwareDomain extends GitSyncedDomain {
|
|||
super.sanitiseToExportDBObject();
|
||||
}
|
||||
|
||||
public static class Fields extends GitSyncedDomain.Fields {
|
||||
public static class Fields extends BaseDomain.Fields {
|
||||
public static final String defaultResources_applicationId =
|
||||
dotted(defaultResources, DefaultResources.Fields.applicationId);
|
||||
public static final String defaultResources_branchName =
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.Set;
|
|||
@NoArgsConstructor
|
||||
@Document
|
||||
@FieldNameConstants
|
||||
public class Datasource extends GitSyncedDomain {
|
||||
public class Datasource extends BranchAwareDomain {
|
||||
|
||||
@Transient
|
||||
public static final String DEFAULT_NAME_PREFIX = "Untitled datasource";
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import static com.appsmith.external.constants.PluginConstants.DEFAULT_REST_DATAS
|
|||
@NoArgsConstructor
|
||||
@Document
|
||||
@FieldNameConstants
|
||||
public class DatasourceStorage extends GitSyncedDomain {
|
||||
public class DatasourceStorage extends BaseDomain {
|
||||
|
||||
@JsonView(Views.Public.class)
|
||||
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) {
|
||||
List<CustomJSLib> importedCustomJSLibList =
|
||||
applicationJson.getCustomJSLibList().stream().collect(Collectors.toList());
|
||||
List<CustomJSLib> importedCustomJSLibList = applicationJson.getCustomJSLibList().stream()
|
||||
.peek(customJSLib -> customJSLib.setGitSyncId(
|
||||
null)) // setting this null so that this custom js lib can be imported again
|
||||
.collect(Collectors.toList());
|
||||
applicationJson.setCustomJSLibList(importedCustomJSLibList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.appsmith.server.domains.ce;
|
||||
|
||||
import com.appsmith.external.models.BaseDomain;
|
||||
import com.appsmith.external.models.BranchAwareDomain;
|
||||
import com.appsmith.external.views.Git;
|
||||
import com.appsmith.external.views.Views;
|
||||
|
|
@ -23,7 +22,7 @@ import java.util.Set;
|
|||
@ToString
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
public class CustomJSLibCE extends BaseDomain {
|
||||
public class CustomJSLibCE extends BranchAwareDomain {
|
||||
/* Library name */
|
||||
@JsonView({Views.Public.class, Git.class})
|
||||
String name;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.appsmith.server.imports.importable.artifactbased;
|
||||
|
||||
import com.appsmith.external.models.BaseDomain;
|
||||
import com.appsmith.external.models.GitSyncedDomain;
|
||||
import com.appsmith.server.domains.Artifact;
|
||||
import com.appsmith.server.domains.Context;
|
||||
import com.appsmith.server.dtos.ImportingMetaDTO;
|
||||
|
|
@ -36,19 +35,11 @@ public interface ArtifactBasedImportableServiceCE<T extends BaseDomain, U extend
|
|||
MappedImportableResourcesDTO mappedImportableResourcesDTO,
|
||||
Map<String, T> entityInCurrentArtifact,
|
||||
T entity) {
|
||||
if (entity instanceof GitSyncedDomain gitSyncedEntity) {
|
||||
return entityInCurrentArtifact.get(gitSyncedEntity.getGitSyncId());
|
||||
} else {
|
||||
return entity;
|
||||
}
|
||||
return entityInCurrentArtifact.get(entity.getGitSyncId());
|
||||
}
|
||||
|
||||
default T getExistingEntityInOtherBranchForImportedEntity(
|
||||
MappedImportableResourcesDTO mappedImportableResourcesDTO, Map<String, T> entityInOtherArtifact, T entity) {
|
||||
if (entity instanceof GitSyncedDomain gitSyncedEntity) {
|
||||
return entityInOtherArtifact.get(gitSyncedEntity.getGitSyncId());
|
||||
} else {
|
||||
return entity;
|
||||
}
|
||||
return entityInOtherArtifact.get(entity.getGitSyncId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.appsmith.external.converters.ISOStringToInstantConverter;
|
|||
import com.appsmith.external.models.BaseDomain;
|
||||
import com.appsmith.external.models.BranchAwareDomain;
|
||||
import com.appsmith.external.models.Datasource;
|
||||
import com.appsmith.external.models.GitSyncedDomain;
|
||||
import com.appsmith.external.models.PluginType;
|
||||
import com.appsmith.external.models.Policy;
|
||||
import com.appsmith.server.acl.AclPermission;
|
||||
|
|
@ -116,7 +115,7 @@ public class DatabaseChangelog2 {
|
|||
ActionCollection.class,
|
||||
makeIndex(
|
||||
defaultResources + "." + FieldName.APPLICATION_ID,
|
||||
GitSyncedDomain.Fields.gitSyncId,
|
||||
BaseDomain.Fields.gitSyncId,
|
||||
FieldName.DELETED)
|
||||
.named("defaultApplicationId_gitSyncId_deleted"));
|
||||
|
||||
|
|
@ -125,7 +124,7 @@ public class DatabaseChangelog2 {
|
|||
NewAction.class,
|
||||
makeIndex(
|
||||
defaultResources + "." + FieldName.APPLICATION_ID,
|
||||
GitSyncedDomain.Fields.gitSyncId,
|
||||
BaseDomain.Fields.gitSyncId,
|
||||
FieldName.DELETED)
|
||||
.named("defaultApplicationId_gitSyncId_deleted"));
|
||||
|
||||
|
|
@ -134,7 +133,7 @@ public class DatabaseChangelog2 {
|
|||
NewPage.class,
|
||||
makeIndex(
|
||||
defaultResources + "." + FieldName.APPLICATION_ID,
|
||||
GitSyncedDomain.Fields.gitSyncId,
|
||||
BaseDomain.Fields.gitSyncId,
|
||||
FieldName.DELETED)
|
||||
.named("defaultApplicationId_gitSyncId_deleted"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.appsmith.server.migrations.db.ce;
|
||||
|
||||
import com.appsmith.external.models.GitSyncedDomain;
|
||||
import com.appsmith.server.domains.NewAction;
|
||||
import io.mongock.api.annotations.ChangeUnit;
|
||||
import io.mongock.api.annotations.Execution;
|
||||
|
|
@ -41,14 +40,14 @@ public class Migration051AddNewActionCollectionIdIndex {
|
|||
|
||||
Document unpublishedDoc = new Document();
|
||||
unpublishedDoc.put(NewAction.Fields.unpublishedAction_collectionId, 1);
|
||||
unpublishedDoc.put(GitSyncedDomain.Fields.deletedAt, 1);
|
||||
unpublishedDoc.put(NewAction.Fields.deletedAt, 1);
|
||||
Index unpublishedCollectionIdIndex =
|
||||
new CompoundIndexDefinition(unpublishedDoc).named(unpublishedCollectionIdIndexName);
|
||||
ensureIndexes(mongoTemplate, NewAction.class, unpublishedCollectionIdIndex);
|
||||
|
||||
Document publishedDoc = new Document();
|
||||
publishedDoc.put(NewAction.Fields.publishedAction_collectionId, 1);
|
||||
publishedDoc.put(GitSyncedDomain.Fields.deletedAt, 1);
|
||||
publishedDoc.put(NewAction.Fields.deletedAt, 1);
|
||||
Index publishedCollectionIdIndex =
|
||||
new CompoundIndexDefinition(publishedDoc).named(publishedCollectionIdIndexName);
|
||||
ensureIndexes(mongoTemplate, NewAction.class, publishedCollectionIdIndex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user