RM-1147: A user can create a 'vanilla' or DOD compliant records management site

* RM-1178: Add DOD site and file plan types to DOD specific content model
 * RM-1179: Extend create site dialog to set allow creation of DOD compliant RM site
 * RM-1180: Create a patch to update all existing file plans to be, by default, DOD compliant




git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@60943 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2014-02-03 05:28:56 +00:00
parent 09d63b8f86
commit 45f47af6a9
13 changed files with 486 additions and 61 deletions

View File

@@ -5,9 +5,6 @@ rm.ghosting.enabled=true
rm.notification.role=RecordsManager rm.notification.role=RecordsManager
# NOTE: the notification subject can now be set within the usual I18N property files per notification template # NOTE: the notification subject can now be set within the usual I18N property files per notification template
# Automatic addition of DOD record meta-data
rm.dodRecords=true
# #
# Turn off imap server attachments if we are using RM. # Turn off imap server attachments if we are using RM.
# TODO : Longer term needs to have a query based, dynamic # TODO : Longer term needs to have a query based, dynamic

View File

@@ -26,6 +26,11 @@
</property> </property>
</bean> </bean>
<!-- Bootstrap DOD file plan type -->
<bean id="org_alfresco_module_rm_filePlanBootstrap.dod5015" class="org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015FilePlanTypeBootstrap" init-method="init">
<property name="rmSiteType" ref="rma.rmSite"/>
</bean>
<!-- add publication date as a disposition property --> <!-- add publication date as a disposition property -->
<bean id="disposition.properties.publicationdate" parent="disposition.properties.base"> <bean id="disposition.properties.publicationdate" parent="disposition.properties.base">
<property name="name" value="dod:publicationDate" /> <property name="name" value="dod:publicationDate" />
@@ -37,7 +42,7 @@
<!-- Model behaviour --> <!-- Model behaviour -->
<bean id="dod.dod5015RecordAspect" class="org.alfresco.module.org_alfresco_module_rm.dod5015.model.dod.aspect.DOD5015RecordAspect" parent="rm.baseBehaviour"> <bean id="dod.dod5015RecordAspect" class="org.alfresco.module.org_alfresco_module_rm.dod5015.model.dod.aspect.DOD5015RecordAspect" parent="rm.baseBehaviour">
<property name="addDODRecordAspect" value="${rm.dodRecords}"/> <property name="filePlanService" ref="filePlanService"/>
</bean> </bean>
</beans> </beans>

View File

@@ -48,6 +48,20 @@
<types> <types>
<!-- DOD5015 site -->
<!-- @since 2.2 -->
<type name="dod:site">
<title>DOD5015 Site</title>
<parent>rma:rmsite</parent>
</type>
<!-- DOD5015 file plan -->
<!-- @since 2.2 -->
<type name="dod:filePlan">
<title>DOD5015 File Plan</title>
<parent>rma:filePlan</parent>
</type>
<!-- Deprecated since 2.0 --> <!-- Deprecated since 2.0 -->
<type name="dod:recordSeries"> <type name="dod:recordSeries">
<title>Record Series</title> <title>Record Series</title>

View File

@@ -1,5 +1,11 @@
dod_dod5015.description=DOD5015 Content Model dod_dod5015.description=DOD5015 Content Model
dod_dod5015.type.dod_site.title=DOD5015 Site
dod_dod5015.type.dod_site.description=DOD5015 Site
dod_dod5015.type.dod_filePlan.title=DOD5015 File Plan
dod_dod5015.type.dod_filePlan.description=DOD5015 File Plan
dod_dod5015.type.dod_recordSeries.title=Record Series (Deprecated) dod_dod5015.type.dod_recordSeries.title=Record Series (Deprecated)
dod_dod5015.type.dod_recordSeries.description=Record Series (Deprecated) dod_dod5015.type.dod_recordSeries.description=Record Series (Deprecated)

View File

