Tutorial 4 - StopCondition
Tutorial 4 - StopCondition
Introduction
In this tutorial, you will learn how to add a need info link to a resource. By adding need info links, you can stop transactions from proceeding if not all the data has been obtained or confirmed. In the resource we will be working with, we will add a need info link that will prevent an order from proceeding until its Terms and Conditions form has been agreed to.
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 may be found in the tutorials zip under /Rest-Tutorials/rest-resource-stopcondition directory.
rest-resource-corelookup has the following directory structure:
- <artifact_id>
- src
- main
- java
- com.extension.rest
-
- resources
-
- termsandconditions
-
- TermsAndConditionsLookup.java
- TermsAndConditionsMutator.java
- command
-
- impl
-
- AgreeToTermsAndConditionsCommandImpl.java
- BuildTermsAndConditionsFormCommandImpl.java
- GetOrder.java
- LinkToTermsAndConditionsStrategy.java
- ReadOrderStrategy.java
- ReadTACCommandBuilder.java
- AgreeToTermsAndConditionsCommand.java and AgreeToTermsAndConditionsCommandImpl.java
- BuildTermsAndConditionsFormCommand.java and BuildTermsAndConditionsFormCommandImpl.java
- impl
-
- TermsAndConditionsCsvLookup.java
- TermsAndConditionsResourceOperatorImpl.java
- rel
-
- TermsAndConditionsResourceRels.java
- schema
-
- representation
-
- TermsAndConditionsRepresentation.java
- resources
- com.extension.rest.termsandconditions
- OSGI-INF
-
- blueprint
-
- springCtx-import
- termsandconditions-blueprint
- config
- permission.properties
- spring
-
- applicationContext-stopcondition-resource.xml
- java
- test
- java
- main
- target
- pom.xml
- src
AgreeToTermsAndConditionsCommand.java and AgreeToTermsAndConditionsCommandImpl.java
AgreeToTermsAndConditionsCommand.java and AgreeToTermsAndConditionsCommandImpl.java implement the command for agreeing to the terms and conditions of an order.
BuildTermsAndConditionsFormCommand.java and BuildTermsAndConditionsFormCommandImpl.java
BuildTermsAndConditionsFormCommand.java and BuildTermsAndConditionsFormCommandImpl.java implement the command for building the terms and conditions form representation.
TermsAndConditionsCsvLookup.java
TermsAndConditionsCsvLookup.java is a reader / writer to the Terms and Conditions CSV file.