Class AppModel

java.lang.Object
eirb.pub.app.display.javafx.model.AppModel

public class AppModel extends Object
  • Field Details

  • Constructor Details

    • AppModel

      public AppModel()
  • Method Details

    • getServerURL

      public URL getServerURL()
    • setServerURL

      public void setServerURL(URL serverURL)
    • getVaultFile

      public VaultFile getVaultFile()
      Get the File of the database
      Returns:
      the File of the database
    • firePropertyChange

      public void firePropertyChange(String propertyName, Object oldValue, Object newValue)
    • setVaultFile

      public void setVaultFile(Path newVaultFile) throws VaultFileIOException, VaultFileFormatException
      Set the new vault file and path to it
      Parameters:
      newVaultFile - the new file of the database
      Throws:
      VaultFileIOException - If the read of the file failed
      VaultFileFormatException - If the format of the file is incorrect
    • setVaultFile

      public void setVaultFile(VaultFile newVaultFile)
    • setPlainVault

      public void setPlainVault(String password) throws PasswordException, CipherVaultException, IOException
      Set the plain vault in model
      Parameters:
      password - the password of the database selected
      Throws:
      PasswordException - if it's the wrong password throw error
      CipherVaultException - if an error occurred in the cipherVault decryption
      IOException
    • createEmptyVaultFile

      public void createEmptyVaultFile(String name, String password) throws VaultFileGenerationException, PasswordException, CipherVaultException, IOException
      Create an empty VaultFile, and set the plainVault in the model
      Parameters:
      name - the name of the database
      password - the password of the database selected
      Throws:
      VaultFileGenerationException - if the generation of an empty file failed
      PasswordException
      CipherVaultException
      IOException
    • getPlainVault

      public PlainVault getPlainVault()
      Get the plain vault to show his data
      Returns:
      the plain vault
    • setVaultPath

      public void setVaultPath(Path newPath)
      Set database absolute path (/directory/file.dbx.json)
      Parameters:
      newPath - new path
    • getVaultPath

      public Path getVaultPath()
      Get database absolute path
      Returns:
      actual absolute path
    • setVaultDir

      public void setVaultDir(Path newDir)
      Set parent directory of database
      Parameters:
      newDir - new parent directory
    • getVaultDir

      public Path getVaultDir()
      Get parent directory of database
      Returns:
      actual parent directory
    • saveToPath

      public void saveToPath() throws VaultFileIOException, VaultFileFormatException
      Save the database
      Throws:
      VaultFileIOException - if it can't save it because of a IO error
      VaultFileFormatException - if the format of the file provided is wrong
    • addUserData

      public void addUserData(UserData userData, String event) throws VaultOperationException
      Add new password to the vault
      Parameters:
      userData - UserData to add
      Throws:
      VaultOperationException - if an error during the operation
    • addUserData

      public void addUserData(UserData userData) throws VaultOperationException
      Add new password to the vault
      Parameters:
      userData - UserData to add
      Throws:
      VaultOperationException - if an error during the operation
    • putUserData

      public void putUserData(UUID userDataID, UserData userData) throws VaultOperationException
      Edit the UserData with the ID userDataID
      Parameters:
      userDataID - id of the UserData to change
      userData - new value of the UserData
      Throws:
      VaultOperationException - if an error during the operation
    • removeUserData

      public void removeUserData(UUID userDataID) throws VaultOperationException
      Remove the UserData with the ID userDataID
      Parameters:
      userDataID - id of the UserData to remove from the vault
      Throws:
      VaultOperationException - if an error during the operation
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Add a listener for event
      Parameters:
      listener - who listen event
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Remove the listener to the param pcs
      Parameters:
      listener - view which implement PropertyChangeListener
    • closeVault

      public void closeVault()
      close the vault by unbinding infos
    • initCustomPassInfos

      public void initCustomPassInfos()
      Initializes the Custom Password Information with default values. This method creates a new instance of CustomPasswordData with predefined parameters.

      The default values are: - Length: 12 - Uppercase: true - Lowercase: true - Digits: true - Special Characters: true

    • setCustomPassInfos

      public void setCustomPassInfos(CustomPasswordData customizer)
      Sets the Custom Password Information. This method allows updating the CustomPasswordData instance with a new custom configuration.
      Parameters:
      customizer - A CustomPasswordData object that contains the new password customization settings.
    • getCustomPassInfos

      public CustomPasswordData getCustomPassInfos()
      Gets the current Custom Password Information. This method returns the CustomPasswordData object that holds the current settings for the custom password generation.
      Returns:
      The current CustomPasswordData instance.
    • createExtensionServer

      public void createExtensionServer() throws IOException
      Throws:
      IOException
    • setServerAuth

      public void setServerAuth(ServerAuthentication servAut)
      Set the server authentication
      Parameters:
      servAut - the server authentication
    • getAuthenticatedUser

      public ServerUser getAuthenticatedUser()
    • getServerAuth

      public ServerAuthentication getServerAuth()
    • getServerVault

      public ServerVault getServerVault()
    • getServerShare

      public ServerShare getServerShare()
    • setSync

      public void setSync()
      Instance the Synchronisation object
    • removeSync

      public void removeSync()
      Stop the automatic synchronization
    • synchronizeVault

      Manually synchronize the vault with the server
      Throws:
      ForbiddenAccessException - if the user doesn't have access to the server
      AuthenticationException - if the authentication failed
      VaultUpdateException - if the update of the vault failed
      IOException - if an IO error occurred
      TimeoutException
    • shareUserData

      public SharedUserData shareUserData(UserData userData, ServerUser receiver) throws ServerException, IOException, TimeoutException
      Throws:
      ServerException
      IOException
      TimeoutException