mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged BRANCHES/V2.0 to HEAD:
52115: RM-732: CLONE - "caveat" functionality of the (dod5015) Records Management Module is not cluster-aware 52262: RM-757: Permission confusion after upgrade from 1.0 52264: RM: Unable to set list of values after migration from 1.0->2.0.3 52294: RM-769 (Impossible to add access for several values) 52340: RM: Saved searches where not being upgraded correctly * searches resaved on upgrade (to account for updated model) * searches are public by defalut * relates to RM-758 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@52341 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -121,9 +121,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
private static final String MSG_ERROR_SPLIT_ID = "rm.admin.error-split-id";
|
||||
|
||||
/** Constants */
|
||||
public static final String RMC_CUSTOM_ASSOCS = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customAssocs";
|
||||
public static final String RMC_CUSTOM_ASSOCS = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customAssocs";
|
||||
private static final String CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.class.getName();
|
||||
private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model");
|
||||
private static final String CAPATIBILITY_CUSTOM_CONTRAINT_TYPE = org.alfresco.module.org_alfresco_module_dod5015.caveat.RMListOfValuesConstraint.class.getName();
|
||||
private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model");
|
||||
private static final String PARAM_ALLOWED_VALUES = "allowedValues";
|
||||
private static final String PARAM_CASE_SENSITIVE = "caseSensitive";
|
||||
private static final String PARAM_MATCH_LOGIC = "matchLogic";
|
||||
@@ -1413,7 +1414,9 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
}
|
||||
|
||||
String type = customConstraint.getType();
|
||||
if ((type == null) || (! type.equals(CUSTOM_CONSTRAINT_TYPE)))
|
||||
if (type == null ||
|
||||
(type.equals(CUSTOM_CONSTRAINT_TYPE) == false &&
|
||||
type.equals(CAPATIBILITY_CUSTOM_CONTRAINT_TYPE) == false))
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE));
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -113,11 +113,20 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
|
||||
for (FieldDefinition fieldDef : fieldDefs)
|
||||
{
|
||||
String prefixName = fieldDef.getName();
|
||||
if (prefixName.equals("rma:identifier"))
|
||||
if (prefixName.equals("rma:identifier") == true)
|
||||
{
|
||||
String defaultId = identifierService.generateIdentifier(typeName, null);
|
||||
fieldDef.setDefaultValue(defaultId);
|
||||
}
|
||||
// NOTE: we set these defaults in the form for backwards compatibility reasons (RM-753)
|
||||
else if (prefixName.equals("rma:vitalRecordIndicator") == true)
|
||||
{
|
||||
fieldDef.setDefaultValue(Boolean.FALSE.toString());
|
||||
}
|
||||
else if (prefixName.equals("rma:reviewPeriod") == true)
|
||||
{
|
||||
fieldDef.setDefaultValue("none|0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,11 +18,16 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.patch;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
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.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.Role;
|
||||
import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||
import org.alfresco.repo.domain.qname.QNameDAO;
|
||||
@@ -30,6 +35,8 @@ import org.alfresco.repo.module.AbstractModuleComponent;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.Period;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -53,6 +60,8 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
|
||||
private PatchDAO patchDAO;
|
||||
private NodeDAO nodeDAO;
|
||||
private QNameDAO qnameDAO;
|
||||
private PermissionService permissionService;
|
||||
private RecordsManagementSecurityService recordsManagementSecurityService;
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
@@ -84,6 +93,22 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
|
||||
this.qnameDAO = qnameDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordsManagementSecurityService records management security service
|
||||
*/
|
||||
public void setRecordsManagementSecurityService(RecordsManagementSecurityService recordsManagementSecurityService)
|
||||
{
|
||||
this.recordsManagementSecurityService = recordsManagementSecurityService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permissionService permission service
|
||||
*/
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
|
||||
*/
|
||||
@@ -98,24 +123,53 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
|
||||
Pair<Long, QName> aspectPair = qnameDAO.getQName(ASPECT_FILE_PLAN_COMPONENT);
|
||||
if (aspectPair != null)
|
||||
{
|
||||
List<Long> records = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID());
|
||||
List<Long> filePlanComponents = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID());
|
||||
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(" ... updating " + records.size() + " items" );
|
||||
logger.debug(" ... updating " + filePlanComponents.size() + " items" );
|
||||
}
|
||||
|
||||
behaviourFilter.disableBehaviour();
|
||||
try
|
||||
{
|
||||
for (Long record : records)
|
||||
for (Long filePlanComponent : filePlanComponents)
|
||||
{
|
||||
Pair<Long, NodeRef> recordPair = nodeDAO.getNodePair(record);
|
||||
NodeRef recordNodeRef = recordPair.getSecond();
|
||||
Pair<Long, NodeRef> recordPair = nodeDAO.getNodePair(filePlanComponent);
|
||||
NodeRef filePlanComponentNodeRef = recordPair.getSecond();
|
||||
|
||||
if (nodeService.getProperty(recordNodeRef, PROP_ROOT_NODEREF) == null)
|
||||
NodeRef filePlan = recordsManagementService.getFilePlan(filePlanComponentNodeRef);
|
||||
|
||||
// set the file plan node reference
|
||||
if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null)
|
||||
{
|
||||
nodeService.setProperty(recordNodeRef, PROP_ROOT_NODEREF, recordsManagementService.getFilePlan(recordNodeRef));
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF, filePlan);
|
||||
}
|
||||
|
||||
// only set the rmadmin permissions on record categories, record folders and records
|
||||
FilePlanComponentKind kind = recordsManagementService.getFilePlanComponentKind(filePlanComponentNodeRef);
|
||||
if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) == true ||
|
||||
FilePlanComponentKind.RECORD_FOLDER.equals(kind) == true ||
|
||||
FilePlanComponentKind.RECORD.equals(kind) == true )
|
||||
{
|
||||
// ensure the that the records management role has read and file on the node
|
||||
Role adminRole = recordsManagementSecurityService.getRole(filePlan, "Administrator");
|
||||
if (adminRole != null)
|
||||
{
|
||||
permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||
}
|
||||
|
||||
// ensure that the default vital record default values have been set (RM-753)
|
||||
Serializable vitalRecordIndicator = nodeService.getProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR);
|
||||
if (vitalRecordIndicator == null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR, false);
|
||||
}
|
||||
Serializable reviewPeriod = nodeService.getProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD);
|
||||
if (reviewPeriod == null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD, new Period("none|0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.search.RecordsManagementSearchService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails;
|
||||
import org.alfresco.repo.module.AbstractModuleComponent;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
* RM v2.0 Saved Search Patch
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class RMv2SavedSearchPatch extends AbstractModuleComponent
|
||||
implements BeanNameAware, RecordsManagementModel, DOD5015Model
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(RMv2SavedSearchPatch.class);
|
||||
|
||||
/** RM site id */
|
||||
private static final String RM_SITE_ID = "rm";
|
||||
|
||||
/** Records management search service */
|
||||
private RecordsManagementSearchService recordsManagementSearchService;
|
||||
|
||||
/**
|
||||
* @param recordsManagementSearchService records management search service
|
||||
*/
|
||||
public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService)
|
||||
{
|
||||
this.recordsManagementSearchService = recordsManagementSearchService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
|
||||
*/
|
||||
@Override
|
||||
protected void executeInternal() throws Throwable
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug("RM Module RMv2SavedSearchPatch ...");
|
||||
}
|
||||
|
||||
// get the saved searches
|
||||
List<SavedSearchDetails> savedSearches = recordsManagementSearchService.getSavedSearches(RM_SITE_ID);
|
||||
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(" ... updating " + savedSearches.size() + " saved searches");
|
||||
}
|
||||
|
||||
for (SavedSearchDetails savedSearchDetails : savedSearches)
|
||||
{
|
||||
// re-save each search so that the query is regenerated correctly
|
||||
recordsManagementSearchService.deleteSavedSearch(RM_SITE_ID, savedSearchDetails.getName());
|
||||
recordsManagementSearchService.saveSearch(RM_SITE_ID,
|
||||
savedSearchDetails.getName(),
|
||||
savedSearchDetails.getDescription(),
|
||||
savedSearchDetails.getSearch(),
|
||||
savedSearchDetails.getSearchParameters(),
|
||||
savedSearchDetails.isPublic());
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(" ... complete");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -95,7 +95,7 @@ public class SavedSearchDetails extends ReportDetails
|
||||
private String siteId;
|
||||
|
||||
/** Indicates whether the saved search is public or not */
|
||||
private boolean isPublic;
|
||||
private boolean isPublic = true;
|
||||
|
||||
/** Indicates whether the saved search is a report */
|
||||
private boolean isReport = false;
|
||||
@@ -103,8 +103,10 @@ public class SavedSearchDetails extends ReportDetails
|
||||
/** Namespace service */
|
||||
NamespaceService namespaceService;
|
||||
|
||||
/** Records management search service */
|
||||
RecordsManagementSearchServiceImpl searchService;
|
||||
|
||||
/** Saves search details compatibility */
|
||||
private SavedSearchDetailsCompatibility compatibility;
|
||||
|
||||
/**
|
||||
@@ -178,7 +180,7 @@ public class SavedSearchDetails extends ReportDetails
|
||||
}
|
||||
|
||||
// Determine whether the saved query is public or not
|
||||
boolean isPublic = false;
|
||||
boolean isPublic = true;
|
||||
if (search.has(PUBLIC) == true)
|
||||
{
|
||||
isPublic = search.getBoolean(PUBLIC);
|
||||
|
@@ -78,7 +78,15 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
|
||||
private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef)
|
||||
{
|
||||
Map<QName, Serializable> parentProps = nodeService.getProperties(actionedUponNodeRef);
|
||||
boolean parentVri = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR);
|
||||
|
||||
// parent vital record indicator, default to null if not set
|
||||
boolean parentVri = false;
|
||||
Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR);
|
||||
if (parentVriValue != null)
|
||||
{
|
||||
parentVri = parentVriValue.booleanValue();
|
||||
}
|
||||
|
||||
Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD);
|
||||
|
||||
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
|
@@ -63,6 +63,10 @@ public class VitalRecordDefinitionImpl implements VitalRecordDefinition, Records
|
||||
/* package */ static VitalRecordDefinition create(NodeService nodeService, NodeRef nodeRef)
|
||||
{
|
||||
Boolean enabled = (Boolean)nodeService.getProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR);
|
||||
if (enabled == null)
|
||||
{
|
||||
enabled = Boolean.FALSE;
|
||||
}
|
||||
Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD);
|
||||
return new VitalRecordDefinitionImpl(enabled, reviewPeriod);
|
||||
}
|
||||
|
Reference in New Issue
Block a user