cs445 - Fall 2014

Project - Command Line Interface


The general format of a command is:

$ java pn command [ command_options [ arguments ] ]

where pn is short for Panem Nostrum, command is one the several things the software can do, command_options are options for the various commands available, and arguments are the various values that go with the command options.

In the examples below we use brackets "[ ]", parentheses "( )", pipes "|" and ellipsis "..." to describe optional, required, mutually exclusive, and repeating elements.

Examples

$ java pn search

will show all the customers in system.

$ java pn search -k "jane"

will show only the customers that match the keyword "jane".

Commands

search

$ java pn search [ -k <keyword> ]

The command will print a list of all customers that match the <keyword>. For each customer print the customer/user ID (UID), followed by the customer information (name, address, etc.)

customer

$ java pn customer add -n <name> -e <email> -a <address> -c <city> -s <state> -z <zip> -h <phone> [ -f <facebook> ] [ -t <twitter> ] [ -i <delivery_instructions> ]

The command adds a new customer and returns the user ID (UID).

$ java pn customer modify -u <UID> [ -n <name> ] [ -e <email> ] [ -a <address> ] [ -c <city> ] [ -s <state> ] [ -z <zip> ] [ -h phone ] [ -f <facebook> ] [ -t <twitter> ] [ -i <delivery_instructions> ]

The command will update the information for user with the id UID with what's provided in the command line. If no arguments are provided, then no change is made.

$ java pn customer view -u <UID>

The command will print detailed information about the customer <UID>. This includes customer information such as name, address, etc. the status of her/his subscription, i.e. "active", "suspended", "cancelled", plus any exceptions to the subscription. Also print the weekly value of the customer's subscription.

$ java pn customer load -f <file>

The command creates a new customer using information from the XML file, and returns the UID. If a customer with the same email address already exists, the command prints a warning and exits.

product

$ java pn product add -n <name> -d <price> -r <RID>

The command adds a new product with the given name, price, and recipe ID (RID) and returns the product ID (PID).

$ java pn product modify -p <PID> [ -n <name> ] [ -d <price> ] [ -r <RID> ]

The command modifies the product with the given PID. If no arguments are provided, then no changes are being made. If RID is invalid, an error is reported and no changes are being made.

$ java pn product view -p <PID>

The command displays the properties of the product with the given PID. If PID is invalid, an error is reported.

$ java pn product terminate -p <PID> -f <date>

The command will set the termination date for product PID, which is the last day on which the product will be made and delivered to customers. The date is in the mmddyy format and must be in the future.

recipe

$ java pn recipe load -f <file>

The command loads a recipe from the XML file and returns the recipe ID (RID).

subscription

$ java pn subscription addmodify -u <UID> ( -w <dow> | -f <date> ) -p <PID> -q <quantity>

The command adds/modifies the subscription for customer UID, for the day of the week <dow> (when the -d argument is provided) or a date in the future (when -f is provided). -d and -f are mutually exclusive, however at least one of them needs to be present.

dow=0 means Sunday, dow=1 is Monday, etc.

If -f is provided, then <date> must be in the future.

PID is the product that's being modified and <quantity> is the number of units of this product that need to ship on that day.

If invalid arguments are provided, the command prints error messages indicating what's wrong and then exits w/o making any changes.

$ java pn subscription view -u <UID>

The command prints the subscription for customer UID, including any future changes.

$ java pn subscription cancel -u <UID>

The command clears/removes the subscription for customer UID.

$ java pn subscription suspend -u <UID> -f <first_date> -l <last_date>

The command suspends the subscription for customer UID, which means no products will be delivered to the customer between <first_date> and <last_date>. If the <first_date> and <last_date> are the same, then the subscription is suspended for one day. The <last_date> must be the same or after the <first_date>.

admin

$ java pn admin daily

The command prints the bill of materials for tomorrow's batch.

$ java pn admin weekly

The command prints the bill of materials for next week.

$ java pn admin revenue -f <first_date> -l <last_date>

The command prints the breakdown of revenue realized (for products that have been delivered) and future deliveries.

$ java pn admin delivery_list

The command prints the list of customers where products will be delivered today. For each customer print the ID, the address, and special delivery instructions. It is assumed that everything that's delivered to a customer is already bagged and tagged, so that the delivery person doesn't have to worry about the specifics of each customer's delivery.

$ java pn admin delivery_charge -d <price> -f <date>

The command updates the delivery fee: The new fee is <price> and the change becomes effective on <date>.

$ java pn admin confirm_delivery -u <UID>

The command confirms that a delivery was made for customer <UID> on the date and time the command is executed. Imagine the delivery gal using her mobile phone to confirm that she just dropped off the order at a location.



$Id: command-line.html,v 1.11 2014/11/20 04:27:41 virgil Exp $