diff --git a/README.md b/README.md
index 2118fb5ef..3455c11c2 100644
--- a/README.md
+++ b/README.md
@@ -437,7 +437,7 @@ Presentation Tier patterns are the top-most level of the application, this is co
**Applicability:** Use the Callback pattern when
* When some arbitrary synchronous or asynchronous action must be performed after execution of some defined activity.
-<<<<<<< HEAD
+
## Intercepting Filter [↑](#list-of-design-patterns)
**Intent:** Provide pluggable filters to conduct necessary pre-processing and post-processing to requests from a client to a target
@@ -469,7 +469,7 @@ Presentation Tier patterns are the top-most level of the application, this is co
**Real world examples:**
* [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) prototype inheritance
->>>>>>> origin/master
+
# Frequently asked questions
@@ -515,14 +515,14 @@ The difference is the intent of the patterns. While Proxy controls access to the
* [Let’s Modify the Objects-First Approach into Design-Patterns-First](http://edu.pecinovsky.cz/papers/2006_ITiCSE_Design_Patterns_First.pdf)
* [Pattern Languages of Program Design](http://www.amazon.com/Pattern-Languages-Program-Design-Coplien/dp/0201607344/ref=sr_1_1)
* [Martin Fowler - Event Aggregator](http://martinfowler.com/eaaDev/EventAggregator.html)
-<<<<<<< HEAD
+
* [TutorialsPoint - Intercepting Filter](http://www.tutorialspoint.com/design_pattern/intercepting_filter_pattern.htm)
* [Presentation Tier Pattern](http://www.javagyan.com/tutorials/corej2eepatterns/presentation-tier-patterns)
=======
* [Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions](http://www.amazon.com/Functional-Programming-Java-Harnessing-Expressions/dp/1937785467/ref=sr_1_1)
->>>>>>> origin/master
+
# License
diff --git a/intercepting-filter/src/main/AddressFilter.java b/intercepting-filter/src/main/AddressFilter.java
index 68a4b5eff..4b45eb3ee 100644
--- a/intercepting-filter/src/main/AddressFilter.java
+++ b/intercepting-filter/src/main/AddressFilter.java
@@ -1,7 +1,7 @@
/**
* Concrete implementation of filter
- *
+ * This filter is responsible for checking/filtering the input in the address field, returns null if field is empty
* @author joshzambales
*
*/
diff --git a/intercepting-filter/src/main/Client.java b/intercepting-filter/src/main/Client.java
index a62d34702..aadf57a77 100644
--- a/intercepting-filter/src/main/Client.java
+++ b/intercepting-filter/src/main/Client.java
@@ -12,11 +12,11 @@ import java.awt.event.*;
*
*/
public class Client extends JFrame{
- FilterManager filterManager;
- JLabel jl;
- JTextField[] jtFields;
- JTextArea[] jtAreas;
- JButton clearButton, processButton;
+ private FilterManager filterManager;
+ private JLabel jl;
+ private JTextField[] jtFields;
+ private JTextArea[] jtAreas;
+ private JButton clearButton, processButton;
public Client(){
super("Client System");
setDefaultCloseOperation(EXIT_ON_CLOSE);
@@ -69,7 +69,9 @@ public class Client extends JFrame{
processButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
- jl.setText(sendRequest(jtFields[0].getText()+"&"+jtFields[1].getText()+"&"+jtAreas[0].getText()+"&"+jtFields[2].getText()+"&"+jtAreas[1].getText()));
+ String request = String.format("%s&%s&%s&%s&%s",jtFields[0].getText(),jtFields[1].getText(),jtAreas[0].getText(),jtFields[2].getText(),jtAreas[1].getText());
+
+ jl.setText(sendRequest(request));
}
});
diff --git a/intercepting-filter/src/main/ContactFilter.java b/intercepting-filter/src/main/ContactFilter.java
index f44398963..8e7c95408 100644
--- a/intercepting-filter/src/main/ContactFilter.java
+++ b/intercepting-filter/src/main/ContactFilter.java
@@ -1,6 +1,6 @@
/**
* Concrete implementation of filter
- *
+ * This filter checks for the contact field in which it checks if the input consist of numbers and it also checks if the input follows the length constraint (11 digits)
* @author joshzambales
*
*/
diff --git a/intercepting-filter/src/main/DepositFilter.java b/intercepting-filter/src/main/DepositFilter.java
index 8d1b9303e..aae339035 100644
--- a/intercepting-filter/src/main/DepositFilter.java
+++ b/intercepting-filter/src/main/DepositFilter.java
@@ -1,6 +1,7 @@
/**
* Concrete implementation of filter
- *
+*
+ * This checks for the deposit code, returns null when deposit field is empty
* @author joshzambales
*
*/
diff --git a/intercepting-filter/src/main/Filter.java b/intercepting-filter/src/main/Filter.java
index 578f1c5fd..807c8ae21 100644
--- a/intercepting-filter/src/main/Filter.java
+++ b/intercepting-filter/src/main/Filter.java
@@ -1,5 +1,7 @@
/**
- * Filter interface
+* Filter interface
+ * Filters perform certain tasks prior or after execution of request by request handler.
+ * In this case, before the request is handled by the target, the request undergoes through each Filter
* @author joshzambales
*
*/
diff --git a/intercepting-filter/src/main/FilterChain.java b/intercepting-filter/src/main/FilterChain.java
index 04b991c2c..57322d3b4 100644
--- a/intercepting-filter/src/main/FilterChain.java
+++ b/intercepting-filter/src/main/FilterChain.java
@@ -6,7 +6,7 @@
*/
public class FilterChain{
private ArrayList filters = new ArrayList();
- private Target target;
+ private final Target target;
public FilterChain(Target target){
this.target = target;
diff --git a/intercepting-filter/src/main/FilterManager.java b/intercepting-filter/src/main/FilterManager.java
index 380222a75..be6d8e7b4 100644
--- a/intercepting-filter/src/main/FilterManager.java
+++ b/intercepting-filter/src/main/FilterManager.java
@@ -9,7 +9,7 @@ import java.awt.event.*;
*
*/
public class FilterManager{
- FilterChain filterChain;
+ private FilterChain filterChain;
public FilterManager(Target target){
filterChain = new FilterChain(target);
diff --git a/intercepting-filter/src/main/NameFilter.java b/intercepting-filter/src/main/NameFilter.java
index 61d368ce2..e602ae0e1 100644
--- a/intercepting-filter/src/main/NameFilter.java
+++ b/intercepting-filter/src/main/NameFilter.java
@@ -1,3 +1,10 @@
+
+/**
+ * Concrete implementation of filter
+ * This filter checks if the input in the Name field is valid. (alphanumeric)
+ * @author joshzambales
+ *
+ */
public class NameFilter implements Filter{
public String execute(String[] request){
if(request[0].equals("") || request[0].matches(".*[^\\w|\\s]+.*")){
diff --git a/intercepting-filter/src/main/OrderFilter.java b/intercepting-filter/src/main/OrderFilter.java
index 8ccf5a67d..33dc486f7 100644
--- a/intercepting-filter/src/main/OrderFilter.java
+++ b/intercepting-filter/src/main/OrderFilter.java
@@ -1,5 +1,6 @@
/**
* Concrete implementation of filter
+ * This checks for the order field, returns null when order field is empty
*
* @author joshzambales
*
diff --git a/intercepting-filter/src/main/Target.java b/intercepting-filter/src/main/Target.java
index 93c7d93f7..0f1ade30d 100644
--- a/intercepting-filter/src/main/Target.java
+++ b/intercepting-filter/src/main/Target.java
@@ -10,10 +10,10 @@ import java.awt.event.*;
*
*/
public class Target extends JFrame{
- JTable jt;
- JScrollPane jsp;
- DefaultTableModel dtm;
- JButton del;
+ private JTable jt;
+ private JScrollPane jsp;
+ private DefaultTableModel dtm;
+ private JButton del;
public Target(){
super("Order System");
setDefaultCloseOperation(EXIT_ON_CLOSE);
diff --git a/pom.xml b/pom.xml
index d61129e9e..d81be42c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,7 +43,6 @@
callback
execute-around
property
-
intercepting-filter