Repository navigation
Expand file tree
/
Copy pathOwner.java
More file actions
37 lines (34 loc) · 1.48 KB
/
Copy pathOwner.java
File metadata and controls
37 lines (34 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
public class Owner extends PropertyManager{ //Property Owner class. Extends PropertyManager superclass due to shared functions with Agent class.
private ArrayList<String> grants = new ArrayList<>(); //List of grants for particular owner
public Owner(String userName, String password, String fullName, String contact, String email, String role, String status) {
super(userName, password, fullName, contact, email, role, status); //Constructor for new Owner accounts, user PropertyManager constructor to create files and directories
}
//Getters and setters for grants
public ArrayList<String> getGrants() {
return grants;
}
public void setGrants(ArrayList<String> grants) {
this.grants = grants;
}
public void addToGrantList(String newGrant) {
this.grants.add(newGrant);
try {
sendGrantsToFile(newGrant);
} catch (IOException e) {
e.printStackTrace();
}
}
//Creates grants file in Owner directory
public void sendGrantsToFile(String grant) throws IOException {
FileWriter grantsFile = new FileWriter(getPropertyManagerDir() + "/grants.txt", true); // make a text file to store the restaurant information
PrintWriter outputLicenseID = new PrintWriter(grantsFile);
outputLicenseID.println(grant);
outputLicenseID.close();
}
}