Search in sources :

Example 1 with SiteService

use of org.alfresco.service.cmr.site.SiteService in project alfresco-remote-api by Alfresco.

the class MkcolMethod method postActivity.

/**
 * Create a folder added activity post.
 *
 * @throws WebDAVServerException
 */
private void postActivity(FileInfo fileInfo) throws WebDAVServerException {
    WebDavService davService = getDAVHelper().getServiceRegistry().getWebDavService();
    if (!davService.activitiesEnabled()) {
        // Don't post activities if this behaviour is disabled.
        return;
    }
    String siteId = getSiteId();
    String tenantDomain = getTenantDomain();
    // Check there is enough information to publish site activity.
    if (!siteId.equals(WebDAVHelper.EMPTY_SITE_ID)) {
        SiteService siteService = getServiceRegistry().getSiteService();
        NodeRef documentLibrary = siteService.getContainer(siteId, SiteService.DOCUMENT_LIBRARY);
        String path = "/";
        try {
            path = getDAVHelper().getPathFromNode(documentLibrary, fileInfo.getNodeRef());
        } catch (FileNotFoundException error) {
            if (logger.isDebugEnabled()) {
                logger.debug("No " + SiteService.DOCUMENT_LIBRARY + " container found.");
            }
        }
        activityPoster.postFileFolderAdded(siteId, tenantDomain, path, fileInfo);
    }
}
Also used : WebDavService(org.alfresco.service.cmr.webdav.WebDavService) NodeRef(org.alfresco.service.cmr.repository.NodeRef) SiteService(org.alfresco.service.cmr.site.SiteService) FileNotFoundException(org.alfresco.service.cmr.model.FileNotFoundException)

Example 2 with SiteService

use of org.alfresco.service.cmr.site.SiteService in project alfresco-remote-api by Alfresco.

the class DeleteMethod method postActivity.

/**
 * Create a deletion activity post.
 *
 * @param parent The FileInfo for the deleted file's parent.
 * @param deletedFile The FileInfo for the deleted file.
 * @throws WebDAVServerException
 */
protected void postActivity(FileInfo parent, FileInfo deletedFile, String siteId) throws WebDAVServerException {
    WebDavService davService = getDAVHelper().getServiceRegistry().getWebDavService();
    if (!davService.activitiesEnabled()) {
        // Don't post activities if this behaviour is disabled.
        return;
    }
    String tenantDomain = getTenantDomain();
    // Check there is enough information to publish site activity.
    if (!siteId.equals(WebDAVHelper.EMPTY_SITE_ID)) {
        SiteService siteService = getServiceRegistry().getSiteService();
        NodeRef documentLibrary = siteService.getContainer(siteId, SiteService.DOCUMENT_LIBRARY);
        String parentPath = "/";
        try {
            parentPath = getDAVHelper().getPathFromNode(documentLibrary, parent.getNodeRef());
        } catch (FileNotFoundException error) {
            if (logger.isDebugEnabled()) {
                logger.debug("No " + SiteService.DOCUMENT_LIBRARY + " container found.");
            }
        }
        activityPoster.postFileFolderDeleted(siteId, tenantDomain, parentPath, parent, deletedFile);
    }
}
Also used : WebDavService(org.alfresco.service.cmr.webdav.WebDavService) NodeRef(org.alfresco.service.cmr.repository.NodeRef) SiteService(org.alfresco.service.cmr.site.SiteService) FileNotFoundException(org.alfresco.service.cmr.model.FileNotFoundException)

Example 3 with SiteService

use of org.alfresco.service.cmr.site.SiteService in project alfresco-repository by Alfresco.

the class SiteServiceImplMoreTest method initStaticData.

