Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

What's New for Cortex API 1.15.0

What's New for Cortex API 1.15.0

New Features and Enhancements

  • PB-1452 - Added Wishlist resource so customers can build a list of items they are interested in purchasing.
  • PB-1993 - Added cartmemberships to carts, so you can link from items to a list of carts that the item belongs in.
  • PB-1173 - Upgraded Java to version 8 (both source and target versions).
  • PB-1438 - Included source for Cortex resource integration and repository bundles in the release package cortex-ep-integration project.
  • PB-1295 - Included source for Cortex Fitness and Cucumber tests in the release package extensions project.
  • PB-588 - Added a copyright notice parameter to the API Generator maven plugin.

Bug Fixes

  • PB-587 - Fixed invalid UTF-8 characters emitted by the Cortex API generator.
  • PB-1522 - Fixed OSGi fragment loading issues by upgrading Felix Framework to 5.0.1

3rd Party Library Changes and Upgrades

Library New Version Previous Version
AOP Alliance 1.0.5 --
Apache Commons Lang 3.4 3.3.2
Apache Commons Lang2 2.6 --
Apache Felix Framework 2.3.2 4.6.0
Felix Config Admin 1.8.8 1.8.0
Felix Event Admin 1.4.4 1.4.2
Felix File Install 3.5.0 3.4.3
Felix HTTP 2.3.2 2.2.2
Felix Inventory 1.0.4 --
Felix Metatype 1.1.2 1.0.10
Felix SCR 2.0.2 --
Felix Shell 1.4.3 1.4.3
Felix Web Console 4.2.12 4.2.6
Felix Web Console DS 2.0.2 --
Felix Web Console Event 1.1.4 --
Felix Web Console Memory Usage 1.0.6 --
Felix Web Console Package Admin 1.0.2 --
Apache HttpCore 4.3.3 4.3.2
Cucumber 1.2.4 1.2.2
Google Guava 18.0 16.0.1
Google Guice 4.0 --
Groovy 2.4.5 2.4.1
Jackson 2.6.2 2.5.1
Java Assist 3.20 3.19
Javax Annotations 1.2 --
Javax Validation API 1.1.0 1.0.0
JAXB 2.2.11 2.1
JAX RS 2.0.1 1.1.1
Jersey 2.22 1.19
Logback 1.1.3 1.1.2
Metrics 3.1.2 3.0.2
Maven Bundle Plugin 3.0.0 2.4.0
Maven Checkstyle Plugin 2.17 2.12.1
Maven Compiler Plugin 3.3 3.1
Maven Plugin Plugin 3.4 3.2
Maven PMD Plugin 3.5 3.0.1
Mockito 1.9.5 1.10.17
OSGi 5.0.0 4.3.1
Peaberry 1.3 --
RxJava 1.0.16 --
SFL4J 1.7.12 1.7.7
Shiro 1.2.4 1.2.3
Sisu 0.3.2 --
Spring Framework 3.2.14 3.1.4
Spring LDAP 1.3.2 --
Spring Security 3.2.8 3.1.4

Upgrade Notes

The Upgrade Guide provides general advice on upgrading Elastic Path projects. Specific upgrade considerations for Cortex 1.15.0 are covered below:

Java 8 Upgrade

The upgrade to Java 8 required the following code and dependency changes:

  • Multiple library upgrades
  • Upgrades to PMD and Checkstyle plugins and rules
  • Multple minor code changes to fix compiler, PMD and Checkstyle errors.

Cortex System Test Source

Cortex Fitness and Cucumber tests are now included in the extensions project in the cortex/system-tests module. This will provide you the ability to perform complete regression testing on the Cortex API and to add your own tests for new and extended resources.

Execute mvn clean install -DskipAllTests if you want to build the extensions project without running system tests.

Cortex EP Integration Source

Source for Cortex resource integration and repository bundles is included in the release package cortex-ep-integration project.

The Starting Construction Guide does not include this project in the build pipeline. You can add it at a later time if you need to make changes to Cortex integration bundles.

Breaking API Changes

Some Cortex classes have been moved and some APIs have changed, so you will have compilation errors in your Cortex resources after the upgrade.

Most of the API moves and changes described here have been done to get us into a position where we can deprecate our older programming model in favour of Helix.

Package Relocations

  • com.elasticpath.rest.command.* was moved from rest-api into ep-rest-legacy
  • com.elasticpath.rest.chain.* was moved from rest-spi into ep-relos-legacy
  • com.elasticpath.rest.schema.transform.* was moved from ep-rest-commons into ep-relos-legacy

Class Changes

Scope Parameter Strategy (com.elasticpath.rest.authorization.parameter.ScopeParameterStrategy)

The relocation of ExecutionResult classes to legacy packages required removing the dependency of ScopeParameterStrategy on ExecutionResult. Classes that previously extended ScopeParameterStrategy, will need to extend AbstractCollectionValueStrategy now (and bring in a dependency to ep-relos-legacy).

For example:
@Singleton
@Named("orderIdParameterStrategy")
public final class OrderIdParameterStrategy extends AbstractCollectionValueStrategy {
<...>
    @Override
    protected Collection<String> getParameterValues(final PrincipalCollection principals) {
        String scope = PrincipalsUtil.getScope(principals);
        String userId = PrincipalsUtil.getUserIdentifier(principals);
        return orderLookup.findOrderIds(scope, userId).getData();
    }
}
Note that a depencency on ep-relos-legacy needs to be added:
<dependency>
   <groupId>com.elasticpath.rest</groupId>
   <artifactId>ep-relos-legacy</artifactId>
</dependency>
Operation Result Factory (com.elasticpath.rest.OperationResultFactory)

The API for this class has been modified. The create method taking ExecutionResult and returning OperationResult have been moved into com.elasticpath.rest.legacy.operationresult.OperationResultFactory. Again a dependency on ep-relos-legacy will need to be added.

Method Signature Changes

Below is a list of important method signature chages:
Changed From Changed To Notes
TransformToRepresentation TransformToResourceState -
OperationResultFactory.create(ExecutionResultFactory.createReadOK(…) OperationResultFactory.createReadOK(…) -
ResourceLinkFactory.create(uri,InfoRepresentation.TYPE, rel, rev) ResourceLinkFactory.create(uri, ControlsMediaTypes.INFO.id(), rel, rev) Representation types are being deprecated.
***Entity.Builder.builder() ***Entity.builder() -

REST Schema Changes

The following changes are made to the REST Schema:
  • resource-combined-schema renamed to resource-uribuilder-apis
  • <resource-family> element renamed to <family> and the corresponding code ResourceFamilyImp() renamed to FamilyImpl()