assignment 7
Transcription
assignment 7
Prof. Dr. Stephan Kleuker Hochschule Osnabrück Fakultät Ing.-Wissenschaften und Informatik - Software-Entwicklung - Objektorientierte Analyse und Design Sommersemester 2015 7. Aufgabenblatt Task 16 (5 Points) Sequence diagrams can be used to analyze existing programs in such a way that typical sequences of method calls are visualized. The file aufgabe16.zip from the web site of this lectures contains such an existing program. a) Use the code to derive a complete class diagram for this program. b) Draw one detailed sequence diagram showing the input from and the output to the user and all method calls with the visibility public for the following actions. The user starts the program. The user creates two controllers with different input texts. The user creates a view with the output symbol #. The user uses the first controller to change the value of the model to 7. The user creates a second view with the output symbol *. The user uses the second controller to change the value of the model to 5. The user terminates the program. Your sequence diagram contains all existing objects of the classes Main, Model, View and Controller, objects of collection type can be omitted. The initial part of the diagram can look as follows. Translation User … Input: 2 Input: „Give Value“ You might remove the comment for the Line Locale.setDefault(new Locale("en","US")); in the class Main. Task 17 (5 Points) Seite 1 von 3 Prof. Dr. Stephan Kleuker Hochschule Osnabrück Fakultät Ing.-Wissenschaften und Informatik - Software-Entwicklung - Objektorientierte Analyse und Design Sommersemester 2015 7. Aufgabenblatt The previous class diagram shows the relevant classes of an access management (Zugriffsverwaltung) for users with different privileges. The abstract class Nutzer (user) contains the displayed instance variables, constructors and three abstract methods (UML: cursive font). These methods can be used to check the privileges mentioned in their names (darfDatenBearbeiten = canManageData, darfTabellenBearbeiten = canManageTables, darfNutzerAnlegen, canCreateUsers). There are three realizations of the abstract class with the following privileges. A system administrator (Systemadministrator) can do everything, a project administrator (Projektadministrator) can manage tables and data, a developer (Entwickler) can only manage data. Get- and set-Methods of the class user are omitted in the diagram but exist. The class Zugriffsverwaltung manages all users and assures that always only one user is active (aktiverNutzer = activeUser). The detailed specification of the class Zugriffsverwaltung looks like follows. Field Summary private private Nutzer aktuellerNutzer active user with access to the- system, there is no active user at the beginning. List<Nutzer> nutzer list of all existing users. [you are allowed to use a different collection] Constructor Summary Zugriffsverwaltung() creates an object containing an initial user, a system administrator with login and password „admin“. Method Summary boolean authentifizieren(java.lang.String login, java.lang.String passwort) checks whether a user with the pair login and password exists, if this is the case this user becomes the new active user. The result shows if the authentification was successfull. boolean entwicklerHinzufuegen(java.lang.String login, java.lang.String passwort) if the active user has the right to add new users, a developer with login and password is added. The result shows if an object was added. boolean loginAendern(java.lang.String altesLogin, java.lang.String neuesLogin) if the active user has the right to add new users, and a user with the old login (altesLogin) exists, this login is changed to the new value (neuesLogin). The result shows if an object was changed. void nutzerAnzeigen() shows all users with login, password and its detailed privileges. Seite 2 von 3 Prof. Dr. Stephan Kleuker Hochschule Osnabrück Fakultät Ing.-Wissenschaften und Informatik - Software-Entwicklung - Objektorientierte Analyse und Design Sommersemester 2015 7. Aufgabenblatt boolean passwortAendern(java.lang.String altesPasswort, java.lang.String neuesPasswort) if an active user exists and her password is the first parameter (altesPasswort) then the password is changed to the new value (neuesPasswort). The result shows if a password was changed. boolean projektadministratorHinzufuegen(java.lang.String login, java.lang.String passwort) if the active user has the right to add new users, a project administrator with login and password is added. The result shows if an object was added. boolean systemadministratorHinzufuegen(java.lang.String login, java.lang.String passwort) if the active user has the right to add new users, a system administrator with login and password is added. The result shows if an object was added. Your task is to implement all classes of the diagram. Use the class Zugriffsdialog (access dialog) from the web site of the lecture in the file aufgabe17.zip to test your implementation manually. The program starts with the class Main. You might remove the comment for the Line Locale.setDefault(new Locale("en","US")); in the class Main. This task does not contain all functionality that is necessary for a complete access system. You are allowed to add functionality but it is not necessary. Seite 3 von 3