discard some useless dependencies

sign_in_up_out
Daniel Zdravkovic 2024-06-10 15:05:01 +02:00
parent 52ed99fc1d
commit f5e74fbbe5
2 changed files with 17 additions and 39 deletions

20
pom.xml
View File

@ -33,26 +33,6 @@
<artifactId>commons-codec</artifactId>
<version>1.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
</dependency>
</dependencies>
<build>
<resources>

View File

@ -12,8 +12,6 @@ import java.util.HashSet;
import java.util.TreeSet;
import org.apache.commons.codec.binary.Base64;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.json.JSONObject;
public class System {
@ -21,11 +19,9 @@ public class System {
private User current_user = new User();
private String api_key;
private ArrayList<String> distances = new ArrayList<>();
private XSSFWorkbook workbook = new XSSFWorkbook();
public System(String api_key) {
this.api_key = api_key;
createSheet();
}
public void set_current_user_zip(String zip){
@ -57,20 +53,9 @@ public class System {
string = Base64.encodeBase64String(binary_data);
}
public void createSheet(){
try
{
XSSFSheet sheet1 = workbook.createSheet("user_information");
FileOutputStream fileOut = new FileOutputStream("workbook.xlsx");
workbook.write(fileOut);
fileOut.close();
}
catch(Exception ex) {}
}
public HashSet<User> get_all_user() throws FileNotFoundException, IOException{
HashSet<User> all_users = new HashSet<>();
File file = new File("workbook.xlsx");
File file = new File("/user_data.csv");
String[] fileString = new String[8];
if(file.exists() && file.isFile()){
@ -109,9 +94,22 @@ public class System {
}
public boolean sign_up_user(String username, String password, String hometown, int zip,
String car_name, double car_co2_km, double car_avg_kmh, double bike_avg_kmh){
String car_name, double car_l_100km, double car_avg_kmh, double bike_avg_kmh) throws IOException {
ArrayList<User> mem = new ArrayList<>(get_all_user());
ArrayList<String> user_names = new ArrayList<>();
for(User user : mem){
user_names.add(user.getUsername());
}
if(!user_names.contains(username)){
current_user = new User(username, password,
hometown, zip, car_name,
car_l_100km, car_avg_kmh, bike_avg_kmh);
return true;
}
return false;
}
public void sign_out_user(){
this.distances = new ArrayList<>();
@ -120,7 +118,7 @@ public class System {
}
public boolean change_user_details(String username, String password, String hometown, int zip,
String car_name, double car_co2_km, double car_avg_kmh, double bike_avg_kmh){
String car_name, double car_l_100km, double car_avg_kmh, double bike_avg_kmh){
return true;
}