Skip to content

Commit

Permalink
BusinessDelegate And LookUpService Implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
jskno committed Aug 18, 2015
1 parent e99ab38 commit f3fbc5c
Show file tree
Hide file tree
Showing 43 changed files with 995 additions and 287 deletions.
19 changes: 18 additions & 1 deletion WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>businessNotesControllerRedirect</servlet-name>
<servlet-class>controller.BusinessNotesControllerRedirect</servlet-class>
<init-param>
<param-name>base</param-name>
<param-value>/BusinessNotesWeb/notes/addElement</param-value>
</init-param>
<init-param>
<param-name>imageURL</param-name>
<param-value>/BusinessNotesWeb/images</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>param1</param-name>
<param-value>/BusinessNotesWeb/notes</param-value>
Expand All @@ -24,7 +37,11 @@
</context-param>
<servlet-mapping>
<servlet-name>businessNotesController</servlet-name>
<url-pattern>/notes </url-pattern>
<url-pattern>/notes</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>businessNotesControllerRedirect</servlet-name>
<url-pattern>/notes/addElement</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
Expand Down
4 changes: 2 additions & 2 deletions WebContent/jsp/newCompany.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<h3>New Company</h3>
<p>Form to introduce a new company.</p>
</div>
<form class="form-horizontal" role="form" action="notes" method="POST">
<input type="hidden" name="action" value="createCompany"/>
<form class="form-horizontal" role="form" action="notes/addElement" method="POST">
<input type="hidden" name="action" value="addCompany"/>
<div class="form-group">
<label class="control-label col-sm-2" for="companyName">Company Name:</label>
<div class="col-sm-10">
Expand Down
10 changes: 5 additions & 5 deletions WebContent/jsp/newCustomer.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<h3>New Customer</h3>
<p>Form to introduce a new customer.</p>
</div>
<form class="form-horizontal" role="form" action="notes" method="POST">
<input type="hidden" name="action" value="createCustomer"/>
<div class="form-group">
<form class="form-horizontal" role="form" action="notes/addElement" method="POST">
<input type="hidden" name="action" value="addCustomer"/>
<div class="form-group">
<label class="control-label col-sm-2" for="companyId">Company Name:</label>
<div class="col-sm-8">
<select class="form-control" data-header="Select a Company" name="companyId"
Expand Down Expand Up @@ -84,8 +84,8 @@
<!-- Modal content-->
<div class="modal-content">
<form id="newCompanyModalForm" class="form-horizontal" role="form" action="notes" method="POST">
<input type="hidden" name="action" value="onlyCreateCompany2"/>

<input type="hidden" name="action" value="addCompany"/>
<input type="hidden" name="originScreen" value="newCustomerForm"/>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Company</h4>
Expand Down
4 changes: 2 additions & 2 deletions WebContent/jsp/newNoteForm.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<h3>New Note</h3>
<p>Form to introduce a new note.</p>
</div>
<form class="form-horizontal" role="form" action="notes" method="POST">
<input type="hidden" name="action" value="createNote"/>
<form class="form-horizontal" role="form" action="notes/addElement" method="POST">
<input type="hidden" name="action" value="addNote"/>
<div class="form-group">
<label class="control-label col-sm-2" for="noteTitle">Note title:</label>
<div class="col-sm-10">
Expand Down
4 changes: 2 additions & 2 deletions WebContent/jsp/newProduct.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<h3>New Product</h3>
<p>Form to introduce a new product.</p>
</div>
<form class="form-horizontal" role="form" action="notes" method="POST">
<input type="hidden" name="action" value="createProduct"/>
<form class="form-horizontal" role="form" action="notes/addElement" method="POST">
<input type="hidden" name="action" value="addProduct"/>
<div class="form-group">
<label class="control-label col-sm-2" for="productCode">Product Code:</label>
<div class="col-sm-10">
Expand Down
8 changes: 4 additions & 4 deletions WebContent/jsp/newSupplier.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<h3>New Supplier</h3>
<p>Form to introduce a new supplier.</p>
</div>
<form class="form-horizontal" role="form" action="notes" method="POST">
<input type="hidden" name="action" value="createSupplier"/>
<form class="form-horizontal" role="form" action="notes/addElement" method="POST">
<input type="hidden" name="action" value="addSupplier"/>
<div class="form-group">
<label class="control-label col-sm-2" for="companyId">Company Name:</label>
<div class="col-sm-8">
Expand Down Expand Up @@ -83,8 +83,8 @@
<!-- Modal content-->
<div class="modal-content">
<form id="newCompanyModalForm" class="form-horizontal" role="form" action="notes" method="POST">
<input type="hidden" name="action" value="onlyCreateCompany"/>

