CMSC 202 Project 4

Document Storage System

Assigned Monday, April 20, 2009
Program Due 8:00AM, Monday, May 4, 2009
Weight 9%
Updates 28 April 2009
When searching for a word/phrase in the document's content, the search should ignore case.
For example "BOB was HERE" will match "bob was Here"

28 April 2009
For some menu items, the user is asked to input a document ID. If an invalid document ID is entered, your project should respond by redisplaying the menu. DO NOT reprompt the user for a new document ID


Objectives


Project Description
In the information age, the storage and retrieval of documents has become a fundamental requirement of any company. The ability to query documents about their content is also essential to the company's smooth operation. In this project you will build a small document storage system that contains documents of various types. You will also write a menu-driven user interface that allows users to create and store documents, remove documents, retrieve documents and make inquires about the documents. We will briefly discuss the design of this project in class, but not to the extent we discussed project 2 and project 3.
Project Specification
In this project you will design and implement a document storage system which will be used by the ACME software consulting firm. This system stores internal company reports and company correspondence such as memos and emails. All relevant document information will be input by the user.

When a document is stored, the author and date/time created are recorded and a unique document identification is assigned to the document starting with document number 10001. The document ID is incremented for each subsequent document stored. Your document storage system must be able to store an unlimited number of documents. In addition to author, date, and document ID common to all documents, company reports include a title. Your system must also store memos which are a kind of correspondence. Memos include the name of the person to whom the memo is sent, a list of people who will receive a copy of the memo (the distribution list), and the subject of the memo. Email must be stored in your document storage system as well. Emails are electronic correspondence that include the email's subject, the name of the person to whom it is sent along with his/her email address.

Your document system provides the following services for the user. Your user menu will display these options in this order and accept an integer menu selection from the user.
  1. Create and store an email message
    This service should input all necessary email information followed by the contents of the email. This service will display the document ID assigned to the email.
  2. Create and store a memo.
    This service inputs all necessary memo information followed by the contents of the memo. Since there is no limit on the number of names on the distribution list, your program should continue to accept names (one per line) until the user types "END" (without the quotes, in upper-, lower-, or camel-case) at the begining of a separate line. This service will display the document ID assigned to the memo.
  3. Create and store a report.
    This service inputs all necessary report information followed by the contents of the report. This service will display the document ID assigned to the report.
  4. Display a document.
    The user inputs a document ID and all relevant document information is displayed followed by document text.
  5. List all documents stored in the document system.
    This service displays each document's ID, author, and creation date/time, and any document specific information in order by document ID. The contents of the documents are NOT displayed.
  6. Search all documents for a specified word or phrase.
    The user inputs a word or phrase on a single line. A listing of the document IDs that contain the word/phrase in the text body is displayed in document ID order. It is NOT necessary to find phrases that are split across lines.
  7. Remove a document.
    The user inputs the document ID of the document to be removed. The system responds with an appropriate message indicating whether or not the document was removed.
  8. Quit the program. Your program exits gracefully.
Requirements, Hints, and Tips
  1. (Reqirement) All classes in this project should be in a package named proj4.
  2. (Reqirement) Your design should consist of four basic elements which will be briefly discussed in class.
    1. main( ) which provides the user interface
    2. A single class (lets call it the DocumentStorageSystem, or DSS for short) that stores the documents and performs the services requested by the user.
    3. A hierarchy of document classes
    4. A set of exception classes
  3. (Reqirement) main( ) and all its helper methods must be implemented in Project4.java.
  4. (Reqirement) You should make good use of method overriding, inherited methods, and polymorphism to show that you understand and can apply these techniques.
  5. (Reqirement) Your code should throw and catch exceptions as appropriate. This includes, but is not limited to, all method precondition error checking. Note that you do not need to explicitly check for null parameter references since the JVM will do that for you.
  6. (Reqirement) There is no guarantee that the user will input an integer for the menu selection. You should therefore use an exception-controlled loop as discussed in class to handle an inappropriate input type.
  7. (Reqirement) All static and instance variables must be private. No protected variables are permitted.
  8. (Reqirement) You must use ArrayLists instead of arrays in this project. You'll want to do that anyway since they're easier to use.
  9. (Reqirement) Use the Date class provided by the Java library (java.util) for storing and printing the creation date/time information.
  10. (Reqirement) Note that the body of text for any document may contain blank lines. These blank lines must be present whenever the text body is displayed.
  11. (Reqirement) Be sure to create only one Scanner object. Declare its reference as static with class scope so it can be used in main( ) and all of its helper methods.
  12. (Reqirement) Because the text of the a document is of indeterminant length, your program should continue to accept text for a document's content until the user types "END" (without the quotes and in upper- , lower- or camel-case) at the beginning of a separate line.
  13. (Tip) When entering author's name, subject, etc., we promise that the user will not enter a blank line. Blank lines may (will) only occur within the document text.
  14. (Tip) It's not necessary to display the menu after each selection has been completed. It's ok to display the menu just once at the beginning of your program. Or, add another option (like 98) that allows the user to display the menu. Just don't choose a number that changes the main menu selections.
  15. (Hint) Good OO design dictates that main( ) will rely on the DSS to perform the user's request. Other than constructors, the code in main( ) will not call any methods of any class other than the DSS.
  16. (Hint) Proper use of inheritance and polymorphism means that no code in the DSS "knows" the type of the Document it is handling.
  17. (Hint) Don't forget to use good top-down design when implementing code in Project4.java.

Sample Output
A sample user session can be found in this file. The order of the input prompts when a document is created must match the order found in the sample session so that grading scripts will work properly.
Project Policy
This project is considered an CLOSED project. Please review the CLOSED project policy on the course website.
Grading
See the course website for a description of how your project will be graded.
Project Submission
  1. Since no files are provided for you, be sure to submit all .java files necessary to compile and run your project.
  2. Use submitls to verify they are in the remote directory
The order in which the files are listed doesn't matter. However, you must make sure that all files necessary to compile and run your project are submitted. You need not submit all files at the same time. You may resubmit your files as often as you like, but only the last submittal will be graded and will be used to determine if your project is late. For more information, see the projects page on the course website.

You can check to see what files you have submitted by typing

submitls cs202 Proj4 More complete documentation for submit and related commands can be found here.

Remember -- if you make any change to your program, no matter how insignificant it may seem, you should recompile and retest your program before submitting it. Even the smallest typo can cause compiler errors and a reduction in your grade.

Avoid unpleasant surprises!