Système de synchronisation de l'information entre FileFrontEnd<>StorBackEnd -> addStorage : ajouter des StorBackEnd à un fichier
This commit is contained in:
parent
b2d34dbaf4
commit
0161077cdd
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user