Package se.conciliate.extensions.store
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 Summary
Modifier and TypeMethodDescriptionvoid
archiveDraft
(long draftID, String code) Archives a draft with the given ID.Creates a color transformer from a string representation.creates a color scheme in the database.createDirectory
(String name) Creates a new directory using 'ROOT' as ancestor.createDirectory
(String name, Long parentId) Creates a new directory.createHsbColorTransformer
(float h, float s, float b) createRepository
(String name, boolean template, Long parentId, String configXML) Creates a new repository.createRepository
(String name, boolean template, String configXML) Creates a new repository using 'ROOT' as parentvoid
createRepository
(String name, Long parentId, Long templateId, Collection<Long> languageIds, Long defaultLanguageId) Creates a new repository from a template.void
createRepository
(String name, Long templateId, Collection<Long> languageIds, Long defaultLanguageId) Creates a new repository from a template using 'ROOT' as parentcreateSubscriber
(String email) Creates a new subscriber.createSubscriberGroup
(String groupName) Creates a new subscriber group.createUser
(String username) Creates a new user.List<? extends UserReference>
findApproversByModel
(long modelID) findColorScheme
(String title) Finds a color schemes in the database with a specific titleFinds all color schemes in the databaseMap<WorkflowState,
List<? extends ModelReference>> Returns the model that should be available on the dashboard for the current user.Returns all server directories.findDirectory
(Long id) Returns theMTDirectory
with the idid
.Finds a draft in the "NEW" state by its unique draft code.Returns all global groups on the server.Finds the repository used by 2c8 Lite to store drafts made by Lite users.List<? extends UserReference>
findMaintainersByModel
(long modelID) List<? extends ModelReference>
Returns all models that the current user is set to approve on this server, regardless of the workflow state of the model.List<? extends ModelReference>
Returns all models that the current user is set to maintain on this server, regardless of the workflow state of the model.List<? extends ModelReference>
Returns all models that the current user is set to review on this server, regardless of the workflow state of the model.Returns all server repositories.findRepositories
(boolean withModelCount) findRepository
(Long id) Returns theMTRepository
with the idid
.Returns headers for all server repositories.Returns headers for all server repository templates.List<? extends UserReference>
findReviewersByModel
(long modelID) findSubscriber
(String email) Returns theMTSubscriber
with the emailemail
.Returns theMTUserHeader
with the username (id)username
.findUserHeaders
(boolean includeDisabled) findUsers
(boolean includeDisabled) Returns all available (non disabled) users on the server.Returns the default color scheme.Returns the default publish template.getName()
Returns the name of the server.Returns server domain of the current repository.Returns server ID of the current repository.Returns the last 500 lines of the server log.Returns the current time on the server.se.conciliate.mt.server.ServerVersion
Returns server version of the current repository.boolean
Checks if JavaMail is configured/enabled.boolean
Checks if repository templates is enabled.void
rejectDraft
(long draftID, String code) Rejects a draft in the state "NEW" and moves it back to "DRAFT".void
setRepositoryTemplates
(boolean enable)
-
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
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
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
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 repositorydefaultLanguageId
- 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 repositorydefaultLanguageId
- id of the default language
-
createRepository
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
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
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
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
Returns the default publish template.- Parameters:
type
- publish type- Returns:
- The default publish template if any is set, otherwise
null
. - Since:
- 3.2
-
createColorScheme
creates a color scheme in the database.- Returns:
- A a new color scheme.
- Throws:
MTAccessException
- Since:
- 3.0
-
createRgbColorTransformer
-
createHsbColorTransformer
-
colorTransformerFromString
Creates a color transformer from a string representation. -
findColorSchemes
Finds all color schemes in the database- Returns:
- A list of color schemes.
- Throws:
MTAccessException
- Since:
- 3.0
-
findColorScheme
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
Returns theMTSubscriber
with the emailemail
. 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
Returns theMTUserHeader
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
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
- Throws:
MTAccessException
-
findGroups
Returns all global groups on the server. -
findRepositoryHeaders
Returns headers for all server repositories.- Returns:
- A list of repository headers ordered by name.
- Throws:
MTAccessException
- Since:
- 3.0
-
findRepositories
Returns all server repositories.- Returns:
- A list of repository headers ordered by name.
- Throws:
MTAccessException
- Since:
- 3.0
-
findRepositories
- Throws:
MTAccessException
-
findRepository
Returns theMTRepository
with the idid
. 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
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
Returns all server directories.- Returns:
- A list of directories.
- Throws:
MTAccessException
- Since:
- 3.0
-
findDirectory
Returns theMTDirectory
with the idid
. 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
-
findReviewersByModel
-
findMaintainersByModel
-
archiveDraft
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
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
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.
-