@BeforeClass
public static void initStaticData() throws Exception {
    AUTHORITY_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("AuthorityService", AuthorityService.class);
    NAMESPACE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("namespaceService", NamespaceService.class);
    NODE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("NodeService", NodeService.class);
    NODE_ARCHIVE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("nodeArchiveService", NodeArchiveService.class);
    SITE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("siteService", SiteService.class);
    COCI_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("checkOutCheckInService", CheckOutCheckInService.class);
    TRANSACTION_HELPER = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
    PERMISSION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("permissionServiceImpl", PermissionService.class);
    AUTHENTICATION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("authenticationService", MutableAuthenticationService.class);
    PERSON_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("PersonService", PersonService.class);
    FILE_FOLDER_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("FileFolderService", FileFolderService.class);
    AUTHENTICATION_COMPONENT = APP_CONTEXT_INIT.getApplicationContext().getBean("authenticationComponent", AuthenticationComponent.class);
    LOCK_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("lockService", LockService.class);
    // We'll create this test content as admin.
    final String admin = AuthenticationUtil.getAdminUserName();
    TEST_SITE_NAME = GUID.generate();
    TEST_SUB_SITE_NAME = GUID.generate();
    final QName subSiteType = QName.createQName("testsite", "testSubsite", NAMESPACE_SERVICE);
    STATIC_TEST_SITES.createSite("sitePreset", TEST_SITE_NAME, "siteTitle", "siteDescription", SiteVisibility.PUBLIC, admin);
    STATIC_TEST_SITES.createSite("sitePreset", TEST_SUB_SITE_NAME, "siteTitle", "siteDescription", SiteVisibility.PUBLIC, subSiteType, admin);
    TEST_SITE_WITH_MEMBERS = STATIC_TEST_SITES.createTestSiteWithUserPerRole(SiteServiceImplMoreTest.class.getSimpleName(), "sitePreset", SiteVisibility.PUBLIC, admin);
}
Also used : LockService(org.alfresco.service.cmr.lock.LockService) RetryingTransactionHelper(org.alfresco.repo.transaction.RetryingTransactionHelper) QName(org.alfresco.service.namespace.QName) AuthorityService(org.alfresco.service.cmr.security.AuthorityService) NodeService(org.alfresco.service.cmr.repository.NodeService) PersonService(org.alfresco.service.cmr.security.PersonService) FileFolderService(org.alfresco.service.cmr.model.FileFolderService) MutableAuthenticationService(org.alfresco.service.cmr.security.MutableAuthenticationService) PermissionService(org.alfresco.service.cmr.security.PermissionService) CheckOutCheckInService(org.alfresco.service.cmr.coci.CheckOutCheckInService) NamespaceService(org.alfresco.service.namespace.NamespaceService) SiteService(org.alfresco.service.cmr.site.SiteService) AuthenticationComponent(org.alfresco.repo.security.authentication.AuthenticationComponent) NodeArchiveService(org.alfresco.repo.node.archive.NodeArchiveService) BeforeClass(org.junit.BeforeClass)

Example 4 with SiteService

use of org.alfresco.service.cmr.site.SiteService in project alfresco-repository by Alfresco.

the class InviteModeratedSenderTest method mockServices.

/**
 * @return ServiceRegistry
 */
private ServiceRegistry mockServices() {
    ActionService mockActionService = mockActionService();
    NodeService mockNodeService = mockNodeService();
    PersonService mockPersonService = mockPersonService();
    SearchService mockSearchService = mockSearchService();
    SiteService mockSiteService = mockSiteService();
    FileFolderService mockFileFolderService = mockFileFolderService();
    ServiceRegistry services = mock(ServiceRegistry.class);
    when(services.getActionService()).thenReturn(mockActionService);
    when(services.getNodeService()).thenReturn(mockNodeService);
    when(services.getPersonService()).thenReturn(mockPersonService);
    when(services.getSearchService()).thenReturn(mockSearchService);
    when(services.getSiteService()).thenReturn(mockSiteService);
    when(services.getFileFolderService()).thenReturn(mockFileFolderService);
    return services;
}
Also used : SiteService(org.alfresco.service.cmr.site.SiteService) NodeService(org.alfresco.service.cmr.repository.NodeService) PersonService(org.alfresco.service.cmr.security.PersonService) SearchService(org.alfresco.service.cmr.search.SearchService) FileFolderService(org.alfresco.service.cmr.model.FileFolderService) ServiceRegistry(org.alfresco.service.ServiceRegistry) ActionService(org.alfresco.service.cmr.action.ActionService)

Example 5 with SiteService

use of org.alfresco.service.cmr.site.SiteService in project alfresco-repository by Alfresco.

the class InviteModeratedSenderTest method mockSiteService.

/**
 * Mocks up a SiteService that returns appropriate SiteInfo.
 *
 * @return SiteService
 */
private SiteService mockSiteService() {
    SiteService siteService = mock(SiteService.class);
    when(siteInfo.getTitle()).thenReturn(fullSiteName);
    when(siteService.getSite(shortSiteName)).thenReturn(siteInfo);
    return siteService;
}
Also used : SiteService(org.alfresco.service.cmr.site.SiteService)

Aggregations

SiteService (org.alfresco.service.cmr.site.SiteService)19 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)8 NodeRef (org.alfresco.service.cmr.repository.NodeRef)7 NodeService (org.alfresco.service.cmr.repository.NodeService)6 SiteInfo (org.alfresco.service.cmr.site.SiteInfo)6 PersonService (org.alfresco.service.cmr.security.PersonService)4 ActionService (org.alfresco.service.cmr.action.ActionService)3 CheckOutCheckInService (org.alfresco.service.cmr.coci.CheckOutCheckInService)3 FileFolderService (org.alfresco.service.cmr.model.FileFolderService)3 FileNotFoundException (org.alfresco.service.cmr.model.FileNotFoundException)3 QName (org.alfresco.service.namespace.QName)3 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)2 NodeArchiveService (org.alfresco.repo.node.archive.NodeArchiveService)2 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)2 ServiceRegistry (org.alfresco.service.ServiceRegistry)2 SearchService (org.alfresco.service.cmr.search.SearchService)2 AuthorityService (org.alfresco.service.cmr.security.AuthorityService)2 VersionService (org.alfresco.service.cmr.version.VersionService)2 WebDavService (org.alfresco.service.cmr.webdav.WebDavService)2 BeforeClass (org.junit.BeforeClass)2