Search in sources :

Example 1 with NodeArchiveService

use of org.alfresco.repo.node.archive.NodeArchiveService 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 2 with NodeArchiveService

use of org.alfresco.repo.node.archive.NodeArchiveService in project alfresco-repository by Alfresco.

the class TemporarySites method after.

@Override
protected void after() {
    final RetryingTransactionHelper transactionHelper = (RetryingTransactionHelper) appContextRule.getApplicationContext().getBean("retryingTransactionHelper");
    final SiteService siteService = appContextRule.getApplicationContext().getBean("siteService", SiteService.class);
    final ActivityPostDAO postDAO = appContextRule.getApplicationContext().getBean("postDAO", ActivityPostDAO.class);
    final NodeArchiveService nodeArchiveService = (NodeArchiveService) appContextRule.getApplicationContext().getBean("nodeArchiveService");
    // Run as admin to ensure all sites can be deleted irrespective of which user created them.
    AuthenticationUtil.runAs(new RunAsWork<Void>() {

        @Override
        public Void doWork() throws Exception {
            transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>() {

                @Override
                public Void execute() throws Throwable {
                    for (SiteInfo site : temporarySites) {
                        final String shortName = site.getShortName();
                        if (siteService.getSite(shortName) != null) {
                            log.debug("Deleting temporary site " + shortName);
                            siteService.deleteSite(shortName);
                        }
                    }
                    for (String username : temporarySiteUsers) {
                        log.debug("Deleting temporary site user " + username);
                        deletePerson(username);
                    }
                    // Clean all the post feeds
                    int deletedCnt = 0;
                    Date keepDate = new Date(System.currentTimeMillis() + (120 * 1000L));
                    for (ActivityPostEntity.STATUS status : ActivityPostEntity.STATUS.values()) {
                        deletedCnt += postDAO.deletePosts(keepDate, status);
                    }
                    log.debug("Deleted " + deletedCnt + " post feeds.");
                    return null;
                }
            });
            transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>() {

                @Override
                public Void execute() throws Throwable {
                    for (SiteInfo site : temporarySites) {
                        log.debug("Purging temporary site from trashcan: " + site.getShortName());
                        nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(site.getNodeRef()));
                    }
                    return null;
                }
            });
            return null;
        }
    }, AuthenticationUtil.getAdminUserName());
}
Also used : SiteInfo(org.alfresco.service.cmr.site.SiteInfo) RetryingTransactionHelper(org.alfresco.repo.transaction.RetryingTransactionHelper) ActivityPostEntity(org.alfresco.repo.domain.activities.ActivityPostEntity) SiteService(org.alfresco.service.cmr.site.SiteService) ActivityPostDAO(org.alfresco.repo.domain.activities.ActivityPostDAO) RetryingTransactionCallback(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback) NodeArchiveService(org.alfresco.repo.node.archive.NodeArchiveService)

Example 3 with NodeArchiveService

use of org.alfresco.repo.node.archive.NodeArchiveService in project alfresco-repository by Alfresco.

the class QuickShareServiceIntegrationTest method findServices.

private static void findServices() {
    ApplicationContext ctx = testContext.getApplicationContext();
    copyService = ctx.getBean("CopyService", CopyService.class);
    nodeService = ctx.getBean("NodeService", NodeService.class);
    directQuickShareService = ctx.getBean("quickShareService", QuickShareService.class);
    quickShareService = ctx.getBean("QuickShareService", QuickShareService.class);
    repository = ctx.getBean("repositoryHelper", Repository.class);
    attributeService = ctx.getBean("AttributeService", AttributeService.class);
    permissionService = ctx.getBean("PermissionService", PermissionService.class);
    nodeArchiveService = ctx.getBean("nodeArchiveService", NodeArchiveService.class);
    scheduledPersistedActionService = ctx.getBean("scheduledPersistedActionService", ScheduledPersistedActionService.class);
    quickShareLinkExpiryActionPersister = ctx.getBean("quickShareLinkExpiryActionPersister", QuickShareLinkExpiryActionPersister.class);
    transactionHelper = ctx.getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
    globalProperties = ctx.getBean("global-properties", Properties.class);
    siteService = (SiteService) ctx.getBean("SiteService");
}
Also used : PermissionService(org.alfresco.service.cmr.security.PermissionService) QuickShareLinkExpiryActionPersister(org.alfresco.service.cmr.quickshare.QuickShareLinkExpiryActionPersister) QuickShareService(org.alfresco.service.cmr.quickshare.QuickShareService) ScheduledPersistedActionService(org.alfresco.service.cmr.action.scheduled.ScheduledPersistedActionService) ApplicationContext(org.springframework.context.ApplicationContext) Repository(org.alfresco.repo.model.Repository) AttributeService(org.alfresco.service.cmr.attributes.AttributeService) RetryingTransactionHelper(org.alfresco.repo.transaction.RetryingTransactionHelper) NodeService(org.alfresco.service.cmr.repository.NodeService) Properties(java.util.Properties) CopyService(org.alfresco.service.cmr.repository.CopyService) NodeArchiveService(org.alfresco.repo.node.archive.NodeArchiveService)

Aggregations

NodeArchiveService (org.alfresco.repo.node.archive.NodeArchiveService)3 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)3 NodeService (org.alfresco.service.cmr.repository.NodeService)2 PermissionService (org.alfresco.service.cmr.security.PermissionService)2 SiteService (org.alfresco.service.cmr.site.SiteService)2 Properties (java.util.Properties)1 ActivityPostDAO (org.alfresco.repo.domain.activities.ActivityPostDAO)1 ActivityPostEntity (org.alfresco.repo.domain.activities.ActivityPostEntity)1 Repository (org.alfresco.repo.model.Repository)1 AuthenticationComponent (org.alfresco.repo.security.authentication.AuthenticationComponent)1 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)1 ScheduledPersistedActionService (org.alfresco.service.cmr.action.scheduled.ScheduledPersistedActionService)1 AttributeService (org.alfresco.service.cmr.attributes.AttributeService)1 CheckOutCheckInService (org.alfresco.service.cmr.coci.CheckOutCheckInService)1 LockService (org.alfresco.service.cmr.lock.LockService)1 FileFolderService (org.alfresco.service.cmr.model.FileFolderService)1 QuickShareLinkExpiryActionPersister (org.alfresco.service.cmr.quickshare.QuickShareLinkExpiryActionPersister)1 QuickShareService (org.alfresco.service.cmr.quickshare.QuickShareService)1 CopyService (org.alfresco.service.cmr.repository.CopyService)1 AuthorityService (org.alfresco.service.cmr.security.AuthorityService)1