Iowa State University, Senior Design 491/492 - Task Manager Project
Senior Design page: http://seniord.ece.iastate.edu/dec1315/index.html
TaskManager is a web app for creating HTML forms and submitting them for responses to others. This provides a much more versatile option than simply emailing users for data and managing the results within email threads.
Required software:
- Eclipse EE (preferably. Regular Eclipse with the Web Tool plugins works as well, but the EE version has them already)
- Apache Tomcat 7
- MongoDB, if you plan on using the JSON database
- Download the above software, at least Eclipse EE and Apache Tomcat
- Clone the repository to a local directory of your choice
- Open Eclipse EE, and choose the workbench location to be the same directory as in Step 2
- In the Java EE perspective, create a new Dynamic Web Project, and name it "xmlers" (no quotes), the same as the folder Git puts this source code into
- Create a local Tomcat server for the project, referencing the Tomcat binaries you downloaded in Step 1. Make sure to choose the same version of Tomcat for the server as the one you downloaded
- If you used the vanila Eclipse with Web Tool plugins, you may not see all of the Tomcat server options. If this is the case, make sure you have downloaded all JSP/Java web tool and server plugins for Eclipse.
- If you created the project with the same name as the folder, it should automatically recognize the directory structure and place all files/folders correctly.
- To run Tomcat, open the "Servers" view and run the Tomcat server associated with the xmlers project.
- Eclipse will typically open the login page in a browser tab. Once Tomcat is running, you can open a regular browser and navigate to the same URI (e.g., localhost/xmlers/login.jsp or localhost:8080/xmlers/login.jsp)
The src.dbconnect.DBManager singleton is responsible for creating an instance of a database connection object. Within DBManager, there are a list of different Environment Variables:
public static final String XML_STRATEGY = "XML";
public static final String SQL_STRATEGY = "SQL";
public static final String JSON_STRATEGY = "JSON";
public static final String DEBUG_STRATEGY = "DEBUG";
These define which type of database the web app will use; selecting the XML_STRATEGY will use the web app's XML database. The Environment Variable can be set in the Eclipse Run Configurations for the Tomcat Server with the key "XMLERS_STRATEGY" and the value of one of the given strategies.
NOTE: currently, the web app supports JSON and some XML functionality.
By default, if no Environment Variable is found or XMLERS_STRATEGY is not set, the DEBUG_STRATEGY is used, which will initialize src.dbconnect.stub.StubController with some basic data.
TaskManager currently uses MongoDB as its JSON document database. If you wish to use the JSON_STRATEGY, you will need to download MongoDB, install it and have it running. Otherwise, all sorts of errors will rain from the sky. No other setup is required with MongoDB--if the collections do not exist in the database, they will be created by the JsonController class.
If you wish to connect to your MongoDB instance using a username and password, initialize the JsonController with a MongoClient object in the DBManager.
To add your own strategy option, you must:
- Implement the
IDBControllerinterface - Create a respective STRATEGY value within
DBManager
See the dbconnect.xml.* and dbconnect.json.* packages for examples on converting Form and User Java Objects to DAOs for your added implementation.
The login page uses Google Verification for logging in, meaning any Google login should be able to work. The backend only saves your email address as a way to associate forms with your account. No other information is saved, although there are fields for a first and last name.
The docs/json-templates folder contains several JSON metadata templates use in the front end (as part of Backbone.js/Marionette.js models). These templates give the general information required for specific pages.
form_metadata.json: The JSON generated from the create.jsp pagegenerateResponseForm_metadata.json: The JSON sent from the server side -> client side on the response.jsp pageresponse_metadata.json: A modified version of thegenerateResponseForm_metadata.jsontemplate, which includes the participant values for each entry in the formview_metadata.json: The JSON sent sent to the client side on the view.jsp page, used for rendering the viewable table
Currently, the view.jsp page allows users to export the entire form document as XML only. Later features may include exports to other formats, including CSV or XLSX. In the mean time, simply copy-pasting the table into an Excel spreadsheet can easily create CSV files.