mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM: Remove deprecated warnings
* from recent file plan service refactor * also added helper unit test used to generate a capability report git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46462 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.capabilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -29,8 +28,6 @@ import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.permissions.PermissionReference;
|
||||
import org.alfresco.repo.security.permissions.impl.model.PermissionModel;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AccessPermission;
|
||||
@@ -47,16 +44,12 @@ public class CapabilitiesTest extends BaseRMTestCase implements
|
||||
RMPermissionModel, RecordsManagementModel
|
||||
{
|
||||
private NodeRef record;
|
||||
|
||||
private PermissionModel permissionModel;
|
||||
private PermissionService permissionService;
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
permissionModel = (PermissionModel) applicationContext.getBean("permissionsModelDAO");
|
||||
permissionService = (PermissionService) applicationContext.getBean("PermissionService");
|
||||
}
|
||||
|
||||
|
@@ -92,9 +92,9 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
assertTrue("This is a records management root", rmService.isFilePlan(filePlan));
|
||||
assertFalse("This should not be a records management root", rmService.isFilePlan(rmContainer));
|
||||
assertFalse("This should not be a records management root", rmService.isFilePlan(rmFolder));
|
||||
assertTrue("This is a records management root", filePlanService.isFilePlan(filePlan));
|
||||
assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmContainer));
|
||||
assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmFolder));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.util;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.Group;
|
||||
|
||||
|
||||
/**
|
||||
* Utility test case to generate a report of the capabilities in the system.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class GenerateCapabilityReport extends BaseRMTestCase
|
||||
{
|
||||
public void testGetCapability() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
FileWriter writer = new FileWriter("c:\\mywork\\capabilityReport.csv");
|
||||
BufferedWriter out = new BufferedWriter(writer);
|
||||
try
|
||||
{
|
||||
Set<Capability> capabilities = capabilityService.getCapabilities(true);
|
||||
for (Capability capability : capabilities)
|
||||
{
|
||||
Group group = capability.getGroup();
|
||||
String groupId = "none";
|
||||
if (group != null)
|
||||
{
|
||||
groupId = group.getId();
|
||||
}
|
||||
|
||||
out.write(groupId);
|
||||
out.write(",");
|
||||
out.write(capability.getName());
|
||||
out.write(",");
|
||||
out.write(Boolean.toString(capability.isPrivate()));
|
||||
out.write("\n");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user