@@ -9,7 +9,7 @@
<property name="description" value="RM patch executer"/> <property name="description" value="RM patch executer"/>
<property name="sinceVersion" value="2.2"/> <property name="sinceVersion" value="2.2"/>
<property name="executeOnceOnly" value="false"/> <property name="executeOnceOnly" value="false"/>
<property name="moduleSchema" value="1003"/> <property name="moduleSchema" value="1004"/>
<property name="attributeService" ref="AttributeService" /> <property name="attributeService" ref="AttributeService" />
<property name="dependsOn"> <property name="dependsOn">
<list> <list>

View File

@@ -37,4 +37,13 @@
<property name="nodeDAO" ref="nodeDAO"/> <property name="nodeDAO" ref="nodeDAO"/>
</bean> </bean>
<bean id="rm.dodCompliantSitePatch"
parent="rm.parentModulePatch"
class="org.alfresco.module.org_alfresco_module_rm.patch.v22.RMv22DODCompliantSitePatch">
<property name="description" value="DOD compliant module patch"/>
<property name="fixesToSchema" value="1003"/>
<property name="targetSchema" value="1004"/>
<property name="qnameDAO" ref="qnameDAO"/>
</bean>
</beans> </beans>

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2005-2014 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.dod5015;
import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType;
/**
* Bootstrap bean that registers the dod:filePlan for creation when
* a dod:site is created.
*
* @author Roy Wetherall
* @since 2.2
*/
public class DOD5015FilePlanTypeBootstrap implements DOD5015Model
{
/** RM site type bean */
private RmSiteType rmSiteType;
/**
* @param rmSiteType RM site type bean
*/
public void setRmSiteType(RmSiteType rmSiteType)
{
this.rmSiteType = rmSiteType;
}
/**
* Init method
*/
public void init()
{
// register dod file plan type for the dod site type
rmSiteType.registerFilePlanType(TYPE_DOD_5015_SITE, TYPE_DOD_5015_FILE_PLAN);
}
}

View File

@@ -32,8 +32,13 @@ public interface DOD5015Model
public static final String DOD_URI = "http://www.alfresco.org/model/dod5015/1.0"; public static final String DOD_URI = "http://www.alfresco.org/model/dod5015/1.0";
public static final String DOD_PREFIX = "dod"; public static final String DOD_PREFIX = "dod";
// DOD Record // DOD Site
public static final QName TYPE_DOD_5015_SITE = QName.createQName(DOD_URI, "site");
// DOD File Plan
public static final QName TYPE_DOD_5015_FILE_PLAN = QName.createQName(DOD_URI, "filePlan");
// DOD Record
public static final QName ASPECT_DOD_5015_RECORD = QName.createQName(DOD_URI, "dod5015record"); public static final QName ASPECT_DOD_5015_RECORD = QName.createQName(DOD_URI, "dod5015record");
public static final QName PROP_ORIGINATOR = QName.createQName(DOD_URI, "originator"); public static final QName PROP_ORIGINATOR = QName.createQName(DOD_URI, "originator");
public static final QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(DOD_URI, "originatingOrganization"); public static final QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(DOD_URI, "originatingOrganization");

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2011 Alfresco Software Limited. * Copyright (C) 2005-2014 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -19,6 +19,7 @@
package org.alfresco.module.org_alfresco_module_rm.dod5015.model.dod.aspect; package org.alfresco.module.org_alfresco_module_rm.dod5015.model.dod.aspect;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
@@ -39,15 +40,15 @@ public class DOD5015RecordAspect extends BaseBehaviourBean
implements NodeServicePolicies.OnAddAspectPolicy, implements NodeServicePolicies.OnAddAspectPolicy,
DOD5015Model DOD5015Model
{ {
/** indicates whether the DOD record aspect should be added or not */ /** file plan service */
private boolean addDODRecordAspect = true; private FilePlanService filePlanService;
/** /**
* @param addDODRecordAspect true if add aspect, false otherwise * @param filePlanService file plan service
*/ */
public void setAddDODRecordAspect(boolean addDODRecordAspect) public void setFilePlanService(FilePlanService filePlanService)
{ {
this.addDODRecordAspect = addDODRecordAspect; this.filePlanService = filePlanService;
} }
/** /**
@@ -64,12 +65,30 @@ public class DOD5015RecordAspect extends BaseBehaviourBean
@Override @Override
public void onAddAspect(NodeRef nodeRef, QName aspect) public void onAddAspect(NodeRef nodeRef, QName aspect)
{ {
if (nodeService.exists(nodeRef) == true && if (nodeService.exists(nodeRef) &&
addDODRecordAspect == true && nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) == false &&
nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) == false) isDODFilePlan(nodeRef))
{ {
nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null); nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null);
} }
} }
/**
* Helper method to indicate whether the records file plan is a DOD one or not.
*
* @param record record node reference
* @return boolean true if in DOD file plan, false otherwise
*/
private boolean isDODFilePlan(NodeRef record)
{
boolean result = false;
NodeRef filePlan = filePlanService.getFilePlan(record);
if (filePlan != null && nodeService.exists(filePlan) == true)
{
result = TYPE_DOD_5015_FILE_PLAN.equals(nodeService.getType(filePlan));
}
return result;
}
} }

