Skip to content

Commit

Permalink
add Head of a cathedra
Browse files Browse the repository at this point in the history
  • Loading branch information
stefashkaa committed Dec 8, 2016
1 parent 0e2971a commit 73a40be
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/cathedra/Cathedra.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cathedra;


import account.Account;
import faculty.Faculty;


Expand All @@ -13,4 +14,8 @@ public interface Cathedra {
void setName(String name);

void setFaculty(Faculty faculty);

Account getHead();

void setHead(Account head);
}
18 changes: 17 additions & 1 deletion src/cathedra/CathedraImpl.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package cathedra;


import account.Account;
import account.Permission;
import account.RoleManager;
import faculty.Faculty;
import faculty.FacultyManager;

Expand All @@ -11,7 +14,7 @@
public class CathedraImpl implements Cathedra {
private String name;
private Faculty faculty;

private Account head;

protected CathedraImpl(Faculty faculty, String name) {
this.name = name;
Expand Down Expand Up @@ -44,4 +47,17 @@ public void setFaculty(Faculty faculty) {
this.faculty = faculty;
}

@Override
public Account getHead() {
return this.head;
}

@Override
public void setHead(Account head) {
if (!RoleManager.getInstance().hasPermission(head, Permission.InCathedra))
throw new RuntimeException("Данный аккаунт не может быть заведующим кафедры.");

this.head = head;
}

}

0 comments on commit 73a40be

Please sign in to comment.