Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Custom applications for DIAL #575

Merged
merged 115 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
3106b4f
AppendCustomApplicationPropertiesFn added and docker-entrypoint fixed
sergey-zinchenko Oct 30, 2024
42079da
Serialization and Deserialization for custom app schemas in Config
sergey-zinchenko Oct 30, 2024
2b39fd2
AppSchemasController based on string schemas
sergey-zinchenko Oct 31, 2024
1dd7a32
AppSchemasController based on string schemas
sergey-zinchenko Oct 31, 2024
fe79c32
JsonArrayToSchemaMapDeserializer lowering code complexity
sergey-zinchenko Oct 31, 2024
a9269f2
ConformToSchemaValidator on a bean
sergey-zinchenko Nov 4, 2024
0c6d298
ConformToMetaSchemaValidator and ApplicationsConformToSchemasValidato…
sergey-zinchenko Nov 4, 2024
4db73c3
JsonArrayToSchemaMapDeserializer and MapToJsonArraySerializer for Config
sergey-zinchenko Nov 4, 2024
037aff4
MAPPER_WITH_VALIDATION in ProxyUtil
sergey-zinchenko Nov 4, 2024
191523a
CustomApplicationPropertiesUtils used in AppendCustomApplicationPrope…
sergey-zinchenko Nov 4, 2024
69792d7
Fixes for custom application validation
sergey-zinchenko Nov 5, 2024
1da5a35
Application copy constructor
sergey-zinchenko Nov 5, 2024
4043983
ApplicationData structure change
sergey-zinchenko Nov 5, 2024
b0adf2f
filterCustomClientProperties 1st option with separate filtering of wr…
sergey-zinchenko Nov 7, 2024
627d965
filterCustomClientPropertiesWhenNoWriteAccess 2st option with combine…
sergey-zinchenko Nov 7, 2024
12e9274
changes respecting properties filtering for deployment controller fai…
sergey-zinchenko Nov 7, 2024
042f44b
CustomApplicationPropertiesUtils refactoring
sergey-zinchenko Nov 7, 2024
bbdb423
refactoring
sergey-zinchenko Nov 11, 2024
a280d1a
Custom application utils
sergey-zinchenko Nov 11, 2024
89d4102
validateCustomApplication
sergey-zinchenko Nov 12, 2024
1427e05
validateCustomApplication in controller
sergey-zinchenko Nov 12, 2024
6f84b31
CustomApplicationUtils with custom exception
sergey-zinchenko Nov 13, 2024
a98a8c7
compile fix
sergey-zinchenko Nov 13, 2024
aacddaa
CustomAppValidationException introduced
sergey-zinchenko Nov 13, 2024
58d1b25
dial-file format
sergey-zinchenko Nov 14, 2024
a6401f2
addCustomApplicationRelatedFiles in publication service
sergey-zinchenko Nov 14, 2024
1cd7376
publication with approval of custom apps works
sergey-zinchenko Nov 14, 2024
1497614
replaceLinksInJsonNode refactoring
sergey-zinchenko Nov 14, 2024
4c3d78c
fix for target path of publication and inked resources
sergey-zinchenko Nov 14, 2024
421f887
ShareService has support for linked files
sergey-zinchenko Nov 15, 2024
053d59f
CustomApplicationUtils split up
sergey-zinchenko Nov 15, 2024
c149684
CustomApplicationUtils refactoring
sergey-zinchenko Nov 15, 2024
0148a82
schemas refactoring
sergey-zinchenko Nov 15, 2024
81f60c7
MetaSchemaHolder
sergey-zinchenko Nov 15, 2024
4057279
CustomApplicationUtils changes to MetaSchemaHolder.CUSTOM_APPLICATION…
sergey-zinchenko Nov 15, 2024
99c594f
CustomApplicationUtils DIAL_META_SCHEMA fix warning of missing keywords
sergey-zinchenko Nov 15, 2024
e4afda4
removed unnecessary exceptions handling
sergey-zinchenko Nov 15, 2024
5f2c766
Merge branch 'development' into feature/custom-apps
sergey-zinchenko Nov 15, 2024
a3b9d5e
JsonArrayToSchemaMapDeserializer fixes after review
sergey-zinchenko Nov 19, 2024
8987d4a
MetaSchemaHolder fixes after review
sergey-zinchenko Nov 19, 2024
2e9628c
getCustomApplicationMetaSchema calls inside executeBlocking in AppSch…
sergey-zinchenko Nov 19, 2024
e441c14
AppSchemasController constants moved to top
sergey-zinchenko Nov 19, 2024
a018da4
removed unnecessary url decode from AppSchemaController
sergey-zinchenko Nov 19, 2024
a4e6baa
ResourceController removed duplicate of resourceService
sergey-zinchenko Nov 19, 2024
939bfc3
AppSchemaController api moved to ops
sergey-zinchenko Nov 19, 2024
09fe5c6
validateCustomApplication moved to executeBlocking. unnecessary log r…
sergey-zinchenko Nov 19, 2024
8be9aca
validateCustomApplication moved to executeBlocking application service
sergey-zinchenko Nov 19, 2024
45f6fe1
removed duplicate resourceService.hasResource(resource) check in vali…
sergey-zinchenko Nov 19, 2024
aeecbf5
refactoring of filtering after review
sergey-zinchenko Nov 20, 2024
5b1d8ff
Merge branch 'development' into feature/custom-apps
sergey-zinchenko Nov 20, 2024
c2a9127
refactoring after review. not modify endpoint while posting the app. …
sergey-zinchenko Nov 20, 2024
55d6743
fixes after review. CustomAppValidationException moved.
sergey-zinchenko Nov 20, 2024
12c9773
fixes after review. BeanDeserializerWithValidation moved.
sergey-zinchenko Nov 20, 2024
dbdd938
fixes after review. replaceLinksInJsonNode moved to utils.
sergey-zinchenko Nov 20, 2024
53cbc0a
fixes after review. validateCustomApplication moved back.
sergey-zinchenko Nov 20, 2024
e9f03f8
fixes after review. com.google.code.findbugs removed.
sergey-zinchenko Nov 20, 2024
b402557
fixes after review. getCustomApplicationSchema doesnt throws.
sergey-zinchenko Nov 20, 2024
7f1e659
fixes after review. ConformToMetaSchemaValidator param renamed
sergey-zinchenko Nov 20, 2024
38f5dcb
fixes after review. common code moved to getMetaschemaBuilder
sergey-zinchenko Nov 20, 2024
91f8823
fixes after review. targetFolder construction moved to function
sergey-zinchenko Nov 20, 2024
312bb73
fixes after review. addCustomApplicationRelatedFiles refactoring
sergey-zinchenko Nov 20, 2024
25ec1c4
fixes after review. DeploymentController apply modifications of appli…
sergey-zinchenko Nov 21, 2024
36faed5
fixes after review. CustomApplicationUtils collectors become more thr…
sergey-zinchenko Nov 21, 2024
7425119
Revert "fixes after review. CustomApplicationUtils collectors become …
sergey-zinchenko Nov 21, 2024
d280c10
fixes after review. removed synchronization in ListCollector
sergey-zinchenko Nov 21, 2024
b6018a8
Merge branch 'refs/heads/development' into feature/custom-apps
sergey-zinchenko Nov 21, 2024
8ff611f
fox after review. api rename.
sergey-zinchenko Nov 25, 2024
8a8cb72
fox after review. filter public files before add them to the publicat…
sergey-zinchenko Nov 25, 2024
2a3b5b4
fox after review. replaceCustomAppFiles moved.
sergey-zinchenko Nov 26, 2024
9c94820
change schema namings after proposal approval
sergey-zinchenko Dec 17, 2024
7d7b5fc
change schema namings after proposal approval
sergey-zinchenko Dec 19, 2024
3e361eb
Merge branch 'development' into feature/custom-apps
sergey-zinchenko Dec 19, 2024
a412602
fix misprint in exceptions of resource controller
sergey-zinchenko Dec 19, 2024
fd69776
fix for folders
sergey-zinchenko Dec 19, 2024
3823553
PublicationService changes to correct destination folder of custom ap…
sergey-zinchenko Dec 19, 2024
69077a6
PublicationService dedup of files with the same name for custom apps
sergey-zinchenko Dec 20, 2024
60d6ee0
PublicationService dedup of files with the same name for custom apps.…
sergey-zinchenko Dec 20, 2024
05bc80c
Basic test fixup
sergey-zinchenko Dec 20, 2024
364393a
fix of merge resolution error of copyHeaders
sergey-zinchenko Dec 23, 2024
25e15c6
Merge branch 'development' into feature/custom-apps
sergey-zinchenko Dec 23, 2024
dc30e4c
Dial file format and meta schema tests
sergey-zinchenko Dec 24, 2024
15e59e4
JsonArrayToSchemaMapDeserializer tests
sergey-zinchenko Dec 24, 2024
05284c1
checkstyle fix
sergey-zinchenko Dec 24, 2024
9a18418
ConformToMetaSchemaValidator tests
sergey-zinchenko Dec 24, 2024
2c6cc32
CustomApplicationsConformToTypeSchemasValidator tests
sergey-zinchenko Dec 24, 2024
39d9d99
ApplicationTypeSchemaController tests
sergey-zinchenko Dec 25, 2024
a2e7fac
CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 25, 2024
874baa1
more CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 25, 2024
d694d14
more CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 25, 2024
fd12ab0
more CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 26, 2024
a358f4a
more CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 26, 2024
2baa10f
more CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 26, 2024
30b59b8
more CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 26, 2024
57eb90b
more CustomApplicationTypeSchemaUtils tests
sergey-zinchenko Dec 26, 2024
a1e8194
fix for regex in controller selector
sergey-zinchenko Dec 26, 2024
e45f5b4
fixes for comments
sergey-zinchenko Dec 26, 2024
54c97a0
Merge branch 'refs/heads/development' into feature/custom-apps
sergey-zinchenko Dec 26, 2024
02cbbf8
resource api tests
sergey-zinchenko Dec 26, 2024
39a8067
resource api tests
sergey-zinchenko Dec 26, 2024
cb5bc91
ApplicationTypeSchema api tests
sergey-zinchenko Dec 27, 2024
cc3b05f
ApplicationTypeSchema api tests
sergey-zinchenko Dec 27, 2024
1bb6176
Publication api tests
sergey-zinchenko Dec 27, 2024
3104d04
Publication api tests
sergey-zinchenko Dec 27, 2024
6ee1871
Share api tests
sergey-zinchenko Dec 27, 2024
c2131ba
Share api tests
sergey-zinchenko Dec 27, 2024
cd96ebf
fix for application validation of custom app with schema to disallow …
sergey-zinchenko Dec 27, 2024
b5e68c7
fix for application sharing of custom app with schema to disallow pub…
sergey-zinchenko Dec 27, 2024
1412b22
fix for application sharing of custom app with schema to disallow sha…
sergey-zinchenko Dec 27, 2024
8a94921
application api tests
sergey-zinchenko Dec 27, 2024
245a951
AppendCustomApplicationPropertiesFn tests
sergey-zinchenko Dec 27, 2024
7f6a24d
Publication api test cleanup
sergey-zinchenko Dec 27, 2024
3a52a1c
bug fix for DeploymentFeatureController
sergey-zinchenko Dec 27, 2024
c39c60e
revert
sergey-zinchenko Dec 27, 2024
b77839a
AppendCustomApplicationPropertiesFn tests
sergey-zinchenko Dec 27, 2024
c13f872
Merge branch 'development' into feature/custom-apps
sergey-zinchenko Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import com.epam.aidial.core.config.databind.JsonArrayToSchemaMapDeserializer;
import com.epam.aidial.core.config.databind.MapToJsonArraySerializer;
import com.epam.aidial.core.config.validation.ConformToMetaSchema;
import com.epam.aidial.core.config.validation.CustomApplicationsConformToSchemas;
import com.epam.aidial.core.config.validation.CustomApplicationsConformToTypeSchemas;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
Expand All @@ -18,7 +17,7 @@

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@CustomApplicationsConformToSchemas(message = "All custom schema-rich applications should conform to their schemas")
@CustomApplicationsConformToTypeSchemas(message = "All custom schema-rich applications should conform to their schemas")
public class Config {
public static final String ASSISTANT = "assistant";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import static java.lang.annotation.ElementType.TYPE;

@Documented
@Constraint(validatedBy = { CustomApplicationsConformToSchemasValidator.class})
@Constraint(validatedBy = { CustomApplicationsConformToTypeSchemasValidator.class})
@Target({ TYPE })
@Retention(RetentionPolicy.RUNTIME)
@ReportAsSingleViolation
public @interface CustomApplicationsConformToSchemas {
public @interface CustomApplicationsConformToTypeSchemas {
String message() default "Custom applications should comply with their schemas";
Class<?>[] groups() default {};
Class<? extends jakarta.validation.Payload>[] payload() default {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static com.epam.aidial.core.metaschemas.MetaSchemaHolder.getMetaschemaBuilder;

@Slf4j
public class CustomApplicationsConformToSchemasValidator implements ConstraintValidator<CustomApplicationsConformToSchemas, Config> {
public class CustomApplicationsConformToTypeSchemasValidator implements ConstraintValidator<CustomApplicationsConformToTypeSchemas, Config> {


private static final JsonMetaSchema DIAL_META_SCHEMA = getMetaschemaBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import com.epam.aidial.core.server.service.ApplicationService;
import com.epam.aidial.core.server.service.PermissionDeniedException;
import com.epam.aidial.core.server.service.ResourceNotFoundException;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils;
import com.epam.aidial.core.server.util.BucketBuilder;
import com.epam.aidial.core.server.util.CustomApplicationUtils;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.epam.aidial.core.server.util.ResourceDescriptorFactory;
import com.epam.aidial.core.storage.http.HttpException;
Expand Down Expand Up @@ -66,7 +66,7 @@ public Future<?> getApplications() {
List<Application> list = new ArrayList<>();
astsiapanay marked this conversation as resolved.
Show resolved Hide resolved
for (Application application : config.getApplications().values()) {
if (application.hasAccess(context.getUserRoles())) {
application = CustomApplicationUtils.filterCustomClientProperties(config, application);
application = ApplicationTypeSchemaUtils.filterCustomClientProperties(config, application);
list.add(application);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
import java.util.Map;

@Slf4j
public class AppSchemaController {
public class ApplicationTypeSchemaController {

private static final String FAILED_READ_SCHEMA_MESSAGE = "Failed to read schema from resources";
private static final String ID_FIELD = "$id";
private static final String ID_PARAM = "id";
private static final String EDITOR_URL_FIELD = "dial:custom-application-type-editor-url";
private static final String DISPLAY_NAME_FIELD = "dial:custom-application-type-display-name";
private static final String COMPLETION_ENDPOINT_FIELD = "dial:custom-application-type-completion-endpoint";
private static final String EDITOR_URL_FIELD = "dial:applicationTypeEditorUrl";
private static final String DISPLAY_NAME_FIELD = "dial:applicationTypeDisplayName";
private static final String COMPLETION_ENDPOINT_FIELD = "dial:applicationTypeCompletionEndpoint";

private final ProxyContext context;
private final Vertx vertx;

public AppSchemaController(ProxyContext context) {
public ApplicationTypeSchemaController(ProxyContext context) {
this.context = context;
this.vertx = context.getProxy().getVertx();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class ControllerSelector {

private static final Pattern USER_INFO = Pattern.compile("^/v1/user/info$");

private static final Pattern APP_SCHEMAS = Pattern.compile("^/v1/application_type_schemas(/schemas|/schema|/meta_schema)?$");
private static final Pattern APP_SCHEMAS = Pattern.compile("^/v1/application_type_schemas(/schemas|/schema|/meta_schema)?");
artsiomkorzun marked this conversation as resolved.
Show resolved Hide resolved

static {
// GET routes
Expand Down Expand Up @@ -173,7 +173,7 @@ public class ControllerSelector {
});
get(USER_INFO, (proxy, context, pathMatcher) -> new UserInfoController(context));
get(APP_SCHEMAS, (proxy, context, pathMatcher) -> {
AppSchemaController controller = new AppSchemaController(context);
ApplicationTypeSchemaController controller = new ApplicationTypeSchemaController(context);
String operation = pathMatcher.group(1);
return switch (operation) {
case "/schemas" -> controller::handleListSchemas;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.epam.aidial.core.server.data.ResourceTypes;
import com.epam.aidial.core.server.service.PermissionDeniedException;
import com.epam.aidial.core.server.service.ResourceNotFoundException;
import com.epam.aidial.core.server.util.CustomApplicationUtils;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils;
import com.epam.aidial.core.server.util.ResourceDescriptorFactory;
import com.epam.aidial.core.storage.http.HttpStatus;
import com.epam.aidial.core.storage.resource.ResourceDescriptor;
Expand Down Expand Up @@ -81,10 +81,10 @@ public static Future<Deployment> selectDeployment(ProxyContext context, String i
}
Application modifiedApp = application;
if (filterCustomProperties) {
modifiedApp = CustomApplicationUtils.filterCustomClientProperties(context.getConfig(), application);
modifiedApp = ApplicationTypeSchemaUtils.filterCustomClientProperties(context.getConfig(), application);
}
if (modifyEndpoint) {
modifiedApp = CustomApplicationUtils.modifyEndpointForCustomApplication(context.getConfig(), modifiedApp);
modifiedApp = ApplicationTypeSchemaUtils.modifyEndpointForCustomApplication(context.getConfig(), modifiedApp);
}
return modifiedApp;
});
Expand Down Expand Up @@ -120,10 +120,10 @@ public static Future<Deployment> selectDeployment(ProxyContext context, String i

if (app.getCustomAppSchemaId() != null) {
artsiomkorzun marked this conversation as resolved.
Show resolved Hide resolved
if (filterCustomProperties) {
app = CustomApplicationUtils.filterCustomClientPropertiesWhenNoWriteAccess(context, resource, app);
app = ApplicationTypeSchemaUtils.filterCustomClientPropertiesWhenNoWriteAccess(context, resource, app);
}
if (modifyEndpoint) {
app = CustomApplicationUtils.modifyEndpointForCustomApplication(context.getConfig(), app);
app = ApplicationTypeSchemaUtils.modifyEndpointForCustomApplication(context.getConfig(), app);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
import com.epam.aidial.core.server.service.PermissionDeniedException;
import com.epam.aidial.core.server.service.ResourceNotFoundException;
import com.epam.aidial.core.server.service.ShareService;
import com.epam.aidial.core.server.util.CustomApplicationUtils;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaProcessingException;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.epam.aidial.core.server.util.ResourceDescriptorFactory;
import com.epam.aidial.core.server.validation.CustomAppValidationException;
import com.epam.aidial.core.server.validation.ApplicationTypeSchemaValidationException;
import com.epam.aidial.core.storage.data.MetadataBase;
import com.epam.aidial.core.storage.data.ResourceItemMetadata;
import com.epam.aidial.core.storage.http.HttpException;
Expand Down Expand Up @@ -177,15 +178,17 @@ private Future<Pair<ResourceItemMetadata, String>> getResourceData(ResourceDescr
private void validateCustomApplication(Application application) {
artsiomkorzun marked this conversation as resolved.
Show resolved Hide resolved
try {
Config config = context.getConfig();
List<ResourceDescriptor> files = CustomApplicationUtils.getFiles(config, application, encryptionService,
List<ResourceDescriptor> files = ApplicationTypeSchemaUtils.getFiles(config, application, encryptionService,
resourceService);
files.stream().filter(resource -> !(accessService.hasReadAccess(resource, context)))
.findAny().ifPresent(file -> {
throw new HttpException(BAD_REQUEST, "No read access to file: " + file.getUrl());
});
} catch (ValidationException | IllegalArgumentException e) {
throw new HttpException(BAD_REQUEST, "Custom application validation failed", e);
} catch (CustomAppValidationException e) {
} catch (ApplicationTypeSchemaValidationException e) {
throw new HttpException(BAD_REQUEST, "Custom application processing exception", e);
} catch (ApplicationTypeSchemaProcessingException e) {
throw new HttpException(INTERNAL_SERVER_ERROR, "Custom application validation failed", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.epam.aidial.core.server.Proxy;
import com.epam.aidial.core.server.ProxyContext;
import com.epam.aidial.core.server.function.BaseRequestFunction;
import com.epam.aidial.core.server.util.CustomApplicationUtils;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -25,7 +25,7 @@ public Boolean apply(ObjectNode tree) {
return false;
}
boolean appended = false;
Map<String, Object> props = CustomApplicationUtils.getCustomServerProperties(context.getConfig(), application);
Map<String, Object> props = ApplicationTypeSchemaUtils.getCustomServerProperties(context.getConfig(), application);
ObjectNode customAppPropertiesNode = ProxyUtil.MAPPER.createObjectNode();
for (Map.Entry<String, Object> entry : props.entrySet()) {
customAppPropertiesNode.putPOJO(entry.getKey(), entry.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.epam.aidial.core.server.data.SharedResourcesResponse;
import com.epam.aidial.core.server.security.AccessService;
import com.epam.aidial.core.server.security.EncryptionService;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils;
import com.epam.aidial.core.server.util.BucketBuilder;
import com.epam.aidial.core.server.util.CustomApplicationUtils;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.epam.aidial.core.server.util.ResourceDescriptorFactory;
import com.epam.aidial.core.storage.blobstore.BlobStorageUtil;
Expand Down Expand Up @@ -134,7 +134,7 @@ public List<Application> getSharedApplications(ProxyContext context) {

if (meta instanceof ResourceItemMetadata) {
Application application = getApplication(resource).getValue();
application = CustomApplicationUtils.filterCustomClientPropertiesWhenNoWriteAccess(context, resource, application);
application = ApplicationTypeSchemaUtils.filterCustomClientPropertiesWhenNoWriteAccess(context, resource, application);
list.add(application);
} else {
list.addAll(getApplications(resource, context));
Expand Down Expand Up @@ -200,7 +200,7 @@ public List<Application> getApplications(ResourceDescriptor resource,
try {
ResourceDescriptor item = ResourceDescriptorFactory.fromAnyUrl(meta.getUrl(), encryptionService);
Application application = getApplication(item).getValue();
application = CustomApplicationUtils.filterCustomClientPropertiesWhenNoWriteAccess(ctx, item, application);
application = ApplicationTypeSchemaUtils.filterCustomClientPropertiesWhenNoWriteAccess(ctx, item, application);
applications.add(application);
} catch (ResourceNotFoundException ignore) {
// deleted while fetching
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import com.epam.aidial.core.server.data.Rule;
import com.epam.aidial.core.server.security.AccessService;
import com.epam.aidial.core.server.security.EncryptionService;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils;
import com.epam.aidial.core.server.util.BucketBuilder;
import com.epam.aidial.core.server.util.CustomApplicationUtils;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.epam.aidial.core.server.util.ResourceDescriptorFactory;
import com.epam.aidial.core.storage.data.MetadataBase;
Expand Down Expand Up @@ -41,7 +41,7 @@
import java.util.stream.Stream;
import javax.annotation.Nullable;

import static com.epam.aidial.core.server.util.CustomApplicationUtils.replaceCustomAppFiles;
import static com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils.replaceCustomAppFiles;

@RequiredArgsConstructor
public class PublicationService {
Expand Down Expand Up @@ -405,7 +405,7 @@ private void addCustomApplicationRelatedFiles(ProxyContext context, Publication
return Stream.empty();
}
Publication.ResourceAction action = resource.getAction();
return CustomApplicationUtils.getFiles(context.getConfig(), application, encryption, resourceService)
return ApplicationTypeSchemaUtils.getFiles(context.getConfig(), application, encryption, resourceService)
.stream()
.filter(sourceDescriptor -> !existingUrls.contains(sourceDescriptor.getUrl())
&& !sourceDescriptor.isPublic())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.epam.aidial.core.server.data.SharedResources;
import com.epam.aidial.core.server.data.SharedResourcesResponse;
import com.epam.aidial.core.server.security.EncryptionService;
import com.epam.aidial.core.server.util.CustomApplicationUtils;
import com.epam.aidial.core.server.util.ApplicationTypeSchemaUtils;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.epam.aidial.core.server.util.ResourceDescriptorFactory;
import com.epam.aidial.core.storage.data.MetadataBase;
Expand Down Expand Up @@ -121,7 +121,7 @@ private void addCustomApplicationRelatedFiles(ShareResourcesRequest request) {
ResourceDescriptor resource = getResourceFromLink(sharedResource.url());
if (resource.getType() == ResourceTypes.APPLICATION) {
Application application = applicationService.getApplication(resource).getValue();
List<ResourceDescriptor> files = CustomApplicationUtils.getFiles(config, application, encryptionService, resourceService);
List<ResourceDescriptor> files = ApplicationTypeSchemaUtils.getFiles(config, application, encryptionService, resourceService);
for (ResourceDescriptor file : files) {
if (!filesFromRequest.contains(file.getUrl())) {
artsiomkorzun marked this conversation as resolved.
Show resolved Hide resolved
newSharedResources.add(new SharedResource(file.getUrl(), sharedResource.permissions()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.epam.aidial.core.server.util;

public class ApplicationTypeSchemaProcessingException extends RuntimeException {
public ApplicationTypeSchemaProcessingException(String message, Throwable cause) {
super(message, cause);
}

public ApplicationTypeSchemaProcessingException(String message) {
super(message);
}
}
Loading
Loading