View File

@@ -19,6 +19,7 @@
package org.alfresco.module.org_alfresco_module_rm.model.rma.type; package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
@@ -42,6 +43,7 @@ import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService; import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.cmr.site.SiteVisibility; import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck;
import org.alfresco.util.PropertyMap; import org.alfresco.util.PropertyMap;
/** /**
@@ -62,6 +64,7 @@ public class RmSiteType extends BaseBehaviourBean
/** Constant values */ /** Constant values */
public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary"; public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary";
public static final String DEFAULT_SITE_NAME = "rm"; public static final String DEFAULT_SITE_NAME = "rm";
public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN;
/** Policy component */ /** Policy component */
protected PolicyComponent policyComponent; protected PolicyComponent policyComponent;
@@ -75,6 +78,9 @@ public class RmSiteType extends BaseBehaviourBean
/** Capability service */ /** Capability service */
protected CapabilityService capabilityService; protected CapabilityService capabilityService;
/** Map of file plan type's key'ed by corresponding site types */
protected Map<QName, QName> mapFilePlanType = new HashMap<QName, QName>(3);
/** /**
* Set the policy component * Set the policy component
* @param policyComponent policy component * @param policyComponent policy component
@@ -109,6 +115,36 @@ public class RmSiteType extends BaseBehaviourBean
this.capabilityService = capabilityService; this.capabilityService = capabilityService;
} }
/**
* Registers a file plan type for a specific site type.
*
* @param siteType siteType sub-type of rma:rmsite
* @param filePlanType filePlanType sub-type of rma:filePlan
* @since 2.2
*/
public void registerFilePlanType(QName siteType, QName filePlanType)
{
ParameterCheck.mandatory("siteType", siteType);
ParameterCheck.mandatory("filePlanType", filePlanType);
// check that the registered site type is a subtype of rma:rmsite
if (dictionaryService.isSubClass(siteType, TYPE_RM_SITE) == false)
{
throw new AlfrescoRuntimeException(
"Can't register site type, because site type is not a sub type of rma:rmsite (siteType=" + siteType.toString() + ")");
}
// check that the registered file plan type is a sub type of rma:filePlan
if (dictionaryService.isSubClass(filePlanType, TYPE_FILE_PLAN) == false)
{
throw new AlfrescoRuntimeException(
"Can't register file plan type, because site type is not a sub type of rma:filePlan (filePlanType=" + filePlanType.toString() + ")");
}
// add site and file plan types to map
mapFilePlanType.put(siteType, filePlanType);
}
/** /**
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef)
*/ */
@@ -139,7 +175,7 @@ public class RmSiteType extends BaseBehaviourBean
if (siteInfo != null) if (siteInfo != null)
{ {
// Create the file plan component // Create the file plan component
siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, TYPE_FILE_PLAN, null); siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null);
// Add the reports // Add the reports
recordsManagementSearchService.addReports(siteInfo.getShortName()); recordsManagementSearchService.addReports(siteInfo.getShortName());
@@ -150,6 +186,30 @@ public class RmSiteType extends BaseBehaviourBean
} }
} }
/**
* Get the file plan type for the given site.
*
* @param siteInfo site info
* @return QName file plan type to create as a container
* @since 2.2
*/
private QName getFilePlanType(SiteInfo siteInfo)
{
ParameterCheck.mandatory("siteInfo", siteInfo);
// set default file plan
QName result = DEFAULT_FILE_PLAN_TYPE;
// check to see if there is an 'override' for the file plan type given the site type
QName siteType = nodeService.getType(siteInfo.getNodeRef());
if (mapFilePlanType.containsKey(siteType) == true)
{
result = mapFilePlanType.get(siteType);
}
return result;
}
/** /**
* Ensure that the visibility of a RM site can not be changed to anything but public. * Ensure that the visibility of a RM site can not be changed to anything but public.
* *

View File

@@ -0,0 +1,68 @@
/*
* Copyright (C) 2005-2014 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.patch.v22;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
import org.alfresco.repo.domain.qname.QNameDAO;
/**
* DOD compliant site patch.
*
* Makes all existing sites of type dod:site to preserve their DOD compliance status.
*
* @author Roy Wetherall
* @since 2.2
*/
public class RMv22DODCompliantSitePatch extends AbstractModulePatch
implements RecordsManagementModel
{
/** QName DAO */
private QNameDAO qnameDAO;
/**
* @param qnameDAO QName DAO
*/
public void setQnameDAO(QNameDAO qnameDAO)
{
this.qnameDAO = qnameDAO;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal()
*/
@Override
public void applyInternal()
{
// ensure all existing sites are of the correct type
if (qnameDAO.getQName(RecordsManagementModel.TYPE_RM_SITE) != null &&
qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_SITE) == null)
{
qnameDAO.updateQName(RecordsManagementModel.TYPE_RM_SITE, DOD5015Model.TYPE_DOD_5015_SITE);
}
// ensure all the existing file plans are of the correct type
if (qnameDAO.getQName(RecordsManagementModel.TYPE_FILE_PLAN) != null &&
qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_FILE_PLAN) == null)
{
qnameDAO.updateQName(RecordsManagementModel.TYPE_FILE_PLAN, DOD5015Model.TYPE_DOD_5015_FILE_PLAN);
}
}
}

