-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeeDataView.java
More file actions
46 lines (41 loc) · 1.49 KB
/
EmployeeDataView.java
File metadata and controls
46 lines (41 loc) · 1.49 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
38
39
40
41
42
43
44
45
46
import java.io.File;
import java.io.IOException;
public class EmployeeDataView implements FileFunctions {
@Override
public void createFileBaseHTML() throws IOException {
// Not implemented
}
public void listUserdataFiles() {
System.out.println("\nList of Employee IDs EXIST\n");
File userdataDir = new File("userdata");
if (userdataDir.exists() && userdataDir.isDirectory()) {
String[] fileList = userdataDir.list();
if (fileList != null) {
for (String fileName : fileList) {
int startIndex = fileName.indexOf("employee") + "employee".length();
int endIndex = fileName.indexOf(".html");
if (endIndex != -1 && startIndex < endIndex) {
String extractedWord = fileName.substring(startIndex, endIndex);
System.out.println(" - " + extractedWord);
}
}
} else {
System.out.println("The directory is empty.");
}
} else {
System.out.println("The directory does not exist.");
}
}
@Override
public void removeFile(String id) throws IOException {
// Not implemented
}
@Override
public void viewFile(String id) throws IOException {
// Not implemented
}
@Override
public void updateFile(String id, String oldData, String newData) throws IOException {
// Not implemented
}
}