mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +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:
@@ -17,6 +17,7 @@
|
||||
<property name="recordsManagementService" ref="RecordsManagementService"/>
|
||||
<property name="recordService" ref="RecordService" />
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="applicableTypes">
|
||||
<list>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}content</value>
|
||||
|
@@ -482,6 +482,7 @@
|
||||
<property name="nodeService" ref="NodeService"/>
|
||||
<property name="policyComponent" ref="policyComponent"/>
|
||||
<property name="recordsManagementService" ref="RecordsManagementService"/>
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
</bean>
|
||||
|
||||
<bean id="FilePlanPermissionService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
|
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
@@ -64,6 +65,9 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
||||
/** Node service */
|
||||
private NodeService nodeService;
|
||||
|
||||
/** File plan service */
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
/**
|
||||
* @param recordsManagementService records management service
|
||||
*/
|
||||
@@ -88,6 +92,14 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -133,7 +145,7 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
||||
else
|
||||
{
|
||||
// verify that the provided file plan is actually a file plan
|
||||
if (recordsManagementService.isFilePlan(filePlan) == false)
|
||||
if (filePlanService.isFilePlan(filePlan) == false)
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
|
@@ -45,7 +45,8 @@ public class DeleteLinksCapability extends DeclarativeCapability
|
||||
*/
|
||||
public int evaluate(NodeRef source, NodeRef target)
|
||||
{
|
||||
if (rmService.isFilePlan(source) == true && rmService.isFilePlan(target) == true)
|
||||
if (rmService.isFilePlanComponent(source) == true &&
|
||||
rmService.isFilePlanComponent(target) == true)
|
||||
{
|
||||
if (checkConditions(source) == true && checkConditions(target) == true)
|
||||
{
|
||||
|
@@ -24,6 +24,7 @@ import java.util.Set;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
@@ -59,6 +60,9 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
||||
|
||||
/** Node service */
|
||||
private NodeService nodeService;
|
||||
|
||||
/** File plan service */
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(FilePlanPermissionServiceImpl.class);
|
||||
@@ -109,6 +113,14 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
||||
{
|
||||
this.recordsManagementService = recordsManagementService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param childAssocRef
|
||||
@@ -127,7 +139,7 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
||||
public Object doWork()
|
||||
{
|
||||
boolean fillingOnly = false;
|
||||
if (recordsManagementService.isFilePlan(parentNodeRef) == true)
|
||||
if (filePlanService.isFilePlan(parentNodeRef) == true)
|
||||
{
|
||||
fillingOnly = true;
|
||||
}
|
||||
@@ -239,7 +251,7 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
||||
{
|
||||
public Boolean doWork() throws Exception
|
||||
{
|
||||
if (recordsManagementService.isFilePlan(nodeRef) == true)
|
||||
if (filePlanService.isFilePlan(nodeRef) == true)
|
||||
{
|
||||
setPermissionDown(nodeRef, authority, permission);
|
||||
}
|
||||
@@ -276,7 +288,7 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
||||
{
|
||||
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
|
||||
if (parent != null &&
|
||||
recordsManagementService.isFilePlan(parent) == false)
|
||||
filePlanService.isFilePlan(parent) == false)
|
||||
{
|
||||
setPermissionImpl(parent, authority, RMPermissionModel.READ_RECORDS);
|
||||
setReadPermissionUp(parent, authority);
|
||||
|
@@ -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