View File

@@ -0,0 +1,176 @@
/*
* Copyright (C) 2005-2013 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.dod;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.util.GUID;
/**
* Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site.
*
* @author Roy Wetherall
* @since 2.2
*/
public class RM1147DODRMSiteTest extends BaseRMTestCase implements DOD5015Model
{
/**
* Don't create a RM test site in setup
*/
@Override
protected boolean isRMSiteTest()
{
return false;
}
/**
* Test the creation of a DOD file plan via the file plan service
*/
public void testCreateDODFilePlan()
{
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run() throws Exception
{
return filePlanService.createFilePlan(folder, "myDODfileplan", TYPE_DOD_5015_FILE_PLAN);
}
@Override
public void test(NodeRef filePlan) throws Exception
{
assertNotNull(filePlan);
assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan));
assertTrue(filePlanService.isFilePlanComponent(filePlan));
assertTrue(filePlanService.isFilePlan(filePlan));
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
assertNotNull(filePlanService.getUnfiledContainer(filePlan));
assertNotNull(filePlanService.getHoldContainer(filePlan));
assertNotNull(filePlanService.getTransferContainer(filePlan));
assertTrue(filePlanService.getFilePlans().contains(filePlan));
assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty());
}
});
}
/**
* Test the creation of a DOD site via the site service
*/
public void testCreateDODRMSite()
{
doTestInTransaction(new Test<SiteInfo>()
{
String siteId = GUID.generate();
@Override
public SiteInfo run() throws Exception
{
return siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE);
}
@Override
public void test(SiteInfo siteInfo) throws Exception
{
assertNotNull(siteInfo);
assertEquals(TYPE_DOD_5015_SITE, nodeService.getType(siteInfo.getNodeRef()));
NodeRef filePlan = siteService.getContainer(siteId, "documentLibrary");
assertNotNull(filePlan);
assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan));
assertTrue(filePlanService.isFilePlanComponent(filePlan));
assertTrue(filePlanService.isFilePlan(filePlan));
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
assertNotNull(filePlanService.getUnfiledContainer(filePlan));
assertNotNull(filePlanService.getHoldContainer(filePlan));
assertNotNull(filePlanService.getTransferContainer(filePlan));
assertTrue(filePlanService.getFilePlans().contains(filePlan));
assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty());
}
});
}
/**
* Test to ensure that a record created in the a DOD site does have the DOD meta-data attached
*/
public void testDODRecord()
{
doTestInTransaction(new Test<NodeRef>()
{
String siteId = GUID.generate();
@Override
public NodeRef run() throws Exception
{
siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE);
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
assertNotNull(filePlan);
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
return record;
}
@Override
public void test(NodeRef record) throws Exception
{
assertNotNull(record);
assertTrue(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD));
}
});
}
/**
* Test to ensure a record created in a vanilla site does not have the DOD meta-data attached
*/
public void testVanillaRecord()
{
doTestInTransaction(new Test<NodeRef>()
{
String siteId = GUID.generate();
@Override
public NodeRef run() throws Exception
{
siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE);
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
assertNotNull(filePlan);
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
return record;
}
@Override
public void test(NodeRef record) throws Exception
{
assertNotNull(record);
assertFalse(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD));
}
});
}
}

