Interface MTServer


public interface MTServer
Provides an interface to a server connection. These are methods that can be performed without the context of a "current" repository, such as listing all repositories or users on a server.
  • Method Details

    • getServerID

      String getServerID()
      Returns server ID of the current repository. Null if server ID could not be retrieved.
    • getVersion

      se.conciliate.mt.server.ServerVersion getVersion()
      Returns server version of the current repository.
    • getServerDomain

      String getServerDomain()
      Returns server domain of the current repository. Null if server domain could not be established.
    • getServerTime

      Date getServerTime()
      Returns the current time on the server.
    • getName

      String getName()
      Returns the name of the server.
    • isRepositoryTemplatesEnabled

      boolean isRepositoryTemplatesEnabled()
      Checks if repository templates is enabled.
      Returns:
      true if repository templates is enabled, otherwise false
    • setRepositoryTemplates

      void setRepositoryTemplates(boolean enable)
    • isMailEnabled

      boolean isMailEnabled()
      Checks if JavaMail is configured/enabled.
      Returns:
      true if mail is configured, otherwise false
    • createUser

      MTUser createUser(String username)
      Creates a new user. This user has not been saved to storage.
      Parameters:
      username - A unique username. If a user with this username already exists, that user will be overwritten when this user is saved.
    • createSubscriber

      MTSubscriber createSubscriber(String email)
      Creates a new subscriber. This subscriber has not been saved to storage.
      Parameters:
      email - A unique email. If a subscriber with this email already exists, that subscriber will be overwritten when this subscriber is saved.
    • createSubscriberGroup

      MTSubscriber createSubscriberGroup(String groupName)
      Creates a new subscriber group. This subscriber has not been saved to storage.
      Parameters:
      groupName - The group name
    • createRepository

      void createRepository(String name, Long parentId, Long templateId, Collection<Long> languageIds, Long defaultLanguageId)
      Creates a new repository from a template.
      Parameters:
      name - The name of the repository.
      parentId - id of the parent directory.
      templateId - id of the template repository.
      languageIds - ids of the languages to include from template repository
      defaultLanguageId - id of the default language
    • createRepository

      void createRepository(String name, Long templateId, Collection<Long> languageIds, Long defaultLanguageId)
      Creates a new repository from a template using 'ROOT' as parent
      Parameters:
      name - The name of the repository.
      templateId - id of the template repository.
      languageIds - ids of the languages to include from template repository
      defaultLanguageId - id of the default language
    • createRepository

      MTRepository createRepository(String name, boolean template, Long parentId, String configXML)
      Creates a new repository.
      Parameters:
      name - The name of the repository.
      template - If this repository should be a template or not.
      parentId - id of the parent directory.
      configXML - Repository configuration XML, can be null.
      Returns:
      A new repository that has not yet been saved.
    • createRepository

      MTRepository createRepository(String name, boolean template, String configXML)
      Creates a new repository using 'ROOT' as parent
      Parameters:
      name - The name of the repository.
      template - If this repository should be a template or not.
      configXML - Repository configuration XML, can be null.
      Returns:
      A new repository that has not yet been saved.
    • createDirectory

      MTDirectory createDirectory(String name, Long parentId)
      Creates a new directory.
      Parameters:
      name - The name of the directory.
      parentId - id of the parent directory.
      Returns:
      A new repository that has not yet been saved.
    • createDirectory

      MTDirectory createDirectory(String name)
      Creates a new directory using 'ROOT' as ancestor.
      Parameters:
      name - The name of the directory.
      Returns:
      A new repository that has not yet been saved.
    • getDefaultColorScheme

      MTColorScheme getDefaultColorScheme()
      Returns the default color scheme.
      Returns:
      The default color scheme if any is set, otherwise null.
      Since:
      3.2
    • getDefaultPublishTemplate

      MTPublishTemplate getDefaultPublishTemplate(String type)
      Returns the default publish template.
      Parameters:
      type - publish type
      Returns:
      The default publish template if any is set, otherwise null.
      Since:
      3.2
    • createColorScheme

      MTColorScheme createColorScheme() throws MTAccessException
      creates a color scheme in the database.
      Returns:
      A a new color scheme.
      Throws:
      MTAccessException
      Since:
      3.0
    • createRgbColorTransformer

      MTRgbColorTransformer createRgbColorTransformer(Color c)
    • createHsbColorTransformer

      MTHsbColorTransformer createHsbColorTransformer(float h, float s, float b)
    • colorTransformerFromString

      MTColorTransformer colorTransformerFromString(String s)
      Creates a color transformer from a string representation.
    • findColorSchemes

      List<MTColorSchemeHeader> findColorSchemes() throws MTAccessException
      Finds all color schemes in the database
      Returns:
      A list of color schemes.
      Throws:
      MTAccessException
      Since:
      3.0
    • findColorScheme

      MTColorSchemeHeader findColorScheme(String title) throws MTAccessException
      Finds a color schemes in the database with a specific title
      Parameters:
      title - The title
      Returns:
      A color schemes.
      Throws:
      MTAccessException
      Since:
      3.0
    • findSubscriber

      MTSubscriber findSubscriber(String email) throws MTAccessException
      Returns the MTSubscriber with the email email. If no such subscriber exists on this server, null is returned.
      Parameters:
      email - The email to look up.
      Returns:
      The subscriber for which email.equals(subscriber.getEmail()), or null.
      Throws:
      MTAccessException
    • findUser

      MTUserHeader findUser(String userId) throws MTAccessException
      Returns the MTUserHeader with the username (id) username. If no such user exists on this server, null is returned. This is not the same as using the user store, which will return the users in the local repository when connected to one, regardless of whether the user is currently logged on to a server.
      Parameters:
      userId - The id to look up.
      Returns:
      The user for which userId.equals(user.getUserName()), or null.
      Throws:
      MTAccessException
    • findUsers

      List<MTUser> findUsers(boolean includeDisabled) throws MTAccessException
      Returns all available (non disabled) users on the server. This is not the same as using the user store, which will return the users in the local repository when connected to one, regardless of whether the user is currently logged on to a server.
      Parameters:
      includeDisabled - true to include disabled users
      Returns:
      A list of server users.
      Throws:
      MTAccessException
      Since:
      3.1
    • findUserHeaders

      List<MTUserHeader> findUserHeaders(boolean includeDisabled) throws MTAccessException
      Throws:
      MTAccessException
    • findGroups

      List<MTGroup> findGroups()
      Returns all global groups on the server.
    • findRepositoryHeaders

      List<MTRepositoryHeader> findRepositoryHeaders() throws MTAccessException
      Returns headers for all server repositories.
      Returns:
      A list of repository headers ordered by name.
      Throws:
      MTAccessException
      Since:
      3.0
    • findRepositories

      List<MTRepository> findRepositories() throws MTAccessException
      Returns all server repositories.
      Returns:
      A list of repository headers ordered by name.
      Throws:
      MTAccessException
      Since:
      3.0
    • findRepositories

      List<MTRepository> findRepositories(boolean withModelCount) throws MTAccessException
      Throws:
      MTAccessException
    • findRepository

      MTRepository findRepository(Long id) throws MTAccessException
      Returns the MTRepository with the id id. If no such repository exists on this server, null is returned.
      Parameters:
      id - The id to look up.
      Returns:
      The repository for which id == repository.getId(), or null.
      Throws:
      MTAccessException
      Since:
      3.0
    • findRepositoryTemplateHeaders

      List<MTRepositoryHeader> findRepositoryTemplateHeaders() throws MTAccessException
      Returns headers for all server repository templates.
      Returns:
      A list of repository template headers ordered by name.
      Throws:
      MTAccessException
      Since:
      4.0
    • findLiteRepository

      MTRepository findLiteRepository()
      Finds the repository used by 2c8 Lite to store drafts made by Lite users.
    • findDirectories

      List<MTDirectory> findDirectories() throws MTAccessException
      Returns all server directories.
      Returns:
      A list of directories.
      Throws:
      MTAccessException
      Since:
      3.0
    • findDirectory

      MTDirectory findDirectory(Long id) throws MTAccessException
      Returns the MTDirectory with the id id. If no such directory exists on this server, null is returned.
      Parameters:
      id - The id to look up.
      Returns:
      The directory for which id == directory.getId(), or null.
      Throws:
      MTAccessException
      Since:
      3.0
    • getServerLog

      String getServerLog()
      Returns the last 500 lines of the server log.
    • findDashboardModels

      Map<WorkflowState,List<? extends ModelReference>> findDashboardModels()
      Returns the model that should be available on the dashboard for the current user.
      Returns:
      A map of the models relevant for the current user, where the keys are the current workflow states of the models.
    • findModelsByApprover

      List<? extends ModelReference> findModelsByApprover()
      Returns all models that the current user is set to approve on this server, regardless of the workflow state of the model.
      Returns:
      all models that the current user is set to approve on this server, regardless of the workflow state of the model.
    • findModelsByReviewer

      List<? extends ModelReference> findModelsByReviewer()
      Returns all models that the current user is set to review on this server, regardless of the workflow state of the model.
      Returns:
      all models that the current user is set to review on this server, regardless of the workflow state of the model.
    • findModelsByMaintainer

      List<? extends ModelReference> findModelsByMaintainer()
      Returns all models that the current user is set to maintain on this server, regardless of the workflow state of the model.
      Returns:
      all models that the current user is set to maintain on this server, regardless of the workflow state of the model.
    • findApproversByModel

      List<? extends UserReference> findApproversByModel(long modelID)
    • findReviewersByModel

      List<? extends UserReference> findReviewersByModel(long modelID)
    • findMaintainersByModel

      List<? extends UserReference> findMaintainersByModel(long modelID)
    • archiveDraft

      void archiveDraft(long draftID, String code)
      Archives a draft with the given ID.
      Parameters:
      draftID - The ID of the draft to archive.
      code - Users that are otherwise not allowed to archive drafts on this server may do so if they have the correct code associated with the draft. May be null.
    • rejectDraft

      void rejectDraft(long draftID, String code)
      Rejects a draft in the state "NEW" and moves it back to "DRAFT".
      Parameters:
      draftID - The ID of the draft to reject.
      code - Users that are otherwise not allowed to archive drafts on this server may do so if they have the correct code associated with the draft. May be null.
    • findDraft

      MTCompleteModel findDraft(String code)
      Finds a draft in the "NEW" state by its unique draft code. It is assumed that there is a current connection to the "Lite" repository when this method is called.
      Parameters:
      code - The draft code generated when moving the draft to the "NEW" state. This code will allow users otherwise not authorized to accept this draft into a repository where they have write privileges.
      Returns:
      The draft or null if not found.