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);
}
}
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);
}
}
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);
}
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;
}
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;
}
Aggregations