Package io.jmix.rest.impl.config
Class RestJsonTransformations
java.lang.Object
io.jmix.rest.impl.config.RestJsonTransformations
Class is used for loading and storing JSON transformers. These transformers are used when a request to the REST API
 is made by the client that works with a data model of the previous version. In this case transformer transforms a
 JSON from the old data model version to the current or vice versa. JSON transformers are loaded from configuration
 files defined by the 
jmix.rest.jsonTransformationConfig application property.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected org.springframework.core.env.Environmentprotected com.google.common.collect.Table<String,String, EntityJsonTransformer> protected booleanprotected static final Stringprotected ReadWriteLockprotected Resourcesprotected org.springframework.web.context.WebApplicationContextprotected com.google.common.collect.Table<String,String, EntityJsonTransformer> 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidgetTransformer(String entityName, String modelVersion, JsonTransformationDirection transformerDirection) Tries to find the transformer for the given entity, model version and transformation direction.protected voidinit()protected voidloadConfig(org.dom4j.Element rootElem) protected voidparseCustomTransformers(String currentEntityName, String oldEntityName, String version, org.dom4j.Element customElem) protected voidparseStandardTransformers(String currentEntityName, String oldEntityName, String version, org.dom4j.Element transformationElem) protected voidprocessOneDirectionConfig(org.dom4j.Element element, StandardEntityJsonTransformer transformer) 
- 
Field Details- 
JMIX_REST_JSON_TRANSFORMATION_CONFIG_PROP_NAME- See Also:
 
- 
initializedprotected volatile boolean initialized
- 
lock
- 
toVersionTransformersprotected com.google.common.collect.Table<String,String, toVersionTransformersEntityJsonTransformer> 
- 
fromVersionTransformersprotected com.google.common.collect.Table<String,String, fromVersionTransformersEntityJsonTransformer> 
- 
resources
- 
restApiContext@Autowired protected org.springframework.web.context.WebApplicationContext restApiContext
- 
environment@Autowired protected org.springframework.core.env.Environment environment
 
- 
- 
Constructor Details- 
RestJsonTransformationspublic RestJsonTransformations()
 
- 
- 
Method Details- 
getTransformerpublic EntityJsonTransformer getTransformer(String entityName, String modelVersion, JsonTransformationDirection transformerDirection) Tries to find the transformer for the given entity, model version and transformation direction. If such transformer is defined in the transformers configuration file then it will be returned. If there is no transformer defined, a dummy transformer that doesn't do any transformation will be returned.- Parameters:
- entityName- entity name
- modelVersion- domain model version
- transformerDirection- transformation direction (to version or from version)
- Returns:
- a JSON transformer instance
 
- 
checkInitializedprotected void checkInitialized()
- 
initprotected void init()
- 
loadConfigprotected void loadConfig(org.dom4j.Element rootElem) 
- 
parseStandardTransformers
- 
parseCustomTransformers
- 
processOneDirectionConfigprotected void processOneDirectionConfig(org.dom4j.Element element, StandardEntityJsonTransformer transformer) 
 
-