Search in sources :

Example 6 with SiteService

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

the class SiteTitleDisplayHandler method getDisplayLabel.

@Override
public FacetLabel getDisplayLabel(String value) {
    // Solr returns the site short name encoded
    value = ISO9075.decode(value);
    String title = null;
    if (nonSiteLocationsLabels.containsKey(value)) {
        title = nonSiteLocationsLabels.get(value);
    } else {
        SiteService siteService = serviceRegistry.getSiteService();
        SiteInfo siteInfo = siteService.getSite(value);
        title = siteInfo != null ? siteInfo.getTitle() : value;
    }
    return new FacetLabel(value, title, -1);
}
Also used : SiteInfo(org.alfresco.service.cmr.site.SiteInfo) SiteService(org.alfresco.service.cmr.site.SiteService)

Example 7 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 8 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 9 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)

Example 10 with SiteService

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

the class WebDAVHelper method determineSiteId.

public String determineSiteId(NodeRef rootNodeRef, String path) {
    SiteService siteService = getServiceRegistry().getSiteService();
    String siteId;
    try {
        FileInfo fileInfo = getNodeForPath(rootNodeRef, path);
        siteId = siteService.getSiteShortName(fileInfo.getNodeRef());
        if (siteId == null) {
            throw new RuntimeException("Node is not contained by a site: " + path);
        }
    } catch (Exception error) {
        siteId = EMPTY_SITE_ID;
    }
    return siteId;
}
Also used : SiteService(org.alfresco.service.cmr.site.SiteService) FileInfo(org.alfresco.service.cmr.model.FileInfo) FileNotFoundException(org.alfresco.service.cmr.model.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException)

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