Système de synchronisation de l'information entre FileFrontEnd<>StorBackEnd -> addStorage : ajouter des StorBackEnd à un fichier

This commit is contained in:
Maximilien LEDOUX 2022-03-05 17:35:09 +01:00
parent b2d34dbaf4
commit 0161077cdd
2 changed files with 27 additions and 0 deletions

View File

@ -129,4 +129,18 @@ public class AppData {
return this.users.get(user.getName()).deleteFile(fileName); return this.users.get(user.getName()).deleteFile(fileName);
} }
} }
/**
* @param user The user who wants to add a storage for their file
* @param file The file that needs a new storage
* @param storage The storage to add
* @return True if the storage was added. False otherwise.
*/
public boolean addStorage(User user, File file, String storage) {
if (!this.users.containsKey(user.getName())) {
return false;
} else {
return this.users.get(user.getName()).addStorage(file, storage);
}
}
} }

View File

@ -69,4 +69,17 @@ public class User {
return false; return false;
} }
} }
/**
* @param file The file that needs a storage
* @param storage The storage name
* @return True if the storage was added to the file. False otherwise.
*/
public boolean addStorage(File file, String storage) {
if (this.files.containsKey(file.getName())) {
return file.addStorage(storage);
} else {
return false;
}
}
} }