CMSC 202 Project 4

Document Storage System

Assigned
Monday, November 16, 2009
Program Due
10:00AM, Wednesday, December 2, 2009
Weight
9%
Updates
November 19, 2009
Sample program output is given HERE.

November 19, 2009
Under "Requirements, Hints, and Tips", #14, #15, and #16 have been altered. The user *does not* have to input the date. If you use the Date class from the java.util API package, the date and time of the construction of a document will be generated automatically (see the sample output above).


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, archive 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 that we discussed projects 2 and 3.
Project Specification
In this project, you will design and implement a document storage system that will be used by the BerFreyMitch 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. Documents are initially stored in an "active" document list. Upon request, a document may be moved from the active list to the document "archive." An archive is a place where documents that are no longer used, or "active," are stored, as opposed to disposing of them. Your system should also allow a user to reactivate a document by moving it back from the document archive to the active list.

When a document is initially stored, the author and the date/time created are recorded. A unique document identification number is assigned to the document starting with 10001. The document number (its 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/time, and document ID, which are 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 being 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 being sent along with his/her email address.

Your document system must provide 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 accept 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 should accept all necessary memo information followed by the body (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 accepts 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 single document
    The user inputs a document ID and all relevant document information is displayed followed by the document body.
  5. List all active documents stored in the system
    For each document that has NOT been archived, this service displays the document's ID, author, and creation date/time, and any document specific information , in order by document ID. The body of the documents are NOT displayed.
  6. List all archived documents stored in the system
    For each document that HAS been archived, this service displays the document's ID, author, and creation date/time, and any document specific information , in order by document ID. The body of the documents are NOT displayed.
  7. Search all active documents for a specified word or phrase
    The user inputs a word or phrase on a single line. A listing of the IDs of the active documents that contain the word/phrase in their text body is displayed in document ID order. It is NOT necessary to find phrases that are split across lines. Additionally, the search should ignore case. For example, "BOB was HERE" will match "bob was here".
  8. Archive a document
    The user inputs the document ID of the document to be archived. The system responds with an appropriate message indicating whether or not the document was archived.
  9. Retrieve a document from the archive
    The user inputs the document ID of the archived document that he/she wishes to return to the active list of documents. The system responds with an appropriate message indicating whether or not the document was returned to the active list.
  10. Empty the archive
    All archived documents are permanently removed from the document system.
  11. 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. See the Java API for information on the ArrayList class.
  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. (Requirement) For some menu items, the user is asked to input a document ID. If an invalid ID is entered, the system should respond by redisplaying the menu. DO NOT reprompt the user for a new document ID.
  14. (Requirement) Your menu MUST ask for the information for an email in the following order: author, subject, recipient's name, recipient's email address, text body
  15. (Requirement) Your menu MUST ask for the information for a memo in the following order: author, subject, recipient's name, copies list, text body.
  16. (Requirement) Your menu MUST ask for the information for a report in the following order: author, title, text body.
  17. (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.
  18. (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.
  19. (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.
  20. (Hint) Proper use of inheritance and polymorphism means that no code in the DSS "knows" the type of the Document it is handling.
  21. (Hint) Don't forget to use good top-down design when implementing code in Project4.java.

Sample Output
A sample user session will be posted soon. 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!