Tutorial 2 - ExtensionProfile
Tutorial 2 - ExtensionProfile
Introduction
In this tutorial, you will study a new resource with a linking and reading strategy. You will see how data can be extracted from the out-of-the-box profiles representation and inserted into the ExtendedProfile's representation. This method can be used to customize the output of any Cortex API resource.
Make sure your development environment has been properly set up as described in Setting up your Developer Environment.
Source files
The files created in this tutorial are found in the tutorials zip under /Rest-Tutorials/rest-resource-extensionprofile directory.
rest-resource-extensionprofile has the following directory structure:
- <artifact_id>
- src
-
- main
-
- java
-
- com.extension.rest
-
- resources
-
- extensionprofile
-
- ExtensionProfileMutator.java
- command
- impl
-
- ExtensionProfileResourceOperatorImpl.java
- rel
-
- ExtensionProfileResourceRels.java
- schema
-
- representation
-
- ExtensionProfileRepresentation.java
- resources
-
- OSGI-INF
-
- blueprint
-
- extensionprofile-blueprint
- springCtx-import
- config
- permission.properties
- spring
-
- applicationContext-extensionprofile-resource.xml
- test
-
- java
- target
- pom.xml
LinkToExtensionProfileStrategy.java
LinkToExtensionProfileStrategy.java is the link strategy implementation. It is responsible for creating links to other resources.