mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
@@ -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_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 PROP_ORIGINATOR = QName.createQName(DOD_URI, "originator");
|
||||
public static final QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(DOD_URI, "originatingOrganization");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -19,6 +19,7 @@
|
||||
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.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||
@@ -39,17 +40,17 @@ public class DOD5015RecordAspect extends BaseBehaviourBean
|
||||
implements NodeServicePolicies.OnAddAspectPolicy,
|
||||
DOD5015Model
|
||||
{
|
||||
/** indicates whether the DOD record aspect should be added or not */
|
||||
private boolean addDODRecordAspect = true;
|
||||
|
||||
/**
|
||||
* @param addDODRecordAspect true if add aspect, false otherwise
|
||||
*/
|
||||
public void setAddDODRecordAspect(boolean addDODRecordAspect)
|
||||
{
|
||||
this.addDODRecordAspect = addDODRecordAspect;
|
||||
}
|
||||
|
||||
/** file plan service */
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the DOD record aspect meta-data is applied.
|
||||
*
|
||||
@@ -64,12 +65,30 @@ public class DOD5015RecordAspect extends BaseBehaviourBean
|
||||
@Override
|
||||
public void onAddAspect(NodeRef nodeRef, QName aspect)
|
||||
{
|
||||
if (nodeService.exists(nodeRef) == true &&
|
||||
addDODRecordAspect == true &&
|
||||
nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) == false)
|
||||
if (nodeService.exists(nodeRef) &&
|
||||
nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) == false &&
|
||||
isDODFilePlan(nodeRef))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
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.SiteVisibility;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
|
||||
/**
|
||||
@@ -62,6 +64,7 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
/** Constant values */
|
||||
public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary";
|
||||
public static final String DEFAULT_SITE_NAME = "rm";
|
||||
public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN;
|
||||
|
||||
/** Policy component */
|
||||
protected PolicyComponent policyComponent;
|
||||
@@ -75,6 +78,9 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
/** Capability service */
|
||||
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
|
||||
* @param policyComponent policy component
|
||||
@@ -108,6 +114,36 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
{
|
||||
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)
|
||||
@@ -139,7 +175,7 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
if (siteInfo != null)
|
||||
{
|
||||
// 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
|
||||
recordsManagementSearchService.addReports(siteInfo.getShortName());
|
||||
@@ -149,6 +185,30 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user