mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge branch 'feature/RM-4619_createFolderThroughFTP' into 'master'
RM-4619 - convert the folder nodes before setting identifier See merge request !89
This commit is contained in:
@@ -234,6 +234,11 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
TYPE_RECORD_FOLDER,
|
||||
new JavaBehaviour(this, "recordFolderCreate", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onSetNodeType"),
|
||||
TYPE_RECORD_FOLDER,
|
||||
new JavaBehaviour(this, "convertedToOrFromRecordFolder", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
|
||||
// Vital Records Review Details Rollup
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
|
||||
@@ -428,6 +433,30 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* On update type to or from record folder behaviour implementation
|
||||
* @param nodeRef the updated node
|
||||
* @param oldType the type the node had before update
|
||||
* @param newType the type the node has after update
|
||||
*/
|
||||
public void convertedToOrFromRecordFolder(final NodeRef nodeRef, final QName oldType, final QName newType)
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
// If the node has been updated to a record folder
|
||||
if (newType.equals(TYPE_RECORD_FOLDER) && nodeService.exists(nodeRef))
|
||||
{
|
||||
applySearchAspect(nodeRef);
|
||||
setupDispositionScheduleProperties(nodeRef);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Helper method to setup the disposition schedule properties
|
||||
*
|
||||
|
@@ -65,7 +65,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
implements NodeServicePolicies.OnUpdatePropertiesPolicy,
|
||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||
NodeServicePolicies.OnCreateNodePolicy,
|
||||
NodeServicePolicies.OnAddAspectPolicy,
|
||||
CopyServicePolicies.OnCopyCompletePolicy
|
||||
{
|
||||
/** I18N */
|
||||
@@ -258,7 +258,7 @@ public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
||||
)
|
||||
@Override
|
||||
public void onCreateNode(final ChildAssociationRef childAssocRef)
|
||||
public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName)
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Object>()
|
||||
{
|
||||
@@ -268,10 +268,9 @@ public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
* When creating a new record the identifier is writable to allow the upload in multiple steps.
|
||||
* On transaction commit make the identifier read only (remove the editable aspect).
|
||||
*/
|
||||
NodeRef newNode = childAssocRef.getChildRef();
|
||||
if(nodeService.exists(newNode))
|
||||
if(nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, aspectTypeQName))
|
||||
{
|
||||
nodeService.setProperty(newNode, RecordsManagementModel.PROP_ID_IS_TEMPORARILY_EDITABLE, false);
|
||||
nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_ID_IS_TEMPORARILY_EDITABLE, false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -137,7 +137,7 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
final NodeRef child = childAssocRef.getChildRef();
|
||||
if (nodeService.exists(child))
|
||||
{
|
||||
QName childType = nodeService.getType(child);
|
||||
QName childType = convertNodeToFileplanComponent(childAssocRef);
|
||||
|
||||
// We only care about "folder" or sub-types that are not hidden.
|
||||
// Some modules use hidden files to store information (see RM-3283)
|
||||
@@ -205,4 +205,39 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converted the child node to a fileplan component
|
||||
* The conversion is needed here to be able to generate the identifier
|
||||
* If there is no conversion rule for the created type nothing happens and the current type is returned
|
||||
*
|
||||
* @param childAssocRef reference to the new association
|
||||
* @return the new type of the child node
|
||||
*/
|
||||
protected QName convertNodeToFileplanComponent(final ChildAssociationRef childAssocRef)
|
||||
{
|
||||
NodeRef child = childAssocRef.getChildRef();
|
||||
QName childType = nodeService.getType(child);
|
||||
QName parentType = nodeService.getType(childAssocRef.getParentRef());
|
||||
|
||||
if(childType.equals(ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
if(parentType.equals(TYPE_FILE_PLAN))
|
||||
{
|
||||
nodeService.setType(child, TYPE_RECORD_CATEGORY);
|
||||
return TYPE_RECORD_CATEGORY;
|
||||
}
|
||||
if(parentType.equals(TYPE_RECORD_CATEGORY))
|
||||
{
|
||||
nodeService.setType(child, TYPE_RECORD_FOLDER);
|
||||
return TYPE_RECORD_FOLDER;
|
||||
}
|
||||
if(parentType.equals(TYPE_UNFILED_RECORD_CONTAINER) || parentType.equals(TYPE_UNFILED_RECORD_FOLDER))
|
||||
{
|
||||
nodeService.setType(child, TYPE_UNFILED_RECORD_FOLDER);
|
||||
return TYPE_UNFILED_RECORD_FOLDER;
|
||||
}
|
||||
}
|
||||
return childType;
|
||||
}
|
||||
}
|
||||
|
@@ -76,6 +76,15 @@ public class UnfiledRecordContainerType extends BaseBehaviourBean
|
||||
@Behaviour(kind = BehaviourKind.ASSOCIATION)
|
||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
{
|
||||
// We need to automatically cast the created folder to record folder if it is a plain folder
|
||||
// This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes.
|
||||
// Some modules use hidden folder subtypes to store information (see RM-3283).
|
||||
QName childType = nodeService.getType(childAssocRef.getChildRef());
|
||||
if (childType.equals(ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
nodeService.setType(childAssocRef.getChildRef(), TYPE_UNFILED_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
// check the created child is of an accepted type
|
||||
validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES);
|
||||
}
|
||||
|
@@ -55,6 +55,15 @@ public class UnfiledRecordFolderType extends BaseBehaviourBean
|
||||
@Behaviour(kind = BehaviourKind.ASSOCIATION)
|
||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
{
|
||||
// We need to automatically cast the created folder to record folder if it is a plain folder
|
||||
// This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes.
|
||||
// Some modules use hidden folder subtypes to store information (see RM-3283).
|
||||
QName childType = nodeService.getType(childAssocRef.getChildRef());
|
||||
if (childType.equals(ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
nodeService.setType(childAssocRef.getChildRef(), TYPE_UNFILED_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
// check the created child is of an accepted type
|
||||
validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES);
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.springframework.extensions.webscripts.GUID;
|
||||
|
||||
/**
|
||||
@@ -49,13 +50,30 @@ public class RM4619Test extends BaseRMTestCase
|
||||
*/
|
||||
public void testConvertFolderToCategory() throws Exception
|
||||
{
|
||||
/*
|
||||
* Create a folder in the unfiled record container and check it is immediately converted
|
||||
*/
|
||||
final NodeRef recordCategory = doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
FileInfo info = fileFolderService.create(filePlan, GUID.generate(), TYPE_FOLDER);
|
||||
assertEquals(TYPE_RECORD_CATEGORY, info.getType());
|
||||
assertNotNull(info.getProperties().get(PROP_IDENTIFIER));
|
||||
return info.getNodeRef();
|
||||
}
|
||||
}, ADMIN_USER);
|
||||
|
||||
/*
|
||||
* Check that when the transaction ends the identifier is no longer editable
|
||||
*/
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
FileInfo info = fileFolderService.create(filePlan, GUID.generate(), TYPE_FOLDER);
|
||||
assertEquals(info.getType(), TYPE_RECORD_CATEGORY);
|
||||
assertFalse((Boolean)nodeService.getProperty(recordCategory, PROP_ID_IS_TEMPORARILY_EDITABLE));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -69,13 +87,101 @@ public class RM4619Test extends BaseRMTestCase
|
||||
*/
|
||||
public void testConvertFolderToRecordFolder() throws Exception
|
||||
{
|
||||
/*
|
||||
* Create a folder in a record category and check it is immediately converted
|
||||
*/
|
||||
final NodeRef recordFolder = doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
FileInfo info = fileFolderService.create(rmContainer, GUID.generate(), TYPE_FOLDER);
|
||||
assertEquals(TYPE_RECORD_FOLDER, info.getType());
|
||||
assertNotNull(info.getProperties().get(PROP_IDENTIFIER));
|
||||
return info.getNodeRef();
|
||||
}
|
||||
}, ADMIN_USER);
|
||||
|
||||
/*
|
||||
* Check that when the transaction ends the identifier is no longer editable
|
||||
* And the record folder has the ASPECT_RM_SEARCH aspect
|
||||
*/
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
FileInfo info = fileFolderService.create(rmContainer, GUID.generate(), TYPE_FOLDER);
|
||||
assertEquals(info.getType(), TYPE_RECORD_FOLDER);
|
||||
assertFalse((Boolean)nodeService.getProperty(recordFolder, PROP_ID_IS_TEMPORARILY_EDITABLE));
|
||||
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
|
||||
return null;
|
||||
}
|
||||
|
||||
}, ADMIN_USER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the RM site is created
|
||||
* When we create a regular folder in the unfiled record container
|
||||
* Then the folder is immediately converted to a unfiled record folder
|
||||
*
|
||||
* And when we create another regular folder in that unfiled record folder
|
||||
* Then the folder is also immediately converted to a unfiled record folder
|
||||
*/
|
||||
public void testConvertFolderToUnfiledRecordFolder() throws Exception
|
||||
{
|
||||
/*
|
||||
* Create a folder in the unfiled record container and check it is immediately converted
|
||||
*/
|
||||
final NodeRef folder1 = doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
FileInfo folder = fileFolderService.create(unfiledContainer, GUID.generate(), TYPE_FOLDER);
|
||||
assertEquals(TYPE_UNFILED_RECORD_FOLDER, folder.getType());
|
||||
assertNotNull(folder.getProperties().get(PROP_IDENTIFIER));
|
||||
return folder.getNodeRef();
|
||||
}
|
||||
}, ADMIN_USER);
|
||||
|
||||
/*
|
||||
* Check that when the transaction ends the identified is no longer editable
|
||||
*/
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
assertFalse((Boolean)nodeService.getProperty(folder1, PROP_ID_IS_TEMPORARILY_EDITABLE));
|
||||
return null;
|
||||
}
|
||||
|
||||
}, ADMIN_USER);
|
||||
|
||||
/*
|
||||
* Create a folder in the unfiled record folder and check it is immediately converted
|
||||
*/
|
||||
final NodeRef folder2 = doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
FileInfo folder = fileFolderService.create(folder1, GUID.generate(), TYPE_FOLDER);
|
||||
assertEquals(TYPE_UNFILED_RECORD_FOLDER, folder.getType());
|
||||
assertNotNull(folder.getProperties().get(PROP_IDENTIFIER));
|
||||
return folder.getNodeRef();
|
||||
}
|
||||
}, ADMIN_USER);
|
||||
|
||||
/*
|
||||
* Check that when the transaction ends the identified is no longer editable
|
||||
*/
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
assertFalse((Boolean)nodeService.getProperty(folder2, PROP_ID_IS_TEMPORARILY_EDITABLE));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -27,6 +27,7 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -37,6 +38,7 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
|
||||
@@ -50,29 +52,117 @@ public class RecordsManagementContainerTypeUnitTest extends BaseUnitTest
|
||||
/** test object */
|
||||
private @InjectMocks RecordsManagementContainerType recordManagementContainerType;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
super.before();
|
||||
|
||||
when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_FOLDER)).thenReturn(true);
|
||||
when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false);
|
||||
|
||||
when(mockedDictionaryService.isSubClass(TestModel.NOT_RM_FOLDER_TYPE, ContentModel.TYPE_FOLDER)).thenReturn(true);
|
||||
when(mockedDictionaryService.isSubClass(TestModel.NOT_RM_FOLDER_TYPE, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false);
|
||||
|
||||
when(mockedDictionaryService.isSubClass(TYPE_RECORD_CATEGORY, ContentModel.TYPE_FOLDER)).thenReturn(true);
|
||||
when(mockedDictionaryService.isSubClass(TYPE_RECORD_CATEGORY, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN
|
||||
* Having the Unfilled Record container and a non RM folder subtype node
|
||||
* When adding a child association between the folder and the container
|
||||
* Then the new folder should not be altered
|
||||
*
|
||||
* Outlook creates a hidden folder subtype to store attachments and we don't want to change the type of those folders
|
||||
*/
|
||||
@Test
|
||||
public void testAddHiddenFolderToRMContainer()
|
||||
public void testAddNonRMFolderSubtypeToRMContainer()
|
||||
{
|
||||
/* Having a RM container and a folder with ASPECT_HIDDEN applied */
|
||||
/* Having a RM container and a non RM folder subtype node */
|
||||
NodeRef rmContainer = generateRMContainer();
|
||||
NodeRef rmFolder = generateFolderNode(true);
|
||||
NodeRef folder = generateNonRmFolderSubtypeNode();
|
||||
|
||||
/*
|
||||
* When adding a child association between the folder and the container
|
||||
*/
|
||||
ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmContainer, ContentModel.ASSOC_CONTAINS, rmFolder);
|
||||
ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmContainer, ContentModel.ASSOC_CONTAINS, folder);
|
||||
recordManagementContainerType.onCreateChildAssociation(childAssoc, true);
|
||||
|
||||
/* The type should not be changed and no aspects should be added */
|
||||
verify(mockedNodeService, never()).setType(any(), any());
|
||||
verify(mockedNodeService, never()).addAspect(any(), any(), any());
|
||||
}
|
||||
|
||||
/**
|
||||
* Having the fileplan and a non RM folder node
|
||||
* When adding a child association between the fileplan and the folder
|
||||
* Then the new folder should be converted to a record category
|
||||
*/
|
||||
@Test
|
||||
public void testAddFolderInFilePlan()
|
||||
{
|
||||
NodeRef fileplan = generateNodeRef();
|
||||
when(mockedNodeService.getType(fileplan)).thenReturn(TYPE_FILE_PLAN);
|
||||
NodeRef folder = generateNonRmFolderNode();
|
||||
|
||||
ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, fileplan, ContentModel.ASSOC_CONTAINS, folder);
|
||||
recordManagementContainerType.onCreateChildAssociation(childAssoc, true);
|
||||
|
||||
verify(mockedNodeService).setType(folder, TYPE_RECORD_CATEGORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Having a record category and a non RM folder node
|
||||
* When adding a child association between the record category and the folder
|
||||
* Then the new folder should be converted to a record folder
|
||||
*/
|
||||
@Test
|
||||
public void testAddFolderInRecordCategory()
|
||||
{
|
||||
NodeRef category = generateNodeRef();
|
||||
when(mockedNodeService.getType(category)).thenReturn(TYPE_RECORD_CATEGORY);
|
||||
NodeRef folder = generateNonRmFolderNode();
|
||||
|
||||
ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, category, ContentModel.ASSOC_CONTAINS, folder);
|
||||
recordManagementContainerType.onCreateChildAssociation(childAssoc, true);
|
||||
|
||||
verify(mockedNodeService).setType(folder, TYPE_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Having an unfiled record container and a non RM folder node
|
||||
* When adding a child association between the container and the folder
|
||||
* Then the new folder should be converted to a unfiled record folder
|
||||
*/
|
||||
@Test
|
||||
public void testAddFolderInUnfiledRecordContainer()
|
||||
{
|
||||
NodeRef unfiledRecordContainer = generateNodeRef();
|
||||
when(mockedNodeService.getType(unfiledRecordContainer)).thenReturn(TYPE_UNFILED_RECORD_CONTAINER);
|
||||
NodeRef folder = generateNonRmFolderNode();
|
||||
|
||||
ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, unfiledRecordContainer, ContentModel.ASSOC_CONTAINS, folder);
|
||||
recordManagementContainerType.onCreateChildAssociation(childAssoc, true);
|
||||
|
||||
verify(mockedNodeService).setType(folder, TYPE_UNFILED_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Having an unfiled record folder and a non RM folder node
|
||||
* When adding a child association between the unfiled record folder and the regular folder
|
||||
* Then the new folder should be converted to a unfiled record folder
|
||||
*/
|
||||
@Test
|
||||
public void testAddFolderInUnfiledRecordFolder()
|
||||
{
|
||||
NodeRef unfiledRecordFolder = generateNodeRef();
|
||||
when(mockedNodeService.getType(unfiledRecordFolder)).thenReturn(TYPE_UNFILED_RECORD_FOLDER);
|
||||
NodeRef folder = generateNonRmFolderNode();
|
||||
|
||||
ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, unfiledRecordFolder, ContentModel.ASSOC_CONTAINS, folder);
|
||||
recordManagementContainerType.onCreateChildAssociation(childAssoc, true);
|
||||
|
||||
verify(mockedNodeService).setType(folder, TYPE_UNFILED_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a record management container
|
||||
* @return reference to the generated container
|
||||
@@ -81,39 +171,33 @@ public class RecordsManagementContainerTypeUnitTest extends BaseUnitTest
|
||||
{
|
||||
NodeRef rmContainer = generateNodeRef();
|
||||
when(mockedNodeService.getType(rmContainer)).thenReturn(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER);
|
||||
when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER, TYPE_FILE_PLAN)).thenReturn(false);
|
||||
return rmContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a folder node
|
||||
* @param hasHiddenAspect does the folder node have the aspect ASPECT_HIDDEN
|
||||
* Generates a non RM folder subtype node
|
||||
* @return reference to the created folder
|
||||
*/
|
||||
private NodeRef generateFolderNode(boolean hasHiddenAspect)
|
||||
private NodeRef generateNonRmFolderSubtypeNode()
|
||||
{
|
||||
NodeRef rmFolder = generateNodeRef();
|
||||
when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_FOLDER)).thenReturn(true);
|
||||
when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false);
|
||||
when(mockedNodeService.getType(rmFolder)).thenReturn(ContentModel.TYPE_FOLDER);
|
||||
when(mockedNodeService.exists(rmFolder)).thenReturn(true);
|
||||
when(mockedNodeService.hasAspect(rmFolder, ContentModel.ASPECT_HIDDEN)).thenReturn(hasHiddenAspect);
|
||||
when(mockedNodeService.hasAspect(rmFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false);
|
||||
return rmFolder;
|
||||
NodeRef nonRmFolder = generateNodeRef();
|
||||
|
||||
when(mockedNodeService.getType(nonRmFolder)).thenReturn(TestModel.NOT_RM_FOLDER_TYPE);
|
||||
when(mockedNodeService.exists(nonRmFolder)).thenReturn(true);
|
||||
when(mockedNodeService.hasAspect(nonRmFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false);
|
||||
return nonRmFolder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates a folder node
|
||||
* Generates a non RM folder node
|
||||
* @return reference to the created folder
|
||||
*/
|
||||
private NodeRef generateNonRmFolderNode()
|
||||
{
|
||||
NodeRef nonRmFolder = generateNodeRef();
|
||||
when(mockedDictionaryService.isSubClass(TestModel.NOT_RM_FOLDER_TYPE, ContentModel.TYPE_FOLDER)).thenReturn(true);
|
||||
when(mockedNodeService.getType(nonRmFolder)).thenReturn(TestModel.NOT_RM_FOLDER_TYPE);
|
||||
when(mockedNodeService.exists(nonRmFolder)).thenReturn(true);
|
||||
when(mockedNodeService.hasAspect(nonRmFolder, ContentModel.ASPECT_HIDDEN)).thenReturn(false);
|
||||
when(mockedNodeService.hasAspect(nonRmFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false);
|
||||
return nonRmFolder;
|
||||
NodeRef regularFolder = generateNodeRef();
|
||||
when(mockedNodeService.getType(regularFolder)).thenReturn(ContentModel.TYPE_FOLDER);
|
||||
when(mockedNodeService.exists(regularFolder)).thenReturn(true);
|
||||
when(mockedNodeService.hasAspect(regularFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false);
|
||||
return regularFolder;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user