Interface Command<T>

Type Parameters:
T - the result type of a Command
All Known Implementing Classes:
AbstractPushCommand, CreateProjectCommand, CreateRepositoryCommand, CreateSessionCommand, ForcePushCommand, NormalizingPushCommand, PurgeProjectCommand, PurgeRepositoryCommand, PushAsIsCommand, RemoveProjectCommand, RemoveRepositoryCommand, RemoveSessionCommand, RepositoryCommand, RootCommand, SessionCommand, UnremoveProjectCommand, UnremoveRepositoryCommand, UpdateServerStatusCommand

public interface Command<T>
A Central Dogma command which is used to mutate projects and repositories.
  • Method Details

    • createProject

      static Command<Void> createProject(Author author, String name)
      Returns a new Command which is used to create a new project.
      Parameters:
      author - the author who is creating the project
      name - the name of the project which is supposed to be created
    • createProject

      static Command<Void> createProject(@Nullable Long timestamp, Author author, String name)
      Returns a new Command which is used to create a new project.
      Parameters:
      timestamp - the creation time of the project, in milliseconds
      author - the author who is creating the project
      name - the name of the project which is supposed to be created
    • removeProject

      static Command<Void> removeProject(Author author, String name)
      Returns a new Command which is used to remove a project.
      Parameters:
      author - the author who is removing the project
      name - the name of the project which is supposed to be removed
    • removeProject

      static Command<Void> removeProject(@Nullable Long timestamp, Author author, String name)
      Returns a new Command which is used to remove a project.
      Parameters:
      timestamp - the removal time of the project, in milliseconds
      author - the author who is removing the project
      name - the name of the project which is supposed to be removed
    • unremoveProject

      static Command<Void> unremoveProject(Author author, String name)
      Returns a new Command which is used to restore a project that was removed before.
      Parameters:
      author - the author who is restoring the project
      name - the name of the project which is supposed to be restored
    • unremoveProject

      static Command<Void> unremoveProject(@Nullable Long timestamp, Author author, String name)
      Returns a new Command which is used to restore a project that was removed before.
      Parameters:
      timestamp - the restoration time of the project, in milliseconds
      author - the author who is restoring the project
      name - the name of the project which is supposed to be restored
    • purgeProject

      static Command<Void> purgeProject(Author author, String name)
      Returns a new Command which is used to purge a project that was removed before.
      Parameters:
      author - the author who is restoring the project
      name - the name of the project which is supposed to be restored
    • purgeProject

      static Command<Void> purgeProject(@Nullable Long timestamp, Author author, String name)
      Returns a new Command which is used to purge a project that was removed before.
      Parameters:
      timestamp - the purging time of the project, in milliseconds
      author - the author who is restoring the project
      name - the name of the project which is supposed to be restored
    • createRepository

      static Command<Void> createRepository(Author author, String projectName, String repositoryName)
      Returns a new Command which is used to create a new repository.
      Parameters:
      author - the author who is creating the repository
      projectName - the name of the project that the new repository is supposed to belong to
      repositoryName - the name of the repository which is supposed to be created
    • createRepository

      static Command<Void> createRepository(@Nullable Long timestamp, Author author, String projectName, String repositoryName)
      Returns a new Command which is used to create a new repository.
      Parameters:
      timestamp - the creation time of the repository, in milliseconds
      author - the author who is creating the repository
      projectName - the name of the project that the new repository is supposed to belong to
      repositoryName - the name of the repository which is supposed to be created
    • removeRepository

      static Command<Void> removeRepository(Author author, String projectName, String repositoryName)
      Returns a new Command which is used to remove a repository.
      Parameters:
      author - the author who is removing the repository
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be removed
    • removeRepository

      static Command<Void> removeRepository(@Nullable Long timestamp, Author author, String projectName, String repositoryName)
      Returns a new Command which is used to remove a repository.
      Parameters:
      timestamp - the removal time of the repository, in milliseconds
      author - the author who is removing the repository
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be removed
    • unremoveRepository

      static Command<Void> unremoveRepository(Author author, String projectName, String repositoryName)
      Returns a new Command which is used to restore a repository that was removed before.
      Parameters:
      author - the author who is restoring the repository
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be restored
    • unremoveRepository

      static Command<Void> unremoveRepository(@Nullable Long timestamp, Author author, String projectName, String repositoryName)
      Returns a new Command which is used to restore a repository that was removed before.
      Parameters:
      timestamp - the restoration time of the project, in milliseconds
      author - the author who is restoring the repository
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be restored
    • purgeRepository

      static Command<Void> purgeRepository(Author author, String projectName, String repositoryName)
      Returns a new Command which is used to purge a repository.
      Parameters:
      author - the author who is removing the repository
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be purged
    • purgeRepository

      static Command<Void> purgeRepository(@Nullable Long timestamp, Author author, String projectName, String repositoryName)
      Returns a new Command which is used to purge a repository.
      Parameters:
      timestamp - the purging time of the repository, in milliseconds
      author - the author who is removing the repository
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be purged
    • push

      static Command<CommitResult> push(Author author, String projectName, String repositoryName, Revision baseRevision, String summary, String detail, Markup markup, Change<?>... changes)
      Returns a new Command which is used to push the changes. The changes are normalized via Repository.previewDiff(Revision, Iterable) before they are applied. You can find the normalized changes from the CommitResult.changes() that is the result of CommandExecutor.execute(Command).
      Parameters:
      author - the author who is pushing the changes
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be restored
      baseRevision - the revision which is supposed to apply the changes
      summary - the summary of the changes
      detail - the detail message of the changes
      markup - the markup for the detail message
      changes - the changes to be applied
    • push

      static Command<CommitResult> push(@Nullable Long timestamp, Author author, String projectName, String repositoryName, Revision baseRevision, String summary, String detail, Markup markup, Change<?>... changes)
      Returns a new Command which is used to push the changes. The changes are normalized via Repository.previewDiff(Revision, Iterable) before they are applied. You can find the normalized changes from the CommitResult.changes() that is the result of CommandExecutor.execute(Command).
      Parameters:
      timestamp - the time when pushing the changes, in milliseconds
      author - the author who is pushing the changes
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be restored
      baseRevision - the revision which is supposed to apply the changes
      summary - the summary of the changes
      detail - the detail message of the changes
      markup - the markup for the detail message
      changes - the changes to be applied
    • push

      static Command<CommitResult> push(Author author, String projectName, String repositoryName, Revision baseRevision, String summary, String detail, Markup markup, Iterable<Change<?>> changes)
      Returns a new Command which is used to push the changes. The changes are normalized via Repository.previewDiff(Revision, Iterable) before they are applied. You can find the normalized changes from the CommitResult.changes() that is the result of CommandExecutor.execute(Command).
      Parameters:
      author - the author who is pushing the changes
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be restored
      baseRevision - the revision which is supposed to apply the changes
      summary - the summary of the changes
      detail - the detail message of the changes
      markup - the markup for the detail message
      changes - the changes to be applied
    • push

      static Command<CommitResult> push(@Nullable Long timestamp, Author author, String projectName, String repositoryName, Revision baseRevision, String summary, String detail, Markup markup, Iterable<Change<?>> changes)
      Returns a new Command which is used to push the changes. The changes are normalized via Repository.previewDiff(Revision, Iterable) before they are applied. You can find the normalized changes from the CommitResult.changes() that is the result of CommandExecutor.execute(Command).
      Parameters:
      timestamp - the time when pushing the changes, in milliseconds
      author - the author who is pushing the changes
      projectName - the name of the project
      repositoryName - the name of the repository which is supposed to be restored
      baseRevision - the revision which is supposed to apply the changes
      summary - the summary of the changes
      detail - the detail message of the changes
      markup - the markup for the detail message
      changes - the changes to be applied
    • createSession

      static Command<Void> createSession(Session session)
      Returns a new Command which is used to create a new session.
      Parameters:
      session - the session supposed to be created
    • removeSession

      static Command<Void> removeSession(String sessionId)
      Returns a new Command which is used to remove an existing session.
      Parameters:
      sessionId - the session ID supposed to be removed
    • updateServerStatus

      static Command<Void> updateServerStatus(ServerStatus serverStatus)
      Returns a new Command which is used to update the status of the server.
    • forcePush

      static <T> Command<T> forcePush(Command<T> delegate)
      Returns a new Command which is used to force-push Command even the server is in read-only mode. This command is useful for migrating the repository content during maintenance mode.

      Note that CommandType.NORMALIZING_PUSH and CommandType.PUSH are allowed as the delegate.

    • type

      CommandType type()
      Returns the CommandType of the command.
    • timestamp

      long timestamp()
      Returns the time when performing the command, in milliseconds.
    • author

      Author author()
      Returns the author who initiated the command.
    • executionPath

      String executionPath()
      Returns the target that the command is supposed to affect, i.e. the project name for the commands affecting to the project, or the project and repository names for the commands affecting to the repository.