Book Image

Alfresco Developer Guide

Book Image

Alfresco Developer Guide

Overview of this book

Table of Contents (17 chapters)
Alfresco Developer Guide
Credits
About the Author
About the Reviewers
Preface
Index

Foundation API Public Services


When working with the Alfresco Foundation API, you should use Alfresco's services interfaces as much as possible, rather than the implementation classes. The definitive resource for these classes is the Javadoc, the source code, and the test classes that often accompany each of the services. The goal of this section is to make you aware of the "public" services that are available and provide a cross-reference between the service's interface, the implementation class, the test class (if one's available), and the Spring Bean ID.

ActionService

Description

Get, create, and execute rule actions.

Interface

org.alfresco.service.cmr.action.ActionService

Implementation Class

org.alfresco.repo.action.ActionServiceImpl

JUnit Test Class

org.alfresco.repo.action.ActionServiceImplTest

Spring Bean ID

ActionService

ActivityService (3.0 Labs)

Description

Used to post activities and retrieve feeds of activities scoped to a particular site or across all sites. See SiteService.

Interface

org.alfresco.repo.activities.ActivityService

Implementation Class

org.alfresco.repo.activities.ActivityServiceImpl

JUnit Test Class

org.alfresco.repo.activities.ActivityServiceImplTest

Spring Bean ID

ActionService

AttributeService

Description

Gets and sets global, arbitrary attributes. Note: This is not what you would use to get the attributes (more correctly, "properties") of a node. Use the NodeService for that. Alfresco uses this service to store things such as a table of locked objects. But you could use it to store settings for your own needs as well.

Interface

org.alfresco.service.cmr.attributes.AttributeService

Implementation Class

org.alfresco.repo.attributes.AttributeServiceImpl

JUnit Test Class

org.alfresco.repo.attributes.AttributeServiceTest

Spring Bean ID

AttributeService

AuditService

Description

Public service used to write (and list) audit entries for a node. Unlike the lower-level auditing functionality, which is configured by adding annotations to service classes, this service is meant to be called by higher-level classes such as actions.

Interface

org.alfresco.service.cmr.audit.AuditService

Implementation Class

org.alfresco.repo.audit.AuditServiceImpl

JUnit Test Class

org.alfresco.repo.audit.AuditServiceTest

Spring Bean ID

AuditService

AuthenticationService

Description

Service used to authenticate with the repository. Includes methods for authenticating as guest, getting, validating and invalidating tickets, and getting the current username.

Interface

org.alfresco.service.cmr.security.AuthenticationService

Implementation Class

org.alfresco.repo.security.authentication.AuthenticationServiceImpl

JUnit Test Class

org.alfresco.repo.security.authentication.AuthenticationTest

Spring Bean ID

AuthenticationService

AuthorityService

Description

Service used to find authorities, check for the presence of an authority, and find the authorities that contain a particular authority (where an authority might be a user or a group). This service is not used to create new users, however. That's done with the PersonService and the AuthenticationService. See Chapter 9.

Interface

org.alfresco.service.cmr.security.AuthorityService

Implementation Class

org.alfresco.repo.security.authority.AuthorityServiceImpl

JUnit Test Class

org.alfresco.repo.security.authority.AuthorityServiceTest

Spring Bean ID

AuthorityService

AVMService

Description

Used for working with AVM stores. Its equivalent on the Document Management side of Alfresco is NodeService. The AVMService is used to manage nodes (including adding and removing aspects, and setting properties), stores, and branches.

Interface

org.alfresco.service.cmr.avm.AVMService

Implementation Class

org.alfresco.repo.avm.AVMServiceImpl

JUnit Test Class

org.alfresco.repo.avm.AVMServiceTest

Spring Bean ID

AVMService

AVMLockingService

Description

Service used to add and remove locks to and from nodes in the AVM store.

Interface

org.alfresco.service.cmr.avm.locking.AVMLockingService

Implementation Class

org.alfresco.repo.avm.locking.AVMLockingServiceImpl

JUnit Test Class

org.alfresco.repo.avm.locking.AVMLockingServiceTest

Spring Bean ID

AVMLockingService

AVMSyncService

Description

Service used for differentiating and merging of two branches, directories, or stores.

Interface

org.alfresco.service.cmr.avmsync.AVMSyncService

Implementation Class

org.alfresco.repo.avm.AVMSyncServiceImpl

JUnit Test Class

N/A

Spring Bean ID

AVMSyncService

CategoryService

Description

Service used to manage categories. This service is not used to categorize content. That is handled by setting a property on the node using the NodeService.

Interface

org.alfresco.service.cmr.search.CategoryService

Implementation Class

org.alfresco.repo.search.impl.lucene.LuceneCategoryServiceImpl

JUnit Test Class

N/A

Spring Bean ID

CategoryService

CheckOutCheckInService

Description

Used to check out, check in, or cancel the check out of a particular node.

Interface

org.alfresco.service.cmr.coci.CheckOutCheckInService

Implementation Class

org.alfresco.repo.coci.CheckOutCheckInServiceImpl

JUnit Test Class

org.alfresco.repo.coci.CheckOutCheckInServiceImplTest

Spring Bean ID

CheckOutCheckInService

ConfigurableService

Description

The ConfigurableService makes a node "configurable" by applying the configurable aspect. Out of the box, this is used to make person nodes configurable. The configuration is used to persist the user's preferences.

Interface

org.alfresco.repo.configuration.ConfigurableService

Implementation Class

org.alfresco.repo.configuration.ConfigurableServiceImpl

JUnit Test Class

org.alfresco.repo.configuration.ConfigurableServiceImplTest

Spring Bean ID

ConfigurableService

ContentUsageService (3.0 Labs)

Description

Service used to get and set a quota for disk usage for a particular user.

Interface

org.alfresco.service.cmr.usage.ContentUsageService

Implementation Class

org.alfresco.repo.usage.ContentUsageImpl

JUnit Test Class

N/A

Spring Bean ID

ContentUsageService

ContentService

Description

Service used for reading and writing content from and to a node.

Interface

org.alfresco.service.cmr.repository.ContentService

Implementation Class

org.alfresco.repo.content.RoutingContentService

JUnit Test Class

org.alfresco.repo.content.RoutingContentServiceTest

Spring Bean ID

ContentService

CopyService

Description

Service used for copying nodes. It is up to you to rename the new node if duplicate child names are not allowed by the containing association. See also FileFolderService.

Interface

org.alfresco.service.cmr.repository.CopyService

Implementation Class

org.alfresco.repo.copy.CopyServiceImpl

JUnit Test Class

org.alfresco.repo.copy.CopyServiceImplTest

Spring Bean ID

CopyService

CrossRepositoryCopyService

Description

Service used to copy nodes from one repository implementation to another (for example, copying from the DM store to the WCM or AVM store).

Interface

org.alfresco.service.cmr.repository.CrossRepositoryCopyService

Implementation Class

org.alfresco.repo.copy.CrossRepositoryCopyServiceImpl

JUnit Test Class

N/A

Spring Bean ID

CrossRepositoryCopyService

DeploymentService

Description

Service for initiating deployments.

Interface

org.alfresco.service.cmr.avm.deploy.DeploymentService

Implementation Class

org.alfresco.repo.deploy.DeploymentServiceImpl

JUnit Test Class

org.alfresco.repo.deploy.FSDeploymentTest

Spring Bean ID

DeploymentService

DescriptorService

Description

Service used to retrieve (but not set) metadata about the Alfresco installation. The metadata is limited to the schema that was present when it was installed, and information about the currently installed license file (issuer, expiration date, and so on).

Interface

org.alfresco.service.descriptor.DescriptorService

Implementation Class

org.alfresco.repo.descriptor.DescriptorServiceImpl

JUnit Test Class

org.alfresco.repo.descriptor.DescriptorServiceTest

Spring Bean ID

DescriptorService

DictionaryService

Description

Used to query the deployed content model. The service can get the list of types, aspects, properties, and associations deployed in the repository. It can also be used to check whether a type is a subtype of another.

Interface

org.alfresco.service.cmr.dictionary.DictionaryService

Implementation Class

org.alfresco.repo.dictionary.DictionaryComponent

JUnit Test Class

N/A

Spring Bean ID

DictionaryService

EditionService

Description

Service used to create and manage versions of a multilingual container, which are called "Editions".

Interface

org.alfresco.service.cmr.ml.EditionService

Implementation Class

org.alfresco.repo.model.ml.EditionServiceImpl

JUnit Test Class

N/A

Spring Bean ID

EditionService

EmailService

Description

This service, not to be confused with the MailService, is used for processing inbound email messages sent to the SMTP listener.

Interface

org.alfresco.service.cmr.email.EmailService

Implementation Class

org.alfresco.email.server.EmailServiceImpl

JUnit Test Class

N/A

Spring Bean ID

EmailService

ExporterService

Description

Service used to export a view of the repository.

Interface

org.alfresco.service.cmr.view.ExporterService

Implementation Class

org.alfresco.repo.exporter.ExporterComponent

JUnit Test Class

org.alfresco.repo.exporter.ExporterComponentTest

Spring Bean ID

ExporterService

FileFolderService

Description

Service for copying, creating, deleting, and searching files and folders.

Interface

org.alfresco.service.cmr.model.FileFolderService

Implementation Class

org.alfresco.repo.model.filefolder.FileFolderServiceImpl

JUnit Test Class

org.alfresco.repo.model.filefolder.FileFolderServiceImplTest

Spring Bean ID

FileFolderService

ImporterService

Description

Service used to import files and metadata into the repository. The service expects a ZIP file that follows the ACP format. See "ACP Files" in Appendix C.

Interface

org.alfresco.service.cmr.view.ImporterService

Implementation Class

org.alfresco.repo.importer.ImporterComponent

JUnit Test Class

org.alfresco.repo.importer.ImporterComponentTest

Spring Bean ID

ImporterService

LinkValidationService

Description

Used as part of Alfresco's WCM functionality, this service performs link checks on objects in the AVM store. It can also be used to retrieve a list of the objects that another object depends on.

Interface

org.alfresco.linkvalidation.LinkValidationService

Implementation Class

org.alfresco.linkvalidation.LinkValidationServiceImpl

JUnit Test Class

N/A

Spring Bean ID

LinkValidationService

LockService

Description

Service used to lock or unlock a node or collection of nodes. Can also be used to find out nodes that are locked across the entire store.

Interface

org.alfresco.service.cmr.lock.LockService

Implementation Class

org.alfresco.repo.lock.LockServiceImpl

JUnit Test Class

org.alfresco.repo.lock.LockServiceImplTest

Spring Bean ID

LockService

MailService

Description

Used to send outgoing SMTP messages.

Interface

org.springframework.mail.javamail.JavaMailSender

Implementation Class

org.springframework.mail.javamail.JavaMailSenderImpl

JUnit Test Class

N/A

Spring Bean ID

MailService

MimetypeService

Description

Service used to work with mimetypes such as getting the mimetype for a particular extension (or vice-versa) and for guessing a mimetype based on a file name. The service also includes an isText() method, which returns true if the format is plain text.

Interface

org.alfresco.service.cmr.repository.MimetypeService

Implementation Class

org.alfresco.repo.content.MimetypeMap

JUnit Test Class

org.alfresco.repo.content.MimetypeMapTest

Spring Bean ID

MimetypeService

ModuleService

Description

Service used to determine the list of currently deployed modules.

Interface

org.alfresco.service.cmr.module.ModuleService

Implementation Class

org.alfresco.repo.module.ModuleServiceImpl

JUnit Test Class

N/A

Spring Bean ID

ModuleService

MultilingualContentService

Description

Service used to declare that a node is a translation of another. The service can also be used to find translations for a given node, and test whether or not a given node is a translation.

Interface

org.alfresco.service.cmr.ml.MultilingualContentService

Implementation Class

org.alfresco.repo.model.ml.MultilingualContentServiceImpl

JUnit Test Class

org.alfresco.repo.model.ml.tools.MultilingualContentServiceImplTest

Spring Bean ID

MultilingualContentService

NamespaceService

Description

Service for registering and unregistering namespaces.

Interface

org.alfresco.service.namespace.NamespaceService

Implementation Class

org.alfresco.repo.dictionary.DictionaryNamespaceComponent

JUnit Test Class

N/A

Spring Bean ID

NamespaceService

NodeService

Description

Service for doing just about anything you could ever want to with a node, including creating and deleting nodes, checking a node for the presence of an aspect, getting and setting a node's properties, and getting a node's associations.

Interface

org.alfresco.service.cmr.repository.NodeService

Implementation Class

org.alfresco.repo.version.NodeServiceImpl

org.alfresco.repo.avm.AVMNodeService (see AVMNodeService)

JUnit Test Class

org.alfresco.repo.version.NodeServiceImplTest

Spring Bean ID

NodeService

OwnableService

Description

Service used to determine the owner of an object and take ownership of that object.

Interface

org.alfresco.service.cmr.security.OwnableService

Implementation Class

org.alfresco.repo.ownable.impl.OwnableServiceImpl

JUnit Test Class

org.alfresco.repo.ownable.impl.OwnableServiceTest

Spring Bean ID

OwnableService

PermissionService

Description

Service used for getting and setting the permissions on a node.

Interface

org.alfresco.service.cmr.security.PermissionService

org.alfresco.repo.security.permissions.PermissionServiceSPI

Implementation Class

org.alfresco.repo.security.permissions.impl.PermissionServiceImpl

JUnit Test Class

org.alfresco.repo.security.permissions.impl.PermissionServiceTest

Spring Bean ID

PermissionService

PersonService

Description

Service used to manage person objects in the repository. Everyone has a person object, even if their authentication credentials are managed by some other source.

Interface

org.alfresco.service.cmr.security.PersonService

Implementation Class

org.alfresco.repo.security.person.PersonServiceImpl

JUnit Test Class

org.alfresco.repo.security.person.PersonTest

Spring Bean ID

PersonService

RegistryService

Description

Service used to manage system-wide metadata. For example, after an AMP is installed, its configuration data is stored using the RegistryService.

Interface

org.alfresco.repo.admin.registry.RegistryService

Implementation Class

org.alfresco.repo.admin.registry.RegistryServiceImpl

JUnit Test Class

org.alfresco.repo.admin.registry.RegistryServiceImplTest

Spring Bean ID

RegistryService

RepoAdminService (3.0 Labs)

Description

Service used to do things such as reloading a message bundle or hot-deploying a content model without requiring a restart of the repository.

Interface

org.alfresco.service.cmr.admin.RepoAdminService

Implementation Class

org.alfresco.repo.admin.RepoAdminServiceImpl

JUnit Test Class

org.alfresco.repo.admin.RepoAdminServiceImplTest

Spring Bean ID

RepoAdminService

RepositoryExporterService

Description

Service used to export the repository as an ACP file.

Interface

org.alfresco.service.cmr.view.RepositoryExporterService

Implementation Class

org.alfresco.repo.exporter.RepositoryExporterComponent

JUnit Test Class

org.alfresco.repo.exporter.RepositoryExporterComponentTest

Spring Bean ID

repositoryExporterComponent

RuleService

Description

Service for retrieving, enabling, and disabling the rules on a node.

Interface

org.alfresco.service.cmr.rule.RuleService

Implementation Class

org.alfresco.repo.rule.RuleServiceImpl

JUnit Test Class

org.alfresco.repo.rule.RuleServiceImplTest

Spring Bean ID

RuleService

SearchService

Description

Service used for searching the repository.

Interface

org.alfresco.service.cmr.search.SearchService

Implementation Class

org.alfresco.repo.search.SearcherComponent

JUnit Test Class

org.alfresco.repo.search.SearcherComponentTest

Spring Bean ID

SearchService

ScriptService

Description

Service for executing JavaScript stored in the repository, on the classpath, or passed in as a String.

Interface

org.alfresco.service.cmr.repository.ScriptService

Implementation Class

org.alfresco.repo.processor.ScriptServiceImpl

JUnit Test Class

N/A

Spring Bean ID

ScriptService

SiteService (3.0 Labs)

Description

Service for creating and manipulating Alfresco Share sites.

Interface

org.alfresco.repo.site.SiteService

Implementation Class

org.alfresco.repo.site.SiteServiceImpl

JUnit Test Class

org.alfresco.repo.site.SiteServiceImplTest

Spring Bean ID

SiteService

TaggingService (3.0 Labs)

Description

Service for creating tags, assigning tags to nodes, and finding nodes based on a given tag.

Interface

org.alfresco.service.cmr.tagging.TaggingService

Implementation Class

org.alfresco.repo.tagging.TaggingServiceImpl

JUnit Test Class

org.alfresco.repo.tagging.TaggingServiceImplTest

Spring Bean ID

TaggingService

TemplateService

Description

Service for executing templates using a template rendering engine. FreeMarker is the default template rendering engine.

Interface

org.alfresco.service.cmr.repository.TemplateService

Implementation Class

org.alfresco.repo.processor.TemplateServiceImpl

JUnit Test Class

N/A

Spring Bean ID

TemplateService

ThumbnailService (3.0 Labs)

Description

Used to create, retrieve, and update thumbnails for the content property of a node.

Interface

org.alfresco.service.cmr.thumbnail.ThumbnailService

Implementation Class

org.alfresco.repo.thumbnail.ThumbnailServiceImpl

JUnit Test Class

N/A

Spring Bean ID

ThumbnailService

TransactionService

Description

Service for getting access to a user transaction.

Interface

org.alfresco.service.transaction.TransactionService

Implementation Class

org.alfresco.repo.transaction.TransactionServiceImpl

JUnit Test Class

org.alfresco.repo.transaction.TransactionServiceImpl

Spring Bean ID

TransactionService

VersionService

Description

Service for creating and reverting to versions of a node.

Interface

org.alfresco.service.cmr.version.VersionService

Implementation Class

org.alfresco.repo.version.VersionServiceImpl

JUnit Test Class

org.alfresco.repo.version.VersionServiceImplTest

Spring Bean ID

VersionService

WorkflowService

Description

Service for working with workflows and workflow definitions. Includes methods for deploying definitions, starting workflows, and signaling nodes.

Interface

org.alfresco.service.cmr.workflow.WorkflowService

Implementation Class

org.alfresco.repo.workflow.WorkflowServiceImpl

JUnit Test Class

org.alfresco.repo.workflow.WorkflowServiceImplTest

Spring Bean ID

WorkflowService