Interface ProjectStorage


public interface ProjectStorage
FIRSTspirit Project management.
Since:
4.0
  • Method Details

    • createProject

      @NotNull @NotNull Project createProject(@NotNull @NotNull String name, @Nullable @Nullable String description)
      Create a new Project.
      Parameters:
      name - the name of the project
      description - the unique description of the project
      Returns:
      the newly created project
      Throws:
      SecurityException - if the user isn't the server admin
      Since:
      4.0
    • createProject

      @NotNull @NotNull Project createProject(@NotNull @NotNull String name, @Nullable @Nullable String description, @NotNull @NotNull Set<ProjectStorage.DefaultPackage> packages)
      Create a new Project with optional default packages.
      Parameters:
      name - the name of the project
      description - the unique description of the project, may be null
      packages - the packages to install after the project has been created. May be empty but not null.
      Returns:
      the newly created project
      Throws:
      SecurityException - if the user isn't the server admin
      Since:
      5.2.260601
    • getProject

      @Nullable @Nullable Project getProject(String name)
      Returns the project by name, regardless whether it's active or not.
      Parameters:
      name - project name.
      Returns:
      project or null if it doesn't exist.
      Since:
      4.0
    • getProject

      @Nullable @Nullable Project getProject(long id)
      Returns the project by id, regardless whether it's active or not.
      Parameters:
      id - project id.
      Returns:
      project or null if it doesn't exist.
      Since:
      4.0
    • getProjects

      @NotNull @NotNull Project[] getProjects()
      Returns all (active and inactive) projects.
      Returns:
      active and inactive projects
      Since:
      4.0
    • getProjects

      @NotNull @NotNull Project[] getProjects(boolean active)
      Returns either all active or inactive projects.
      Parameters:
      active - true for active, false for inactive projects.
      Returns:
      either active or inactive projects.
      Since:
      4.0
    • removeProject

      void removeProject(@NotNull @NotNull Project project)
      Removes a project from server.
      Parameters:
      project - the project to remove
      Throws:
      SecurityException - if the user isn't the server admin
      Since:
      4.0
    • removeProject

      void removeProject(@NotNull @NotNull Project project, boolean cleanDB)
      Removes a project from server and deletes the connected database too if cleanDB is set to true
      Parameters:
      project - the project to remove
      cleanDB - also clean the database and delete all connected tables
      Throws:
      SecurityException - if the user isn't the server admin
      Since:
      5.2.210903
    • getMaxProjects

      int getMaxProjects()
      Returns maximum number of allowed projects (possible license restriction).
      Returns:
      maximum number of allowed projects.
      Since:
      4.0
    • checkProject

      String checkProject(@NotNull @NotNull Project project)
      Checks if a project needs to be migrated to current server version.
      Since:
      4.0
    • activateProject

      void activateProject(@NotNull @NotNull Project project) throws AccessRuntimeException
      Activates a deactivated project.
      Parameters:
      project - to activate.
      Throws:
      AccessRuntimeException - if the project couldn't be activated, e.g. in case of missing project directory
      SecurityException - if the user isn't the server admin
      Since:
      4.0
    • deactivateProject

      void deactivateProject(@NotNull @NotNull Project project)
      Deactivates a project. Project needs to be locked. Calling Lockable.save() isn't necessary.
      Parameters:
      project - to deactivate.
      Throws:
      SecurityException - if the user isn't the server admin
      Since:
      4.0
    • updateVersionInfo

      void updateVersionInfo(@NotNull @NotNull Project project)
      Updates the project information to match the current server version.
      Parameters:
      project - the project to update.
      Since:
      4.0
    • rebuildReferences

      @Deprecated void rebuildReferences(@NotNull @NotNull Project project)
      Deprecated.
      Starts reference rebuilding for the given project with it's latest revision.
      Parameters:
      project - which references should be rebuilded.
      Since:
      4.0
    • rebuildSearchIndex

      void rebuildSearchIndex(@NotNull @NotNull Project project)
      Since FirstSpirit v5 this starts the project schedule entry with the name "Rebuild search index".
      Since:
      4.0
    • rebuildSearchIndex

      void rebuildSearchIndex(@NotNull @NotNull IDProvider element)
      Refreshes the search index for the given element. Supports all FirstSpirit element types, particularly Media and Dataset objects.
      Since:
      5.0.313
    • refreshProjects

      void refreshProjects()
      Resets the cache of the project list
      Since:
      4.0
      See Also:
    • uploadExportFilePart

      void uploadExportFilePart(String name, @NotNull @NotNull InputStream fileData) throws IOException
      Upload a part of a splitted export file. If the file exists, data is appended. Use deleteExportFile(ExportFile) to delete export files on server.
      Throws:
      IOException
      Since:
      4.0
    • uploadExportFile

      ExportFile uploadExportFile(String fileName, @NotNull @NotNull InputStream fileData) throws IOException
      Upload single export file or last part of files to server. If the file exists, data is appended. Use deleteExportFile(ExportFile) to delete export files on server.
      Parameters:
      fileName - the file name of the uploaded file (e.g. export.tar.gz)
      Throws:
      IOException
      Since:
      4.0
    • listExportFiles

      @NotNull @NotNull List<ExportFile> listExportFiles() throws IOException
      List all export files on server.
      Throws:
      IOException
      Since:
      4.0
    • deleteExportFile

      void deleteExportFile(@NotNull @NotNull ExportFile exportFile) throws FileNotFoundException
      Delete export file on server.
      Throws:
      FileNotFoundException
      Since:
      4.0
    • getProjectInfo

      @Nullable @Nullable ProjectInfo getProjectInfo(@NotNull @NotNull ExportFile exportFile) throws IOException
      Parse info out of ExportFile contents
      Parameters:
      exportFile -
      Throws:
      IOException
      Since:
      4.0
    • startImport

      ServerActionHandle<ImportProgress,Boolean> startImport(@NotNull @NotNull ImportParameters importParameters) throws IOException
      Start project import.
      Parameters:
      importParameters - The import parameters
      Returns:
      importId handle
      Throws:
      SecurityException - if the user isn't the server admin
      IOException
      Since:
      4.0
    • downloadExportFile

      @NotNull @NotNull InputStream downloadExportFile(@NotNull @NotNull ExportFile exportFile) throws IOException
      Download an export file.
      Throws:
      IOException
      Since:
      4.0
    • startExport

      ServerActionHandle<ExportProgress,Boolean> startExport(@NotNull @NotNull ExportParameters exportParameters) throws IOException
      Start project export.
      Parameters:
      exportParameters - The export parameters
      Returns:
      exportId handle
      Throws:
      SecurityException - if the user isn't a project admin of the project
      IOException
      Since:
      4.0
    • getFontUsages

      @NotNull @NotNull List<Project> getFontUsages(String name)
      Returns a list of projects using the font specified by the given name.
      Since:
      4.2.34
      See Also:
    • startSnapshotExport

      ServerActionHandle<ExportProgress,Boolean> startSnapshotExport(@NotNull @NotNull BackupParameters backupParameters)
      Start project snapshot export.
      Returns:
      exportId handle
      Throws:
      SecurityException - if the user isn't a project admin of the project
      Since:
      4.1.25
    • listBackupFiles

      @NotNull @NotNull List<ExportFile> listBackupFiles() throws IOException
      List incremental, differential and snapshot backup files.
      Throws:
      IOException
      Since:
      4.1.16
    • startIncrementalBackup

      ServerActionHandle<ExportProgress,Boolean> startIncrementalBackup(@NotNull @NotNull BackupParameters backupParameters) throws IllegalStateException
      Start incremental project repository backup export. All changed data since last snapshot export or incremental backup will be exported. If no snapshot export or incremental backup exists in this project, a IllegalStateException will be thrown.
      Throws:
      IllegalStateException - Thrown if no snapshot or incremental backup tag was found in this project.
      SecurityException - if the user isn't a project admin of the project
      Since:
      4.1.25
    • startDifferentialBackup

      ServerActionHandle<ExportProgress,Boolean> startDifferentialBackup(@NotNull @NotNull BackupParameters backupParameters) throws IllegalStateException
      Start differential project repository backup export. All changed data since last snapshot export will be exported. If no snapshot export exists in this project, a IllegalStateException will be thrown.
      Throws:
      IllegalStateException - Thrown if no snapshot tag was found in this project.
      SecurityException - if the user isn't a project admin of the project
      Since:
      4.1.25
    • startPartialInstall

      ServerActionHandle<ImportProgress,Boolean> startPartialInstall(long projectId, @Nullable @Nullable Map<String,String> layerMappings, @NotNull @NotNull List<ExportFile> backups) throws IOException
      Install incremental or differential backup file into a existing project.
      Parameters:
      backups - The backup files to install
      Throws:
      IOException
      Since:
      4.1.20
    • startProjectRevert

      ServerActionHandle<ImportProgress,Boolean> startProjectRevert(long projectId, @NotNull @NotNull String snapshotFileName) throws IOException
      Revert a project to a state after a snapshot has been installed. Project will be deactivated during revert process. All newer files will be deleted, no backup is made!
      Parameters:
      snapshotFileName - The snapshot file name to revert the project to
      Throws:
      SecurityException - if the user isn't a project admin of the project
      IOException
      Since:
      4.2.3
    • getUnmappedLayers

      @NotNull @NotNull List<Properties> getUnmappedLayers(long projectId, @NotNull @NotNull String snapshotFileName, @NotNull @NotNull List<ExportFile> backups) throws IOException
      Get unmapped layer information for installing backup files.
      Parameters:
      projectId - The project id
      snapshotFileName - The snapshot the backups are based on
      backups - The backup files to install
      Throws:
      IOException
      Since:
      4.2.450
    • getInstalledExportFiles

      @NotNull @NotNull List<String> getInstalledExportFiles(long projectId) throws IOException
      Get filename list of installed exports and backups.
      Parameters:
      projectId - The project id
      Throws:
      IOException
      Since:
      4.2.5