View File

@@ -253,6 +253,15 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
protected String dmCollaborator; protected String dmCollaborator;
protected NodeRef dmCollaboratorNodeRef; protected NodeRef dmCollaboratorNodeRef;
/**
* Indicates whether this is a RM site test or not. If true then the test RM site is created along with a basic
* file plan structure, otherwise not.
*/
protected boolean isRMSiteTest()
{
return true;
}
/** /**
* Indicates whether this is a multi-hierarchy test or not. If it is then the multi-hierarchy record * Indicates whether this is a multi-hierarchy test or not. If it is then the multi-hierarchy record
* taxonomy test data is loaded. * taxonomy test data is loaded.
@@ -421,7 +430,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
filter.disableBehaviour(); filter.disableBehaviour();
try try
{ {
if (nodeService.exists(filePlan) == true) if (filePlan != null && nodeService.exists(filePlan) == true)
{ {
Set<NodeRef> holds = freezeService.getHolds(filePlan); Set<NodeRef> holds = freezeService.getHolds(filePlan);
for (NodeRef hold : holds) for (NodeRef hold : holds)
@@ -430,13 +439,13 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
} }
} }
if (nodeService.exists(folder) == true) if (folder != null && nodeService.exists(folder) == true)
{ {
// Delete the folder // Delete the folder
nodeService.deleteNode(folder); nodeService.deleteNode(folder);
} }
if (siteService.getSite(siteId) != null) if (siteId != null && siteService.getSite(siteId) != null)
{ {
// Delete the site // Delete the site
siteService.deleteSite(siteId); siteService.deleteSite(siteId);
@@ -474,7 +483,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
{ {
setupTestDataImpl(); setupTestDataImpl();
if (isRecordTest() == true) if (isRecordTest() == true && isRMSiteTest() == true)
{ {
setupTestRecords(); setupTestRecords();
} }
@@ -484,6 +493,8 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
@Override @Override
public void test(Void result) throws Exception public void test(Void result) throws Exception
{
if (isRMSiteTest() == true)
{ {
if (isRecordTest() == true) if (isRecordTest() == true)
{ {
@@ -496,6 +507,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
unfiledContainer = filePlanService.getUnfiledContainer(filePlan); unfiledContainer = filePlanService.getUnfiledContainer(filePlan);
assertNotNull(unfiledContainer); assertNotNull(unfiledContainer);
} }
}
}, AuthenticationUtil.getSystemUserName()); }, AuthenticationUtil.getSystemUserName());
} }
@@ -529,6 +541,8 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true); permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true);
permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true); permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true);
if (isRMSiteTest() == true)
{
siteId = GUID.generate(); siteId = GUID.generate();
siteInfo = siteService.createSite( siteInfo = siteService.createSite(
"rm-site-dashboard", "rm-site-dashboard",
@@ -552,6 +566,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder"); rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder");
assertNotNull("Could not create rm folder", rmFolder); assertNotNull("Could not create rm folder", rmFolder);
} }
}
protected void setupTestRecords() protected void setupTestRecords()
{ {