Package io.jmix.rest.impl
Class RestControllerUtils
java.lang.Object
io.jmix.rest.impl.RestControllerUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FetchPlanRepositoryprotected FetchPlanSerializationprotected Metadataprotected RestJsonTransformationsprotected RestProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFetchPlan(MetaClass metaClass, String name) Returns a fetch plan by name.getFetchPlanByNameOrJson(MetaClass metaClass, String fetchPlanNameOrJson) Returns a fetch plan by name or deserializes it from JSON.getMetaClass(String entityName) Finds metaClass by entityName.transformEntityNameIfRequired(String entityName, String modelVersion, JsonTransformationDirection direction) transformJsonIfRequired(String entityName, String modelVersion, JsonTransformationDirection direction, String json)
-
Field Details
-
metadata
-
restJsonTransformations
-
fetchPlanRepository
-
fetchPlanSerialization
-
restProperties
-
-
Constructor Details
-
RestControllerUtils
public RestControllerUtils()
-
-
Method Details
-
getMetaClass
Finds metaClass by entityName. Throws a RestAPIException if metaClass not found -
getFetchPlan
Returns a fetch plan by name.- Parameters:
metaClass- entity MetaClassname- fetch plan name (nullable)- Returns:
- a fetch plan by name, or null if name is null
- Throws:
RestAPIException- if the fetch plan is not found
-
getFetchPlanByNameOrJson
@Nullable public FetchPlan getFetchPlanByNameOrJson(MetaClass metaClass, @Nullable String fetchPlanNameOrJson) Returns a fetch plan by name or deserializes it from JSON.- Parameters:
metaClass- entity MetaClassfetchPlanNameOrJson- fetch plan name or JSON representation (nullable)- Returns:
- a fetch plan by name, or null if name is null
- Throws:
RestAPIException- if the provided fetch plan is a name, and it's not found in repository. Also, if inline fetch plans are disabled byRestProperties.isInlineFetchPlanEnabled().
-
transformEntityNameIfRequired
public String transformEntityNameIfRequired(String entityName, @Nullable String modelVersion, JsonTransformationDirection direction) -
transformJsonIfRequired
public String transformJsonIfRequired(String entityName, @Nullable String modelVersion, JsonTransformationDirection direction, String json)
-