RM-1095: Fixed failing tests after refactoring RecordsManagementService.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@57919 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2013-11-14 14:53:56 +00:00
parent f9510836fb
commit 9d585a8eec
7 changed files with 50 additions and 21 deletions

View File

@@ -89,7 +89,7 @@ public class DispositionServiceImpl implements
/** Application context */
private ApplicationContext applicationContext;
/** Record Folder Service */
// FIXME
//private RecordFolderService recordFolderService;
@@ -296,7 +296,7 @@ public class DispositionServiceImpl implements
{
// Get the record folders for the record
// FIXME
RecordFolderService recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService");
RecordFolderService recordFolderService = (RecordFolderService)applicationContext.getBean("recordFolderService");
List<NodeRef> recordFolders = recordFolderService.getRecordFolders(nodeRef);
// At this point, we may have disposition instruction objects from 1..n folders.
diNodeRef = dispositionSelectionStrategy.selectDispositionScheduleFrom(recordFolders);
@@ -470,7 +470,7 @@ public class DispositionServiceImpl implements
List<NodeRef> items = filePlanService.getAllContained(rmContainer);
List<NodeRef> result = new ArrayList<NodeRef>(items.size());
// FIXME
RecordFolderService recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService");
RecordFolderService recordFolderService = (RecordFolderService)applicationContext.getBean("recordFolderService");
for (NodeRef item : items)
{
if (recordFolderService.isRecordFolder(item) == true)

View File

@@ -42,6 +42,9 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.ParameterCheck;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.extensions.surf.util.I18NUtil;
/**
@@ -53,6 +56,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
public class RecordFolderServiceImpl extends ServiceBaseImpl
implements RecordFolderService,
RecordsManagementModel,
ApplicationContextAware,
NodeServicePolicies.OnCreateChildAssociationPolicy
{
/** I18N */
@@ -61,6 +65,9 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
private final static String MSG_PARENT_RECORD_FOLDER_TYPE = "rm.service.parent-record-folder-type";
private final static String MSG_RECORD_FOLDER_TYPE = "rm.service.record-folder-type";
/** Application context */
private ApplicationContext applicationContext;
/** Policy component */
private PolicyComponent policyComponent;
@@ -68,10 +75,10 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
private DispositionService dispositionService;
/** Record Service */
private RecordService recordService;
// private RecordService recordService;
/** File Plan Service */
private FilePlanService filePlanService;
// private FilePlanService filePlanService;
/** Behaviours */
private JavaBehaviour onCreateChildAssociation
@@ -102,17 +109,26 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
/**
* @param recordService record service
*/
public void setRecordService(RecordService recordService)
{
this.recordService = recordService;
}
// public void setRecordService(RecordService recordService)
// {
// this.recordService = recordService;
// }
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
// public void setFilePlanService(FilePlanService filePlanService)
// {
// this.filePlanService = filePlanService;
// }
/**
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
this.filePlanService = filePlanService;
this.applicationContext = applicationContext;
}
/**
@@ -215,6 +231,8 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
// Check that each record in the record folder in declared
// FIXME
RecordService recordService = (RecordService) applicationContext.getBean("recordService");
List<NodeRef> records = recordService.getRecords(nodeRef);
for (NodeRef record : records)
{
@@ -266,9 +284,11 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
ParameterCheck.mandatory("rmContainer", rmContainer);
ParameterCheck.mandatoryString("name", name);
ParameterCheck.mandatory("type", type);
ParameterCheck.mandatory("properties", properties);
// "properties" is not mandatory
// Check that we are not trying to create a record folder in a root container
// FIXME
FilePlanService filePlanService = (FilePlanService) applicationContext.getBean("FilePlanService");
if (filePlanService.isFilePlan(rmContainer) == true)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_ROOT));
@@ -337,6 +357,8 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
ParameterCheck.mandatory("record", record);
List<NodeRef> result = new ArrayList<NodeRef>(1);
// FIXME
RecordService recordService = (RecordService) applicationContext.getBean("RecordService");
if (recordService.isRecord(record) == true)
{
List<ChildAssociationRef> assocs = this.nodeService.getParentAssocs(record, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
@@ -351,5 +373,4 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
}
return result;
}
}