<input type="hidden" name="action" value="addCompany"/>
<input type="hidden" name="originScreen" value="newSupplierForm"/>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Company</h4>
Expand Down
Binary file modified build/classes/controller/BusinessNotesController.class
Binary file not shown.
Binary file modified build/classes/dao/CompanyDAOImpl.class
Binary file not shown.
Binary file modified build/classes/dao/CustomerDAOImpl.class
Binary file not shown.
Binary file modified build/classes/dao/Dao.class
Binary file not shown.
Binary file modified build/classes/dao/DaoImpl.class
Binary file not shown.
Binary file modified build/classes/dao/NoteDAOImpl.class
Binary file not shown.
Binary file modified build/classes/dao/ProductDAOImpl.class
Binary file not shown.
Binary file modified build/classes/dao/SupplierDAOImpl.class
Binary file not shown.
80 changes: 77 additions & 3 deletions src/controller/BusinessLookUp.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,100 @@
package controller;

import service.GetNoteListService;
import service.AddCompanyService;
import service.AddCustomerService;
import service.AddNoteService;
import service.AddProductService;
import service.AddSupplierService;
import service.ExportTableService;
import service.GetCompaniesListService;
import service.GetCustomerListService;
import service.GetNotesListService;
import service.GetSuppliersListService;
import service.ImportTableService;
import service.NewCompanyFormService;
import service.NewCustomerService;
import service.NewNoteFormService;
import service.GetProductsListService;
import service.NewProductFormService;
import service.NewSupplierFormService;
import service.Service;

public class BusinessLookUp {

private final String HOME_PAGE = "homePage";
private final String NEW_NOTE = "newNote";
private final String NOTE_LIST = "notesList";
private final String NEW_CUSTOMER = "newCustomer";
private final String CUSTOMER_LIST = "customersList";
private final String NEW_SUPPLIER = "newSupplier";
private final String SUPPLIERS_LIST = "suppliersList";
private final String NEW_PRODUCT = "newProduct";
private final String PRODUCTS_LIST = "productsList";
private final String NEW_COMPANY = "newCompany";
private final String CREATE_CUSTOMER = "createCustomer";
private final String ADD_SUPPLIER = "addSupplier";
private final String ADD_PRODUCT = "addProduct";
private final String ADD_COMPANY = "addCompany";
private final String ADD_NOTE = "addNote";
private final String EXPORT_TABLE = "exportTable";
private final String IMPORT_TABLE = "importTable";


private Service serviceClass;


public Service getBusinessService(String serviceType) {

switch (serviceType) {
case HOME_PAGE:
case NEW_NOTE:
serviceClass = new NewNoteFormService();
break;
case NOTE_LIST:
serviceClass = new GetNoteListService();
serviceClass = new GetNotesListService();
break;
case NEW_CUSTOMER:
serviceClass = new NewCustomerService();
break;
case CUSTOMER_LIST:
serviceClass = new GetCustomerListService();
break;
case NEW_SUPPLIER:
serviceClass = new NewSupplierFormService();
break;
case SUPPLIERS_LIST:
serviceClass = new GetSuppliersListService();
break;
case NEW_PRODUCT:
serviceClass = new NewProductFormService();
break;
case PRODUCTS_LIST:
serviceClass = new GetProductsListService();
break;
case NEW_COMPANY:
serviceClass = new NewCompanyFormService();
break;
case CREATE_CUSTOMER:
serviceClass = new AddCustomerService();
break;
case ADD_SUPPLIER:
serviceClass = new AddSupplierService();
break;
case ADD_PRODUCT:
serviceClass = new AddProductService();
break;
case ADD_COMPANY:
serviceClass = new AddCompanyService();
break;
case ADD_NOTE:
serviceClass = new AddNoteService();
break;
case EXPORT_TABLE:
serviceClass = new ExportTableService();
break;
case IMPORT_TABLE:
serviceClass = new ImportTableService();
break;

default:
break;
}
Expand Down
Loading

0 comments on commit f3fbc5c

Please sign in to comment.