update license header

This commit is contained in:
Sathish Kumar
2025-01-07 11:33:59 +05:30
parent 3f6a1c6880
commit 40c7b5fd9f
99 changed files with 1591 additions and 1369 deletions

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,9 +27,10 @@
package org.alfresco.module.org_alfresco_module_rm;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.service.namespace.QName;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException}
*/
@@ -37,7 +38,7 @@ public class CannotApplyConstraintMetadataException extends CustomMetadataExcept
{
private static final long serialVersionUID = -6194867814140009959L;
public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint";
public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType)
{
super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType));

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -33,7 +33,7 @@ package org.alfresco.module.org_alfresco_module_rm;
public abstract class CustomMetadataException extends Exception
{
private static final long serialVersionUID = -6676112294794381360L;
public CustomMetadataException(String msg)
{
super(msg);

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,9 +27,10 @@
package org.alfresco.module.org_alfresco_module_rm;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.service.namespace.QName;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException}
*/
@@ -37,7 +38,7 @@ public class InvalidCustomAspectMetadataException extends CustomMetadataExceptio
{
private static final long serialVersionUID = -6194867814140009959L;
public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect";
public InvalidCustomAspectMetadataException(QName customAspect, String aspectName)
{
super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName));

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -36,7 +36,7 @@ public class NotCustomisableMetadataException extends CustomMetadataException
{
private static final long serialVersionUID = -6194867814140009959L;
public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable";
public NotCustomisableMetadataException(String aspectName)
{
super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName));

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -37,7 +37,7 @@ public class PropertyAlreadyExistsMetadataException extends CustomMetadataExcept
private static final long serialVersionUID = -6194867814140009959L;
public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists";
public PropertyAlreadyExistsMetadataException(String propIdAsString)
{
super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString));

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -30,8 +30,8 @@ package org.alfresco.module.org_alfresco_module_rm;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService}
*/
public interface RecordsManagementAdminService
extends org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService
public interface RecordsManagementAdminService
extends org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService
{
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -53,10 +53,10 @@ import org.alfresco.service.namespace.QName;
* @deprecated as of 2.2
*/
public class RecordsManagementServiceImpl extends ServiceBaseImpl
implements RecordsManagementService,
RecordsManagementModel
implements RecordsManagementService,
RecordsManagementModel
{
/** Store that the RM roots are contained within */
/** Store that the RM roots are contained within */
@SuppressWarnings("unused")
@Deprecated
private StoreRef defaultStoreRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
@@ -67,7 +67,8 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
/**
* Set the service registry service
*
* @param serviceRegistry service registry
* @param serviceRegistry
* service registry
*/
public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry)
{
@@ -78,7 +79,9 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
/**
* Sets the default RM store reference
* @param defaultStoreRef store reference
*
* @param defaultStoreRef
* store reference
*/
@Deprecated
public void setDefaultStoreRef(StoreRef defaultStoreRef)
@@ -91,7 +94,7 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
*/
private FilePlanService getFilePlanService()
{
return serviceRegistry.getFilePlanService();
return serviceRegistry.getFilePlanService();
}
/**
@@ -425,7 +428,7 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
* @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map)}
*/
@Override
public NodeRef createRecordFolder(NodeRef parent, String name, Map<QName, Serializable> properties)
public NodeRef createRecordFolder(NodeRef parent, String name, Map<QName, Serializable> properties)
{
return getRecordFolderService().createRecordFolder(parent, name, properties);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -45,6 +45,11 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import net.sf.acegisecurity.AccessDeniedException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONException;
import org.json.JSONObject;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic;
@@ -77,10 +82,6 @@ import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.JSONtoFmModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONException;
import org.json.JSONObject;
/**
* RM Caveat Config component impl
@@ -89,9 +90,9 @@ import org.json.JSONObject;
*/
@BehaviourBean(defaultType = "rma:caveatConfig")
public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnContentUpdatePolicy,
NodeServicePolicies.BeforeDeleteNodePolicy,
NodeServicePolicies.OnCreateNodePolicy,
RMCaveatConfigComponent
NodeServicePolicies.BeforeDeleteNodePolicy,
NodeServicePolicies.OnCreateNodePolicy,
RMCaveatConfigComponent
{
private static Log logger = LogFactory.getLog(RMCaveatConfigComponentImpl.class);
@@ -122,12 +123,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
private Lock readLock = lock.readLock();
private Lock writeLock = lock.writeLock();
/*
* Caveat Config (Shared) config
* first string is property name
* second string is authority name (user or group full name)
* third string is list of values of property
*/
/* Caveat Config (Shared) config first string is property name second string is authority name (user or group full name) third string is list of values of property */
private SimpleCache<String, Map<String, List<String>>> caveatConfig;
public void setCaveatConfig(SimpleCache<String, Map<String, List<String>>> caveatConfig)
@@ -194,7 +190,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (logger.isInfoEnabled())
{
logger.info("Caveat aspects configured "+caveatAspectQNames);
logger.info("Caveat aspects configured " + caveatAspectQNames);
}
}
else
@@ -211,7 +207,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (logger.isInfoEnabled())
{
logger.info("Caveat models configured "+caveatModelQNames);
logger.info("Caveat models configured " + caveatModelQNames);
}
}
else
@@ -227,20 +223,17 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
}
/**
* @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean)
* RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted
* @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
@Behaviour(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT)
public void onContentUpdate(NodeRef nodeRef, boolean newContent)
{
if (logger.isInfoEnabled())
{
logger.info("onContentUpdate: "+nodeRef+", "+newContent);
logger.info("onContentUpdate: " + nodeRef + ", " + newContent);
}
validateAndReset(nodeRef);
@@ -255,7 +248,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
if (logger.isInfoEnabled())
{
logger.info("beforeDeleteNode: "+nodeRef);
logger.info("beforeDeleteNode: " + nodeRef);
}
validateAndReset(nodeRef);
@@ -270,7 +263,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
if (logger.isInfoEnabled())
{
logger.info("onCreateNode: "+childAssocRef);
logger.info("onCreateNode: " + childAssocRef);
}
validateAndReset(childAssocRef.getChildRef());
@@ -279,8 +272,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
/**
* Validate the caveat config and optionally update the cache.
*
* @param nodeRef The nodeRef of the config
*/
* @param nodeRef
* The nodeRef of the config
*/
@SuppressWarnings("unchecked")
protected void validateAndReset(NodeRef nodeRef)
{
@@ -294,9 +288,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (caveatConfigData != null)
{
NodeRef existing = getCaveatConfigNode();
if ((existing != null && (! existing.equals(nodeRef))))
if ((existing != null && (!existing.equals(nodeRef))))
{
throw new AlfrescoRuntimeException("Cannot create more than one caveat config (existing="+existing+", new="+nodeRef+")");
throw new AlfrescoRuntimeException("Cannot create more than one caveat config (existing=" + existing + ", new=" + nodeRef + ")");
}
try
@@ -321,7 +315,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (logger.isTraceEnabled())
{
logger.trace("validateAndReset: models to check "+models);
logger.trace("validateAndReset: models to check " + models);
}
for (QName model : models)
@@ -338,7 +332,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
if (logger.isTraceEnabled())
{
logger.trace("validateAndReset: properties to check "+props);
logger.trace("validateAndReset: properties to check " + props);
}
}
@@ -361,12 +355,12 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
}
}
if (! prefixFound)
if (!prefixFound)
{
throw new AlfrescoRuntimeException("Unexpected prefix: "+ conPrefix + " (" + conStr +") expected one of "+expectedPrefixes+")");
throw new AlfrescoRuntimeException("Unexpected prefix: " + conPrefix + " (" + conStr + ") expected one of " + expectedPrefixes + ")");
}
Map<String, List<String>> caveatMap = (Map<String, List<String>>)conEntry.getValue();
Map<String, List<String>> caveatMap = (Map<String, List<String>>) conEntry.getValue();
List<String> allowedValues = null;
@SuppressWarnings("unused")
@@ -381,15 +375,14 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
final Constraint con = conDef.getConstraint();
if (con instanceof RMListOfValuesConstraint)
{
String conName = ((RMListOfValuesConstraint)con).getShortName();
String conName = ((RMListOfValuesConstraint) con).getShortName();
if (conName.equals(conStr))
{
// note: assumes only one caveat/LOV against a given property
allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
{
allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() {
public List<String> doWork()
{
return ((RMListOfValuesConstraint)con).getAllowedValues();
return ((RMListOfValuesConstraint) con).getAllowedValues();
}
}, AuthenticationUtil.getSystemUserName());
@@ -404,7 +397,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
if (logger.isInfoEnabled())
{
logger.info("Processing constraint: "+conQName);
logger.info("Processing constraint: " + conQName);
}
for (Map.Entry<String, List<String>> caveatEntry : caveatMap.entrySet())
@@ -413,20 +406,20 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
List<String> caveatList = caveatEntry.getValue();
// validate authority (user or group) - note: groups are configured with fullname (ie. GROUP_xxx)
if ((! authorityService.authorityExists(authorityName) && ! personService.personExists(authorityName)))
if ((!authorityService.authorityExists(authorityName) && !personService.personExists(authorityName)))
{
// TODO - review warnings (& I18N)
String msg = "User/group does not exist: "+authorityName+" (constraint="+conStr+")";
String msg = "User/group does not exist: " + authorityName + " (constraint=" + conStr + ")";
logger.warn(msg);
}
// validate caveat list
for (String value : caveatList)
{
if (! allowedValues.contains(value))
if (!allowedValues.contains(value))
{
// TODO - review warnings (& add I18N)
String msg = "Invalid value in list: "+value+" (authority="+authorityName+", constraint="+conStr+")";
String msg = "Invalid value in list: " + value + " (authority=" + authorityName + ", constraint=" + conStr + ")";
logger.warn(msg);
}
}
@@ -444,7 +437,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
for (Map.Entry<String, Object> conEntry : caveatConfigMap.entrySet())
{
String conStr = conEntry.getKey();
Map<String, List<String>> caveatMap = (Map<String, List<String>>)conEntry.getValue();
Map<String, List<String>> caveatMap = (Map<String, List<String>>) conEntry.getValue();
Map<String, List<String>> cacheValue = caveatConfig.get(conStr);
if (cacheValue == null || !cacheValue.equals(caveatMap))
@@ -461,7 +454,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
}
catch (JSONException e)
{
throw new AlfrescoRuntimeException("Invalid caveat config syntax: "+e);
throw new AlfrescoRuntimeException("Invalid caveat config syntax: " + e);
}
}
}
@@ -473,7 +466,6 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_CAVEAT_CONFIG, CAVEAT_CONFIG_NAME);
}
public NodeRef updateOrCreateCaveatConfig(InputStream is)
{
NodeRef caveatConfig = getOrCreateCaveatConfig();
@@ -523,9 +515,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
// Create caveat config
caveatConfig = nodeService.createNode(rootNode,
RecordsManagementModel.ASSOC_CAVEAT_CONFIG,
QName.createQName(RecordsManagementModel.RM_URI, CAVEAT_CONFIG_NAME),
RecordsManagementModel.TYPE_CAVEAT_CONFIG).getChildRef();
RecordsManagementModel.ASSOC_CAVEAT_CONFIG,
QName.createQName(RecordsManagementModel.RM_URI, CAVEAT_CONFIG_NAME),
RecordsManagementModel.TYPE_CAVEAT_CONFIG).getChildRef();
nodeService.setProperty(caveatConfig, ContentModel.PROP_NAME, CAVEAT_CONFIG_NAME);
}
@@ -569,7 +561,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
private List<String> getRMAllowedValues(String userName, Set<String> userGroupFullNames, String constraintName)
{
Set<String>allowedValues = new HashSet<>();
Set<String> allowedValues = new HashSet<>();
// note: userName and userGroupNames must not be null
Map<String, List<String>> caveatConstraintDef = null;
@@ -586,22 +578,22 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (caveatConstraintDef != null)
{
List<String> direct = caveatConstraintDef.get(userName);
if(direct != null)
if (direct != null)
{
allowedValues.addAll(direct);
}
for (String group : userGroupFullNames)
for (String group : userGroupFullNames)
{
List<String> values = caveatConstraintDef.get(group);
if(values != null)
if (values != null)
{
allowedValues.addAll(values);
}
}
}
List<String>ret = new ArrayList<>();
List<String> ret = new ArrayList<>();
ret.addAll(allowedValues);
return Collections.unmodifiableList(ret);
}
@@ -617,7 +609,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
try
{
if ((! nodeService.exists(nodeRef)) || (caveatAspectQNames.size() == 0))
if ((!nodeService.exists(nodeRef)) || (caveatAspectQNames.size() == 0))
{
return true;
}
@@ -632,7 +624,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
}
}
if (! found)
if (!found)
{
// no caveat aspect
return true;
@@ -658,7 +650,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
Constraint con = conDef.getConstraint();
if (con instanceof RMListOfValuesConstraint)
{
RMListOfValuesConstraint rmCon = ((RMListOfValuesConstraint)con);
RMListOfValuesConstraint rmCon = ((RMListOfValuesConstraint) con);
String conName = rmCon.getShortName();
MatchLogic matchLogic = rmCon.getMatchLogicEnum();
Map<String, List<String>> caveatConstraintDef = caveatConfig.get(conName);
@@ -676,18 +668,18 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (val instanceof String)
{
propValues = new ArrayList<>(1);
propValues.add((String)val);
propValues.add((String) val);
}
else if (val instanceof List)
{
propValues = (List<String>)val;
propValues = (List<String>) val;
}
if (propValues != null && !isAllowed(propValues, allowedValues, matchLogic))
{
if (logger.isDebugEnabled())
{
logger.debug("Veto access: caveat="+conName+", userName="+userName+", nodeRef="+nodeRef+", propName="+propName+", propValues="+propValues+", allowedValues="+allowedValues);
logger.debug("Veto access: caveat=" + conName + ", userName=" + userName + ", nodeRef=" + nodeRef + ", propName=" + propName + ", propValues=" + propValues + ", allowedValues=" + allowedValues);
}
return false;
}
@@ -714,11 +706,11 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
// check user/group values match all values on node
for (String propValue : propValues)
{
if (! userGroupValues.contains(propValue))
if (!userGroupValues.contains(propValue))
{
if (logger.isTraceEnabled())
{
logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic);
logger.trace("Not allowed: " + propValues + ", " + userGroupValues + ", " + matchLogic);
}
return false;
@@ -740,23 +732,25 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (logger.isTraceEnabled())
{
logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic);
logger.trace("Not allowed: " + propValues + ", " + userGroupValues + ", " + matchLogic);
}
return false;
}
logger.error("Unexpected match logic type: "+matchLogic);
logger.error("Unexpected match logic type: " + matchLogic);
return false;
}
/**
* Add a single value to an authority in a list. The existing values of the list remain.
* Add a single value to an authority in a list. The existing values of the list remain.
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param authorityName
* @param value
* @throws AlfrescoRuntimeException if either the list or the authority do not already exist.
* @throws AlfrescoRuntimeException
* if either the list or the authority do not already exist.
*/
public void addRMConstraintListValue(String listName, String authorityName, String value)
{
@@ -765,9 +759,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
readLock.lock();
members = caveatConfig.get(listName);
if(members == null)
if (members == null)
{
throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName);
throw new AlfrescoRuntimeException("unable to add to list, list not defined:" + listName);
}
try
@@ -776,15 +770,15 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
writeLock.lock();
// check again
members = caveatConfig.get(listName);
if(members == null)
if (members == null)
{
throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName);
throw new AlfrescoRuntimeException("unable to add to list, list not defined:" + listName);
}
List<String> values = members.get(authorityName);
if(values == null)
if (values == null)
{
throw new AlfrescoRuntimeException("Unable to add to authority in list. Authority not member listName: "+ listName + " authorityName:" +authorityName);
throw new AlfrescoRuntimeException("Unable to add to authority in list. Authority not member listName: " + listName + " authorityName:" + authorityName);
}
values.add(value);
@@ -806,6 +800,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
/**
* Get the member details of the specified list
*
* @param listName
* @return the details of the specified list
*/
@@ -837,23 +832,23 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
}
/**
* Replace the values for an authority in a list.
* The existing values are removed.
* Replace the values for an authority in a list. The existing values are removed.
*
* If the authority does not already exist in the list, it will be added
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param authorityName
* @param values
*/
public void updateRMConstraintListAuthority(String listName, String authorityName, List<String>values)
public void updateRMConstraintListAuthority(String listName, String authorityName, List<String> values)
{
Map<String, List<String>> members = null;
try
{
writeLock.lock();
members = caveatConfig.get(listName);
if(members == null)
if (members == null)
{
// Create the new list, with the authority name
Map<String, List<String>> constraint = new HashMap<>(0);
@@ -881,7 +876,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
* @param valueName
* @param authorities
*/
public void updateRMConstraintListValue(String listName, String valueName, List<String>authorities)
public void updateRMConstraintListValue(String listName, String valueName, List<String> authorities)
{
Map<String, List<String>> members = caveatConfig.get(listName);
@@ -889,7 +884,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
writeLock.lock();
if(members == null)
if (members == null)
{
// Members List does not exist
Map<String, List<String>> emptyConstraint = new HashMap<>(0);
@@ -903,21 +898,21 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
// remove all authorities which have this value
List<String> existingAuthorities = pivot.get(valueName);
if(existingAuthorities != null)
if (existingAuthorities != null)
{
for(String authority : existingAuthorities)
for (String authority : existingAuthorities)
{
List<String> vals = members.get(authority);
vals.remove(valueName);
}
}
// add the new authorities for this value
for(String authority : authorities)
for (String authority : authorities)
{
List<String> vals = members.get(authority);
if(vals == null)
if (vals == null)
{
vals= new ArrayList<>();
vals = new ArrayList<>();
members.put(authority, vals);
}
vals.add(valueName);
@@ -955,9 +950,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
// remove all authorities which have this value
List<String> existingAuthorities = pivot.get(valueName);
if(existingAuthorities != null)
if (existingAuthorities != null)
{
for(String authority : existingAuthorities)
for (String authority : existingAuthorities)
{
List<String> vals = members.get(authority);
vals.remove(valueName);
@@ -984,7 +979,8 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
/**
* Remove an authority from a list
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param authorityName
*/
public void removeRMConstraintListAuthority(String listName, String authorityName)
@@ -994,7 +990,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
writeLock.lock();
members = caveatConfig.get(listName);
if(members != null)
if (members != null)
{
members.remove(listName);
}
@@ -1007,10 +1003,11 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
{
writeLock.unlock();
}
}
}
/**
* @param config the configuration to convert
* @param config
* the configuration to convert
* @return a String containing the JSON representation of the configuration.
*/
private String convertToJSONString(SimpleCache<String, Map<String, List<String>>> config)
@@ -1070,24 +1067,24 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
/**
* Get an RMConstraintInfo
*
* @param listQName
* @return the constraint or null if it does not exist
*/
public RMConstraintInfo getRMConstraint(QName listQName)
{
ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName);
if(dictionaryDef != null)
if (dictionaryDef != null)
{
Constraint con = dictionaryDef.getConstraint();
if (con instanceof RMListOfValuesConstraint)
{
final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con;
final RMListOfValuesConstraint def = (RMListOfValuesConstraint) con;
RMConstraintInfo info = new RMConstraintInfo();
info.setName(listQName.toPrefixString());
info.setTitle(con.getTitle());
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
{
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() {
public List<String> doWork()
{
return def.getAllowedValues();

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -42,6 +42,7 @@ public interface RMCaveatConfigService
/**
* Get allowed values for given caveat list (for current user)
*
* @param constraintName
* @return
*/
@@ -55,18 +56,15 @@ public interface RMCaveatConfigService
*/
boolean hasAccess(NodeRef nodeRef);
/*
* Get a single RM constraint
*/
/* Get a single RM constraint */
RMConstraintInfo getRMConstraint(String listName);
/*
* Get the names of all the caveat lists
*/
/* Get the names of all the caveat lists */
Set<RMConstraintInfo> getAllRMConstraints();
/**
* Get the details of a caveat list
*
* @param listName
* @return
*/
@@ -80,79 +78,90 @@ public interface RMCaveatConfigService
/**
* add RM constraint list
* @param listName the name of the RMConstraintList
*
* @param listName
* the name of the RMConstraintList
* @param listTitle
*/
RMConstraintInfo addRMConstraint(String listName, String listTitle, String[] allowedValues);
/**
* update RM constraint list allowed values
* @param listName the name of the RMConstraintList - can not be changed
*
* @param listName
* the name of the RMConstraintList - can not be changed
* @param allowedValues
*/
RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues);
/**
* update RM constraint Title
* @param listName the name of the RMConstraintList - can not be changed
* @param newTitle the new value for the title constraint
*
* @param listName
* the name of the RMConstraintList - can not be changed
* @param newTitle
* the new value for the title constraint
*/
RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle);
/**
* delete RM Constraint
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
*/
void deleteRMConstraint(String listName);
/**
* Add a single value to an authority in a list. The existing values of the list remain.
* Add a single value to an authority in a list. The existing values of the list remain.
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param authorityName
* @param value
* @throws AlfrescoRuntimeException if either the list or the authority do not already exist.
* @throws AlfrescoRuntimeException
* if either the list or the authority do not already exist.
*/
void addRMConstraintListValue(String listName, String authorityName, String value);
/**
* Replace the values for an authority in a list.
* The existing values are removed.
* Replace the values for an authority in a list. The existing values are removed.
*
* If the authority does not already exist in the list, it will be added
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param authorityName
* @param values
*/
void updateRMConstraintListAuthority(String listName, String authorityName, List<String>values);
void updateRMConstraintListAuthority(String listName, String authorityName, List<String> values);
/**
* Remove an authority from a list
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param authorityName
*/
void removeRMConstraintListAuthority(String listName, String authorityName);
/**
* Replace the values for an authority in a list.
* The existing values are removed.
* Replace the values for an authority in a list. The existing values are removed.
*
* If the authority does not already exist in the list, it will be added
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param value
* @param authorities
*/
void updateRMConstraintListValue(String listName, String value, List<String>authorities);
void updateRMConstraintListValue(String listName, String value, List<String> authorities);
/**
* Remove an authority from a list
*
* @param listName the name of the RMConstraintList
* @param listName
* the name of the RMConstraintList
* @param valueName
*/
void removeRMConstraintListValue(String listName, String valueName);

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -40,30 +40,37 @@ public class RMConstraintInfo
{
this.name = name;
}
public String getName()
{
return name;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setCaseSensitive(boolean caseSensitive)
{
this.caseSensitive = caseSensitive;
}
public boolean isCaseSensitive()
{
return caseSensitive;
}
public void setAllowedValues(String[] values)
{
this.allowedValues = values.clone();
}
public String[] getAllowedValues()
{
return allowedValues;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -33,18 +33,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.dictionary.ConstraintException;
import org.alfresco.service.cmr.i18n.MessageLookup;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* RM Constraint implementation that ensures the value is one of a constrained
* <i>list of values</i>. By default, this constraint is case-sensitive.
* RM Constraint implementation that ensures the value is one of a constrained <i>list of values</i>. By default, this constraint is case-sensitive.
*
* @see #setAllowedValues(List)
* @see #setCaseSensitive(boolean)
@@ -63,7 +63,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
{
// closed marking - all values must match
AND,
// open marking - at least one value must match
// open marking - at least one value must match
OR
}
@@ -75,17 +75,16 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
RMListOfValuesConstraint.caveatConfigService = caveatConfigService;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(80);
sb.append("RMListOfValuesConstraint")
.append("[allowedValues=").append(getAllowedValues())
.append(", caseSensitive=").append(isCaseSensitive())
.append(", sorted=").append(isSorted())
.append(", matchLogic=").append(getMatchLogic())
.append("]");
.append("[allowedValues=").append(getAllowedValues())
.append(", caseSensitive=").append(isCaseSensitive())
.append(", sorted=").append(isSorted())
.append(", matchLogic=").append(getMatchLogic())
.append("]");
return sb.toString();
}
@@ -98,8 +97,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
}
/**
* Get the allowed values. Note that these are <tt>String</tt> instances, but may
* represent non-<tt>String</tt> values. It is up to the caller to distinguish.
* Get the allowed values. Note that these are <tt>String</tt> instances, but may represent non-<tt>String</tt> values. It is up to the caller to distinguish.
*
* @return Returns the values allowed
*/
@@ -107,7 +105,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
public List<String> getRawAllowedValues()
{
String runAsUser = AuthenticationUtil.getRunAsUser();
if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
if ((runAsUser != null) && (!runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
{
// get allowed values for current user
List<String> allowedForUser = caveatConfigService.getRMAllowedValues(getShortName());
@@ -148,7 +146,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
private List<String> getAllowedValuesUpper()
{
String runAsUser = AuthenticationUtil.getRunAsUser();
if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
if ((runAsUser != null) && (!runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
{
// get allowed values for current user
List<String> allowedForUser = caveatConfigService.getRMAllowedValues(getType());
@@ -169,12 +167,14 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
return this.allowedValuesUpper;
}
}
/**
* Set the values that are allowed by the constraint.
*
* @param allowedValues a list of allowed values
* @param allowedValues
* a list of allowed values
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void setAllowedValues(List allowedValues)
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -35,14 +35,15 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.service.cmr.security.AuthorityService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.alfresco.service.cmr.security.AuthorityService;
public class ScriptConstraint implements Serializable
{
/**
/**
*
*/
private static final long serialVersionUID = 1L;
@@ -64,10 +65,12 @@ public class ScriptConstraint implements Serializable
{
info.setTitle(title);
}
public String getTitle()
{
return info.getTitle();
}
public void setName(String name)
{
info.setName(name);
@@ -90,22 +93,22 @@ public class ScriptConstraint implements Serializable
public ScriptConstraintAuthority[] getAuthorities()
{
Map<String, List<String>> values = rmCaveatconfigService.getListDetails(info.getName());
Map<String, List<String>> values = rmCaveatconfigService.getListDetails(info.getName());
if (values == null)
{
return new ScriptConstraintAuthority[0];
}
if (values == null)
{
return new ScriptConstraintAuthority[0];
}
ArrayList<ScriptConstraintAuthority> constraints = new ArrayList<>(values.size());
ArrayList<ScriptConstraintAuthority> constraints = new ArrayList<>(values.size());
for (Map.Entry<String, List<String>> entry : values.entrySet())
{
ScriptConstraintAuthority constraint = new ScriptConstraintAuthority();
constraint.setAuthorityName(entry.getKey());
constraint.setValues(entry.getValue());
constraints.add(constraint);
}
return constraints.toArray(new ScriptConstraintAuthority[constraints.size()]);
{
ScriptConstraintAuthority constraint = new ScriptConstraintAuthority();
constraint.setAuthorityName(entry.getKey());
constraint.setValues(entry.getValue());
constraints.add(constraint);
}
return constraints.toArray(new ScriptConstraintAuthority[constraints.size()]);
}
/**
@@ -114,7 +117,7 @@ public class ScriptConstraint implements Serializable
public void updateTitle(String newTitle)
{
info.setTitle(newTitle);
rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle) ;
rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle);
}
/**
@@ -128,18 +131,19 @@ public class ScriptConstraint implements Serializable
/**
* Update a value
*
* @param bodge
*/
public void updateValues(JSONArray bodge) throws Exception
{
for(int i = 0; i < bodge.length(); i++)
for (int i = 0; i < bodge.length(); i++)
{
JSONObject obj = bodge.getJSONObject(i);
String value = obj.getString("value");
JSONArray authorities = obj.getJSONArray("authorities");
List<String> aList = new ArrayList<>();
for(int j = 0; j < authorities.length();j++)
for (int j = 0; j < authorities.length(); j++)
{
aList.add(authorities.getString(j));
}
@@ -149,6 +153,7 @@ public class ScriptConstraint implements Serializable
/**
* Update a value
*
* @param value
* @param authorities
*/
@@ -160,25 +165,27 @@ public class ScriptConstraint implements Serializable
/**
* Cascade delete an authority
*
* @param authority
*/
public void deleteAuthority(String authority)
{
//Do nothing
// Do nothing
}
/**
* Cascade delete a value
*
* @param value
*/
public void deleteValue(String value)
{
//Do nothing
// Do nothing
}
/**
* Get a single value
*
* @param value
* @return
*/
@@ -186,9 +193,9 @@ public class ScriptConstraint implements Serializable
{
ScriptConstraintValue[] values = getValues();
for(ScriptConstraintValue val : values)
for (ScriptConstraintValue val : values)
{
if(val.getValueName().equalsIgnoreCase(value))
if (val.getValueName().equalsIgnoreCase(value))
{
return val;
}
@@ -212,39 +219,39 @@ public class ScriptConstraint implements Serializable
ArrayList<ScriptConstraintValue> constraints = new ArrayList<>(pivot.size());
for (Map.Entry<String, List<String>> entry : pivot.entrySet())
{
ScriptConstraintValue constraint = new ScriptConstraintValue();
constraint.setValueName(entry.getKey());
constraint.setValueTitle(entry.getKey());
ScriptConstraintValue constraint = new ScriptConstraintValue();
constraint.setValueName(entry.getKey());
constraint.setValueTitle(entry.getKey());
List<String> authorities = entry.getValue();
List<ScriptAuthority> sauth = new ArrayList<>();
for(String authority : authorities)
{
ScriptAuthority a = new ScriptAuthority();
a.setAuthorityName(authority);
List<ScriptAuthority> sauth = new ArrayList<>();
for (String authority : authorities)
{
ScriptAuthority a = new ScriptAuthority();
a.setAuthorityName(authority);
String displayName = authorityService.getAuthorityDisplayName(authority);
if(StringUtils.isNotBlank(displayName))
{
a.setAuthorityTitle(displayName);
}
else
{
a.setAuthorityTitle(authority);
}
sauth.add(a);
}
constraint.setAuthorities(sauth);
constraints.add(constraint);
String displayName = authorityService.getAuthorityDisplayName(authority);
if (StringUtils.isNotBlank(displayName))
{
a.setAuthorityTitle(displayName);
}
else
{
a.setAuthorityTitle(authority);
}
sauth.add(a);
}
constraint.setAuthorities(sauth);
constraints.add(constraint);
}
/**
* Now go through and add any "empty" values
*/
Set<String> values = pivot.keySet();
for(String value : info.getAllowedValues())
for (String value : info.getAllowedValues())
{
if(!values.contains(value))
if (!values.contains(value))
{
ScriptConstraintValue constraint = new ScriptConstraintValue();
constraint.setValueName(value);

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -37,20 +37,23 @@ public class ScriptConstraintAuthority implements Serializable
*/
private static final long serialVersionUID = -4659454215122271811L;
private String authorityName;
private List<String>values;
private List<String> values;
public void setValues(List<String> values)
{
this.values = values;
}
public List<String> getValues()
{
return values;
}
public void setAuthorityName(String authorityName)
{
this.authorityName = authorityName;
}
public String getAuthorityName()
{
return authorityName;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -37,28 +37,33 @@ public class ScriptConstraintValue implements Serializable
*/
private static final long serialVersionUID = -4659454215122271811L;
private String value;
private List<ScriptAuthority>authorities;
private List<ScriptAuthority> authorities;
public void setAuthorities(List<ScriptAuthority> values)
{
this.authorities = values;
}
public List<ScriptAuthority> getAuthorities()
{
return authorities;
}
public void setValueName(String authorityName)
{
this.value = authorityName;
}
public String getValueName()
{
return value;
}
public void setValueTitle(String authorityName)
{
this.value = authorityName;
}
public String getValueTitle()
{
return value;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -66,12 +66,12 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
public ScriptConstraint getConstraint(String listName)
{
//TODO Temporary conversion
// TODO Temporary conversion
String xxx = listName.replace("_", ":");
RMConstraintInfo info = caveatConfigService.getRMConstraint(xxx);
if(info != null)
if (info != null)
{
return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
}
@@ -81,12 +81,12 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
public ScriptConstraint[] getAllConstraints()
{
return getConstraints(true);
return getConstraints(true);
}
public ScriptConstraint[] getConstraintsWithoutEmptyList()
{
return getConstraints(false);
return getConstraints(false);
}
private ScriptConstraint[] getConstraints(boolean includeEmptyList)
@@ -94,19 +94,19 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
Set<RMConstraintInfo> values = caveatConfigService.getAllRMConstraints();
List<ScriptConstraint> vals = new ArrayList<>(values.size());
for(RMConstraintInfo value : values)
for (RMConstraintInfo value : values)
{
ScriptConstraint c = new ScriptConstraint(value, caveatConfigService, getAuthorityService());
if (includeEmptyList)
{
vals.add(c);
vals.add(c);
}
else
{
if (c.getValues().length > 0)
{
vals.add(c);
}
if (c.getValues().length > 0)
{
vals.add(c);
}
}
}
@@ -115,44 +115,43 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
/**
* Delete list
*
* @param listName
*
*/
public void deleteConstraintList(String listName)
{
//TODO Temporary conversion
// TODO Temporary conversion
String xxx = listName.replace("_", ":");
caveatConfigService.deleteRMConstraint(xxx);
}
/**
* Update value
*/
public void updateConstraintValues(String listName, String authorityName, String[]values)
public void updateConstraintValues(String listName, String authorityName, String[] values)
{
List<String> vals = new ArrayList<>();
caveatConfigService.updateRMConstraintListAuthority(listName, authorityName, vals);
}
/**
* Delete the constraint values. i.e remove an authority from a constraint list
* Delete the constraint values. i.e remove an authority from a constraint list
*/
public void deleteRMConstraintListAuthority(String listName, String authorityName)
{
//TODO Temporary conversion
// TODO Temporary conversion
String xxx = listName.replace("_", ":");
caveatConfigService.removeRMConstraintListAuthority(xxx, authorityName);
}
/**
* Delete the constraint values. i.e remove a value from a constraint list
* Delete the constraint values. i.e remove a value from a constraint list
*/
public void deleteRMConstraintListValue(String listName, String valueName)
{
//TODO Temporary conversion
// TODO Temporary conversion
String xxx = listName.replace("_", ":");
caveatConfigService.removeRMConstraintListValue(xxx, valueName);
@@ -161,8 +160,8 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
public ScriptConstraint createConstraint(String listName, String title, String[] allowedValues)
{
//TODO Temporary conversion
if(listName != null)
// TODO Temporary conversion
if (listName != null)
{
listName = listName.replace("_", ":");
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -29,6 +29,8 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative;
import java.util.Map;
import org.springframework.beans.factory.BeanNameAware;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
@@ -40,7 +42,6 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PermissionService;
import org.springframework.beans.factory.BeanNameAware;
/**
* Abstract capability condition.
@@ -48,12 +49,12 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Roy Wetherall
*/
public abstract class AbstractCapabilityCondition implements CapabilityCondition,
BeanNameAware,
RecordsManagementModel
BeanNameAware,
RecordsManagementModel
{
/** transaction cache key */
private static final String KEY_EVALUATE = "rm.transaction.evaluate";
/** Capability condition name */
protected String name;
@@ -65,12 +66,13 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
protected FilePlanService filePlanService;
protected DispositionService dispositionService;
protected RecordFolderService recordFolderService;
/** transaction resource helper */
private TransactionalResourceHelper transactionalResourceHelper;
/**
* @param recordService record service
* @param recordService
* record service
*/
public void setRecordService(RecordService recordService)
{
@@ -78,7 +80,8 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
}
/**
* @param permissionService permission service
* @param permissionService
* permission service
*/
public void setPermissionService(PermissionService permissionService)
{
@@ -86,7 +89,8 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
}
/**
* @param nodeService node service
* @param nodeService
* node service
*/
public void setNodeService(NodeService nodeService)
{
@@ -94,23 +98,26 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
}
/**
* @param freezeService freeze service
* @param freezeService
* freeze service
*/
public void setFreezeService(FreezeService freezeService)
{
this.freezeService = freezeService;
this.freezeService = freezeService;
}
/**
* @param filePlanService file plan service
* @param filePlanService
* file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
this.filePlanService = filePlanService;
}
/**
* @param dispositionService disposition service
* @param dispositionService
* disposition service
*/
public void setDispositionService(DispositionService dispositionService)
{
@@ -118,15 +125,17 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
}
/**
* @param recordFolderService record folder service
* @param recordFolderService
* record folder service
*/
public void setRecordFolderService(RecordFolderService recordFolderService)
{
this.recordFolderService = recordFolderService;
}
/**
* @param transactionalResourceHelper transactional resource helper
* @param transactionalResourceHelper
* transactional resource helper
*/
public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper)
{
@@ -141,7 +150,7 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
{
return name;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -149,7 +158,7 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
// check transaction cache
Map<String, Boolean> map = transactionalResourceHelper.getMap(KEY_EVALUATE);
String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser();
@@ -162,10 +171,10 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
result = evaluateImpl(nodeRef);
map.put(key, result);
}
return result;
}
public abstract boolean evaluateImpl(NodeRef nodeRef);
/**

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -40,15 +40,16 @@ public interface CapabilityCondition
/**
* Get capability condition name
*
* @return {@link String} capability condition name
* @return {@link String} capability condition name
*/
String getName();
/**
* Evaluates capability condition.
*
* @param nodeRef node reference
* @return boolean true if evaluate success, false otherwise
* @param nodeRef
* node reference
* @return boolean true if evaluate success, false otherwise
*/
boolean evaluate(NodeRef nodeRef);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -35,6 +35,9 @@ import java.util.Map;
import java.util.Set;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
@@ -44,8 +47,6 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.TransactionalResourceHelper;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AccessStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Declarative capability implementation.
@@ -71,12 +72,13 @@ public class DeclarativeCapability extends AbstractCapability
/** Indicates whether to return an undetermined result */
protected boolean isUndetermined = false;
/** List of available kinds */
private Set<FilePlanComponentKind> availableKinds;
/**
* @param permissions permissions
* @param permissions
* permissions
*/
public void setPermissions(List<String> permissions)
{
@@ -84,7 +86,8 @@ public class DeclarativeCapability extends AbstractCapability
}
/**
* @param conditions conditions and expected values
* @param conditions
* conditions and expected values
*/
public void setConditions(Map<String, Boolean> conditions)
{
@@ -92,7 +95,7 @@ public class DeclarativeCapability extends AbstractCapability
}
/**
* @return {@link Map} &lt;String, Boolean &gt; conditions and expected values
* @return {@link Map} &lt;String, Boolean &gt; conditions and expected values
*/
public Map<String, Boolean> getConditions()
{
@@ -100,7 +103,8 @@ public class DeclarativeCapability extends AbstractCapability
}
/**
* @param kinds list of file plan component kinds
* @param kinds
* list of file plan component kinds
*/
public void setKinds(List<String> kinds)
{
@@ -108,7 +112,7 @@ public class DeclarativeCapability extends AbstractCapability
}
/**
* @return {@link List} &lt;@link String &gt; list of expected file plan component kinds
* @return {@link List} &lt;@link String &gt; list of expected file plan component kinds
*/
public List<String> getKinds()
{
@@ -118,7 +122,8 @@ public class DeclarativeCapability extends AbstractCapability
/**
* Helper method to set a single kind.
*
* @param kind file plan component kind
* @param kind
* file plan component kind
*/
public void setKind(String kind)
{
@@ -126,10 +131,10 @@ public class DeclarativeCapability extends AbstractCapability
}
/**
* Sets whether the capability will return an undetermined result when evaluating permissions
* for a single node reference or not. The default is to return grant.
* Sets whether the capability will return an undetermined result when evaluating permissions for a single node reference or not. The default is to return grant.
*
* @param isUndetermined true if undetermined result, false otherwise
* @param isUndetermined
* true if undetermined result, false otherwise
*/
public void setUndetermined(boolean isUndetermined)
{
@@ -147,7 +152,8 @@ public class DeclarativeCapability extends AbstractCapability
/**
* Helper @see #setPermissions(List)
*
* @param permission permission
* @param permission
* permission
*/
public void setPermission(String permission)
{
@@ -157,7 +163,8 @@ public class DeclarativeCapability extends AbstractCapability
}
/**
* @param targetCapability target capability
* @param targetCapability
* target capability
*/
public void setTargetCapability(Capability targetCapability)
{
@@ -167,22 +174,23 @@ public class DeclarativeCapability extends AbstractCapability
/**
* Check the permissions passed.
*
* @param nodeRef node reference
* @return boolean true if the permissions are present, false otherwise
* @param nodeRef
* node reference
* @return boolean true if the permissions are present, false otherwise
*/
protected boolean checkPermissionsImpl(NodeRef nodeRef, String ... permissions)
protected boolean checkPermissionsImpl(NodeRef nodeRef, String... permissions)
{
boolean result = true;
NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef);
if(filePlan == null)
if (filePlan == null)
{
return result;
}
for (String permission : permissions)
{
if (permissionService.hasPermission(filePlan, permission) != AccessStatus.ALLOWED)
if (permissionService.hasPermission(filePlan, permission) != AccessStatus.ALLOWED)
{
result = false;
break;
@@ -203,7 +211,7 @@ public class DeclarativeCapability extends AbstractCapability
boolean result = true;
if (permissions != null && !permissions.isEmpty())
{
result = checkPermissionsImpl(nodeRef, (String[])permissions.toArray(new String[permissions.size()]));
result = checkPermissionsImpl(nodeRef, (String[]) permissions.toArray(new String[permissions.size()]));
}
return result;
}
@@ -224,7 +232,7 @@ public class DeclarativeCapability extends AbstractCapability
boolean expected = entry.getValue().booleanValue();
String conditionName = entry.getKey();
CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(conditionName);
CapabilityCondition condition = (CapabilityCondition) applicationContext.getBean(conditionName);
if (condition == null)
{
throw new AlfrescoRuntimeException("Capability condition " + conditionName + " does not exist. Check the configuration of the capability " + name + ".");
@@ -255,20 +263,21 @@ public class DeclarativeCapability extends AbstractCapability
/**
* Checks the set conditions.
*
* @param nodeRef node reference
* @return boolean true if conditions satisfied, false otherwise
* @param nodeRef
* node reference
* @return boolean true if conditions satisfied, false otherwise
*/
protected boolean checkConditions(NodeRef nodeRef)
{
return checkConditions(nodeRef, conditions);
}
/**
* Get list of available kinds
*
* @return list of available kinds
* @return list of available kinds
*/
private Set<FilePlanComponentKind> getAvailableKinds()
{
if (kinds != null && availableKinds == null)
@@ -280,7 +289,7 @@ public class DeclarativeCapability extends AbstractCapability
availableKinds.add(kind);
}
}
return availableKinds;
}
@@ -316,7 +325,7 @@ public class DeclarativeCapability extends AbstractCapability
{
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
// check transaction cache
// check transaction cache
Map<String, Integer> map = TransactionalResourceHelper.getMap("rm.declarativeCapability");
String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser();
if (map.containsKey(key))
@@ -325,32 +334,32 @@ public class DeclarativeCapability extends AbstractCapability
}
else
{
// Check we are dealing with a file plan component
if (getFilePlanService().isFilePlanComponent(nodeRef))
{
// Check the kind of the object, the permissions and the conditions
if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef))
{
// Opportunity for child implementations to extend
result = evaluateImpl(nodeRef);
}
else
{
result = AccessDecisionVoter.ACCESS_DENIED;
}
}
// Check we are dealing with a file plan component
if (getFilePlanService().isFilePlanComponent(nodeRef))
{
// Check the kind of the object, the permissions and the conditions
if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef))
{
// Opportunity for child implementations to extend
result = evaluateImpl(nodeRef);
}
else
{
result = AccessDecisionVoter.ACCESS_DENIED;
}
}
// Last chance for child implementations to veto/change the result
result = onEvaluate(nodeRef, result);
// Last chance for child implementations to veto/change the result
result = onEvaluate(nodeRef, result);
// log access denied to help with debug
if (LOGGER.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result)
{
LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString());
}
// log access denied to help with debug
if (LOGGER.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result)
{
LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString());
}
map.put(key, result);
}
map.put(key, result);
}
return result;
}
@@ -367,9 +376,10 @@ public class DeclarativeCapability extends AbstractCapability
}
/**
* Default implementation. Given extending classes a hook point for further checks.
* Default implementation. Given extending classes a hook point for further checks.
*
* @param nodeRef node reference
* @param nodeRef
* node reference
* @return
*/
protected int evaluateImpl(NodeRef nodeRef)
@@ -385,8 +395,7 @@ public class DeclarativeCapability extends AbstractCapability
/**
* Default implementation.
*
* Called before evaluate completes. The result returned overwrites the already discovered result.
* Provides a hook point for child implementations that wish to veto the result.
* Called before evaluate completes. The result returned overwrites the already discovered result. Provides a hook point for child implementations that wish to veto the result.
*
* @param nodeRef
* @param result

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -29,25 +29,26 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative;
import java.util.Set;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability;
import org.alfresco.service.cmr.repository.NodeRef;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
/**
* Generic implementation of a composite capability
*
* @author Roy Wetherall
*/
public class DeclarativeCompositeCapability extends DeclarativeCapability
implements CompositeCapability
implements CompositeCapability
{
/** set of capabilities */
private Set<Capability> capabilities;
/**
* @param capabilities set of capabilities
* @param capabilities
* set of capabilities
*/
public void setCapabilities(Set<Capability> capabilities)
{
@@ -102,7 +103,7 @@ public class DeclarativeCompositeCapability extends DeclarativeCapability
}
/**
* If a target capability is specified then we evaluate that. Otherwise we combine the results of the provided capabilities.
* If a target capability is specified then we evaluate that. Otherwise we combine the results of the provided capabilities.
*
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -113,7 +114,7 @@ public class DeclarativeCompositeCapability extends DeclarativeCapability
// Check we are dealing with a file plan component
if (getFilePlanService().isFilePlanComponent(source) &&
getFilePlanService().isFilePlanComponent(target))
getFilePlanService().isFilePlanComponent(target))
{
// Check the kind of the object, the permissions and the conditions
if (checkKinds(source) && checkPermissions(source) && checkConditions(source))

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -34,8 +34,7 @@ import org.alfresco.module.org_alfresco_module_rm.capability.declarative.Capabil
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Composite capability condition implementation that required at least one of the
* capability conditions to be true.
* Composite capability condition implementation that required at least one of the capability conditions to be true.
*
* @author Roy Wetherall
*/
@@ -45,13 +44,14 @@ public class AtLeastOneCondition extends AbstractCapabilityCondition
private List<CapabilityCondition> conditions;
/**
* @param conditions capability conditions
* @param conditions
* capability conditions
*/
public void setConditions(List<CapabilityCondition> conditions)
{
this.conditions = conditions;
}
/**
* Don't use the transaction cache for the composite condition
*

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -56,9 +56,8 @@ public class ClosedCapabilityCondition extends AbstractCapabilityCondition
else if (recordService.isRecord(nodeRef))
{
final List<ChildAssociationRef> assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
result = AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>()
{
result = AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>() {
@Override
public Boolean doWork()
{
@@ -73,7 +72,7 @@ public class ClosedCapabilityCondition extends AbstractCapabilityCondition
return false;
}
});
}
return result;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -31,8 +31,7 @@ import org.alfresco.module.org_alfresco_module_rm.capability.declarative.Abstrac
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Helper condition that always fails. Useful for deprecation of
* old capabilities.
* Helper condition that always fails. Useful for deprecation of old capabilities.
*
* @author Roy Wetherall
*/

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -34,31 +34,31 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
/**
* Fileable capability condition. Indicates whether a node is 'fileable', namely if it extends cm:content
* or extends rma:nonElectronicDocument
* Fileable capability condition. Indicates whether a node is 'fileable', namely if it extends cm:content or extends rma:nonElectronicDocument
*
* @author Roy Wetherall
*/
public class FileableCapabilityCondition extends AbstractCapabilityCondition
{
{
/** Dictionary service */
private DictionaryService dictionaryService;
/**
* @param dictionaryService dictionary service
* @param dictionaryService
* dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public boolean evaluateImpl(NodeRef nodeRef)
{
QName type = nodeService.getType(nodeRef);
QName type = nodeService.getType(nodeRef);
// TODO and not already a record?
return (dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) ||
dictionaryService.isSubClass(type, TYPE_NON_ELECTRONIC_DOCUMENT));

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -46,12 +46,12 @@ public class FillingCapabilityCondition extends AbstractCapabilityCondition
public boolean evaluateImpl(NodeRef nodeRef)
{
boolean result = false;
if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED)
{
result = true;
}
return result;
return result;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,23 +47,23 @@ public class FillingOnHoldContainerCapabilityCondition extends AbstractCapabilit
public boolean evaluateImpl(NodeRef nodeRef)
{
boolean result = false;
NodeRef holdContainer = nodeRef;
NodeRef holdContainer = nodeRef;
// if we have a file plan, go get the hold container
if (filePlanService.isFilePlan(nodeRef) == true)
{
holdContainer = filePlanService.getHoldContainer(nodeRef);
}
// ensure we are dealing with a hold container
if (TYPE_HOLD_CONTAINER.equals(nodeService.getType(holdContainer)))
{
{
if (permissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED)
{
result = true;
}
}
return result;
return result;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -42,20 +42,22 @@ public class FrozenCapabilityCondition extends AbstractCapabilityCondition
{
/** indicates whether children should be checked */
private boolean checkChildren = false;
/** hold service */
private HoldService holdService;
/**
* @param checkChildren true to check children, false otherwise
* @param checkChildren
* true to check children, false otherwise
*/
public void setCheckChildren(boolean checkChildren)
{
this.checkChildren = checkChildren;
}
/**
* @param holdService hold service
* @param holdService
* hold service
*/
public void setHoldService(HoldService holdService)
{
@@ -66,7 +68,7 @@ public class FrozenCapabilityCondition extends AbstractCapabilityCondition
public boolean evaluateImpl(NodeRef nodeRef)
{
boolean result = false;
// check whether we are working with a hold or not
if (holdService.isHold(nodeRef))
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -45,7 +45,7 @@ public class FrozenOrHoldCondition extends AbstractCapabilityCondition
public boolean evaluateImpl(NodeRef nodeRef)
{
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
return (freezeService.isFrozen(nodeRef) ||
return (freezeService.isFrozen(nodeRef) ||
(kind != null && kind.equals(FilePlanComponentKind.HOLD)));
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -38,19 +38,19 @@ import org.alfresco.service.namespace.QName;
public class HasAspectCapabilityCondition extends AbstractCapabilityCondition
{
private String aspectName;
private NamespaceService namespaceService;
public void setAspectName(String aspectName)
{
this.aspectName = aspectName;
}
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -63,7 +63,7 @@ public class HasAspectCapabilityCondition extends AbstractCapabilityCondition
QName aspect = QName.createQName(aspectName, namespaceService);
result = nodeService.hasAspect(nodeRef, aspect);
}
return result;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -45,11 +45,11 @@ public class IsClassifiedCapabilityCondition extends AbstractCapabilityCondition
@Override
public boolean evaluateImpl(NodeRef nodeRef)
{
boolean result = false;
boolean result = false;
DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef);
if (dispositionSchedule != null)
{
{
result = true;
}
return result;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -44,38 +44,40 @@ public class IsPropertySetCondition extends AbstractCapabilityCondition
/** property name (eg: rma:location) */
private String propertyName;
private QName propertyQName;
/** namespace service */
private NamespaceService namespaceService;
/**
* @param propertyName property name (eg: rma:location)
* @param propertyName
* property name (eg: rma:location)
*/
public void setPropertyName(String propertyName)
{
this.propertyName = propertyName;
}
/**
* @param namespaceService namespace service
* @param namespaceService
* namespace service
*/
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
/**
* @return QName property qname
* @return QName property qname
*/
protected QName getPropertyQName()
{
if (propertyQName == null)
{
propertyQName = QName.createQName(propertyName, namespaceService);
}
return propertyQName;
if (propertyQName == null)
{
propertyQName = QName.createQName(propertyName, namespaceService);
}
return propertyQName;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -85,12 +87,12 @@ public class IsPropertySetCondition extends AbstractCapabilityCondition
ParameterCheck.mandatory("nodeRef", nodeRef);
boolean result = false;
if (nodeService.getProperty(nodeRef, getPropertyQName()) != null)
{
result = true;
}
return result;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -42,7 +42,8 @@ public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition
private String dispositionAction;
/**
* @param dispositionAction disposition action
* @param dispositionAction
* disposition action
*/
public void setDispositionAction(String dispositionAction)
{
@@ -63,7 +64,7 @@ public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition
// Get the disposition actions name
String actionName = nextDispositionAction.getName();
if (actionName.equals(dispositionAction) &&
dispositionService.isNextDispositionActionEligible(nodeRef))
dispositionService.isNextDispositionActionEligible(nodeRef))
{
result = true;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,7 +47,7 @@ public class IsTransferAccessionCapabilityCondition extends AbstractCapabilityCo
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.TRANSFER.equals(kind))
{
Boolean value = (Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR);
Boolean value = (Boolean) nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR);
if (value != null)
{
result = value.booleanValue();

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -55,7 +55,7 @@ public class LastDispositionActionCondition extends AbstractCapabilityCondition
boolean result = false;
DispositionAction dispositionAction = dispositionService.getLastCompletedDispostionAction(nodeRef);
if (dispositionAction != null &&
dispositionActionName.equals(dispositionAction.getName()))
dispositionActionName.equals(dispositionAction.getName()))
{
result = true;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -43,7 +43,8 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi
private String dispositionAction;
/**
* @param dispositionAction disposition action
* @param dispositionAction
* disposition action
*/
public void setDispositionAction(String dispositionAction)
{
@@ -84,6 +85,6 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi
{
boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition();
return (recordService.isRecord(nodeRef) && isRecordLevelDisposition)
|| (recordFolderService.isRecordFolder(nodeRef) && !isRecordLevelDisposition);
|| (recordFolderService.isRecordFolder(nodeRef) && !isRecordLevelDisposition);
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -49,7 +49,7 @@ public class VitalRecordOrFolderCapabilityCondition extends AbstractCapabilityCo
else if (recordFolderService.isRecordFolder(nodeRef))
{
// Check the folder for the vital record indicator
Boolean value = (Boolean)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_VITAL_RECORD_INDICATOR);
Boolean value = (Boolean) nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_VITAL_RECORD_INDICATOR);
if (value != null)
{
result = value.booleanValue();

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -30,13 +30,14 @@ package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import java.io.Serializable;
import java.util.Map;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.PolicyRegister;
import org.alfresco.module.org_alfresco_module_rm.capability.RMSecurityCommon;
import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.aopalliance.intercept.MethodInvocation;
/**
* Abstract base policy implementation
@@ -45,7 +46,7 @@ import org.aopalliance.intercept.MethodInvocation;
* @since 2.1
*/
public abstract class AbstractBasePolicy extends RMSecurityCommon
implements Policy
implements Policy
{
/** Capability service */
private CapabilityService capabilityService;
@@ -57,7 +58,8 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
private String name;
/**
* @param name policy name
* @param name
* policy name
*/
public void setName(String name)
{
@@ -90,7 +92,8 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
}
/**
* @param capabilityService capability service
* @param capabilityService
* capability service
*/
public void setCapabilityService(CapabilityService capabilityService)
{
@@ -98,12 +101,13 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
}
/**
* @param policyRegister policy register
* @param policyRegister
* policy register
*/
public void setPolicyRegister(PolicyRegister policyRegister)
{
this.policyRegister = policyRegister;
}
this.policyRegister = policyRegister;
}
/**
* Init method
@@ -185,7 +189,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
* @param position
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({"rawtypes", "unchecked"})
protected Map<QName, Serializable> getProperties(MethodInvocation invocation, Class[] params, int position)
{
if (invocation.getArguments()[position] == null)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -28,18 +28,19 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.aopalliance.intercept.MethodInvocation;
public class AssocPolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)
@@ -68,8 +69,8 @@ public class AssocPolicy extends AbstractBasePolicy
final boolean isFilePlanComponent = nodeService.hasAspect(target, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT);
final boolean hasViewRecordCapability = getCapabilityService().hasCapability(target, ViewRecordsCapability.NAME);
// allow association between a source non rm node and an rm node if the user
// has ViewRecordsCapability on the RM target node and write properties on the dm node
if ( isFilePlanComponent &&
// has ViewRecordsCapability on the RM target node and write properties on the dm node
if (isFilePlanComponent &&
hasViewRecordCapability &&
permissionService.hasPermission(source, PermissionService.WRITE_PROPERTIES).equals(AccessStatus.ALLOWED))
{
@@ -88,4 +89,3 @@ public class AssocPolicy extends AbstractBasePolicy
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -31,13 +31,13 @@ import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import net.sf.acegisecurity.ConfigAttribute;
import org.alfresco.repo.security.permissions.impl.SimplePermissionReference;
import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException;
import org.alfresco.service.namespace.NamespacePrefixResolver;
import org.alfresco.service.namespace.QName;
import net.sf.acegisecurity.ConfigAttribute;
/**
* RM security configuration definition.
*
@@ -72,8 +72,10 @@ public class ConfigAttributeDefinition
/**
* Default constructor
*
* @param attr configuration attribute instance
* @param namespacePrefixResolver namespace prefix resolver
* @param attr
* configuration attribute instance
* @param namespacePrefixResolver
* namespace prefix resolver
*/
public ConfigAttributeDefinition(ConfigAttribute attr, NamespacePrefixResolver namespacePrefixResolver)
{
@@ -86,12 +88,12 @@ public class ConfigAttributeDefinition
typeString = st.nextToken();
// check that the configuration is valid
if (!(typeString.equals(RM) ||
typeString.equals(RM_ALLOW) ||
typeString.equals(RM_CAP) ||
typeString.equals(RM_DENY) ||
typeString.equals(RM_QUERY) ||
typeString.equals(RM_ABSTAIN)))
if (!(typeString.equals(RM) ||
typeString.equals(RM_ALLOW) ||
typeString.equals(RM_CAP) ||
typeString.equals(RM_DENY) ||
typeString.equals(RM_QUERY) ||
typeString.equals(RM_ABSTAIN)))
{
throw new ACLEntryVoterException("Invalid type: must be ACL_NODE, ACL_PARENT or ACL_ALLOW");
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,16 +27,17 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.module.org_alfresco_module_rm.capability.impl.CreateCapability;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.aopalliance.intercept.MethodInvocation;
public class CreatePolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)
@@ -48,9 +49,11 @@ public class CreatePolicy extends AbstractBasePolicy
// get the destination node
NodeRef destination = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
//get the recordType
for (Object qname : invocation.getArguments()) {
if (qname != null && (qname.equals(RecordsManagementModel.TYPE_RECORD_FOLDER) || qname.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY))) {
// get the recordType
for (Object qname : invocation.getArguments())
{
if (qname != null && (qname.equals(RecordsManagementModel.TYPE_RECORD_FOLDER) || qname.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY)))
{
recordType = (QName) qname;
}
}
@@ -61,7 +64,7 @@ public class CreatePolicy extends AbstractBasePolicy
linkee = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent());
// get the assoc type
if(cad.getParameters().size() > 2)
if (cad.getParameters().size() > 2)
{
assocType = getType(invocation, params, cad.getParameters().get(2), cad.isParent());
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,14 +27,15 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import org.alfresco.service.cmr.repository.NodeRef;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.service.cmr.repository.NodeRef;
public class DeclarePolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,16 +27,16 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import org.alfresco.service.cmr.repository.NodeRef;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.aopalliance.intercept.MethodInvocation;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.alfresco.service.cmr.repository.NodeRef;
public class DeletePolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,19 +27,19 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AccessStatus;
import org.aopalliance.intercept.MethodInvocation;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
public class MovePolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)
@@ -67,7 +67,7 @@ public class MovePolicy extends AbstractBasePolicy
else
{
if (nodeService.hasAspect(destination, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) &&
permissionService.hasPermission(destination, RMPermissionModel.FILING).equals(AccessStatus.ALLOWED))
permissionService.hasPermission(destination, RMPermissionModel.FILING).equals(AccessStatus.ALLOWED))
{
return AccessDecisionVoter.ACCESS_GRANTED;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -30,7 +30,7 @@ package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import org.aopalliance.intercept.MethodInvocation;
/**
* Policy interface
* Policy interface
*
* @author Roy Wetherall
* @since 2.1
@@ -38,10 +38,10 @@ import org.aopalliance.intercept.MethodInvocation;
public interface Policy
{
/**
* @return policy name
* @return policy name
*/
String getName();
/**
* Evaluate the policy
*
@@ -51,8 +51,8 @@ public interface Policy
* @return
*/
@SuppressWarnings("rawtypes")
int evaluate(
MethodInvocation invocation,
Class[] params,
int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,9 +27,10 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability;
import org.alfresco.service.cmr.repository.NodeRef;
import org.aopalliance.intercept.MethodInvocation;
/**
* Read method security policy.
@@ -41,7 +42,7 @@ public class ReadPolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -30,16 +30,17 @@ package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import java.io.Serializable;
import java.util.Map;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.module.org_alfresco_module_rm.capability.impl.UpdateCapability;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.aopalliance.intercept.MethodInvocation;
public class UpdatePolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,13 +27,14 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import org.alfresco.service.cmr.repository.NodeRef;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.service.cmr.repository.NodeRef;
public class UpdatePropertiesPolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")
public int evaluate(
public int evaluate(
MethodInvocation invocation,
Class[] params,
ConfigAttributeDefinition cad)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,9 +27,10 @@
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
import org.alfresco.service.cmr.repository.NodeRef;
import org.aopalliance.intercept.MethodInvocation;
import org.alfresco.service.cmr.repository.NodeRef;
public class WriteContentPolicy extends AbstractBasePolicy
{
@SuppressWarnings("rawtypes")

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -41,107 +41,110 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @since 1.0
*/
public interface DispositionAction
{
{
/**
* @return the node reference
* @return the node reference
*/
NodeRef getNodeRef();
/**
* @return the disposition action definition
* @return the disposition action definition
*/
DispositionActionDefinition getDispositionActionDefinition();
/**
* @return the id of the action
*/
String getId();
/**
* @return the name of the action
*/
String getName();
/**
* @return the display label for the action
* @return the display label for the action
*/
String getLabel();
/**
* @return the dispostion action as of eligibility date
* @return the dispostion action as of eligibility date
*/
Date getAsOfDate();
/**
* @return true if the events are complete (ie: enough events have been completed to make the disposition
* action
* @return true if the events are complete (ie: enough events have been completed to make the disposition action
*/
boolean isEventsEligible();
/**
* @return the user that started the action
*/
String getStartedBy();
/**
* @return when the action was started
*/
Date getStartedAt();
/**
* @return the user that completed the action
*/
String getCompletedBy();
/**
* @return when the action was completed
*/
Date getCompletedAt();
/**
* @return List of events that need to be completed for the action
*/
List<EventCompletionDetails> getEventCompletionDetails();
/**
* Get the event completion details for a named event.
*
* @param eventName event name
* @return {@link EventCompletionDetails} event completion details
* @param eventName
* event name
* @return {@link EventCompletionDetails} event completion details
* @since 2.2
*/
EventCompletionDetails getEventCompletionDetails(String eventName);
/**
* Add new completion details to the disposition action based on the provided
* event.
* Add new completion details to the disposition action based on the provided event.
*
* @param event records management event
* @param event
* records management event
* @since 2.2
*/
void addEventCompletionDetails(RecordsManagementEvent event);
/**
* Complete an event.
* <p>
* If null is provided, the complete at date will be take as 'now' and the completed by user
* as the fully authenticated user.
* If null is provided, the complete at date will be take as 'now' and the completed by user as the fully authenticated user.
*
* @param eventName event name
* @param completedAt completed at 'date', now if null
* @param completedBy completed by user, authenticated user if null
* @param eventName
* event name
* @param completedAt
* completed at 'date', now if null
* @param completedBy
* completed by user, authenticated user if null
* @since 2.2
*/
void completeEvent(String eventName, Date completedAt, String completedBy);
/**
* Undo the completion of an event.
*
* @param eventName event name
* @param eventName
* event name
* @since 2.2
*/
void undoEvent(String eventName);
/**
* Refresh events against current disposition action definition.
* <p>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -29,7 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.disposition;
import java.util.List;
import org.alfresco.api.AlfrescoPublicApi;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.Period;
@@ -107,12 +106,9 @@ public interface DispositionActionDefinition
List<RecordsManagementEvent> getEvents();
/**
* Indicates whether the disposition action is eligible when the earliest
* event is complete, otherwise all events must be complete before
* eligibility.
* Indicates whether the disposition action is eligible when the earliest event is complete, otherwise all events must be complete before eligibility.
*
* @return boolean true if eligible on first action complete, false
* otherwise
* @return boolean true if eligible on first action complete, false otherwise
*/
boolean eligibleOnFirstCompleteEvent();
@@ -126,8 +122,7 @@ public interface DispositionActionDefinition
/**
* Get the ghost on destroy from the disposition
*
* @return boolean the gost on destroy flag (on applicable to destroy
* actions)
* @return boolean the gost on destroy flag (on applicable to destroy actions)
*/
String getGhostOnDestroy();

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -78,11 +78,16 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
/**
* Constructor
*
* @param recordsManagementEventService records management event service
* @param recordsManagementActionService records management action service
* @param nodeService node service
* @param nodeRef disposition action node reference
* @param index index of disposition action
* @param recordsManagementEventService
* records management event service
* @param recordsManagementActionService
* records management action service
* @param nodeService
* node service
* @param nodeRef
* disposition action node reference
* @param index
* index of disposition action
*/
public DispositionActionDefinitionImpl(RecordsManagementEventService recordsManagementEventService, RecordsManagementActionService recordsManagementActionService, NodeService nodeService, NodeRef nodeRef, int index)
{
@@ -112,7 +117,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getId()
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getId()
*/
@Override
public String getId()
@@ -128,7 +133,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
{
if (description == null)
{
description = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_DESCRIPTION);
description = (String) nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_DESCRIPTION);
}
return description;
}
@@ -141,7 +146,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
{
if (name == null)
{
name = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_ACTION_NAME);
name = (String) nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_ACTION_NAME);
}
return name;
}
@@ -174,7 +179,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
@Override
public Period getPeriod()
{
return (Period)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD);
return (Period) nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD);
}
/**
@@ -184,7 +189,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
public QName getPeriodProperty()
{
QName result = null;
String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD_PROPERTY);
String value = (String) nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD_PROPERTY);
if (value != null)
{
result = QName.createQName(value);
@@ -200,7 +205,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
public List<RecordsManagementEvent> getEvents()
{
List<RecordsManagementEvent> events = null;
Collection<String> eventNames = (Collection<String>)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT);
Collection<String> eventNames = (Collection<String>) nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT);
if (eventNames != null)
{
events = new ArrayList<>(eventNames.size());
@@ -224,7 +229,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
public boolean eligibleOnFirstCompleteEvent()
{
boolean result = true;
String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT_COMBINATION);
String value = (String) nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT_COMBINATION);
if (value != null && value.equals("and"))
{
result = false;
@@ -238,7 +243,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
@Override
public String getLocation()
{
return (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_LOCATION);
return (String) nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_LOCATION);
}
/**

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -34,6 +34,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry;
@@ -41,15 +44,12 @@ import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction
import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RMSearchGet;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Disposition action implementation.
@@ -58,7 +58,7 @@ import org.apache.commons.logging.LogFactory;
* @since 1.0
*/
public class DispositionActionImpl implements DispositionAction,
RecordsManagementModel
RecordsManagementModel
{
/** logger */
private static Log logger = LogFactory.getLog(DispositionActionImpl.class);
@@ -75,8 +75,10 @@ public class DispositionActionImpl implements DispositionAction,
/**
* Constructor
*
* @param services records management service registry
* @param dispositionActionNodeRef disposition action node reference
* @param services
* records management service registry
* @param dispositionActionNodeRef
* disposition action node reference
*/
public DispositionActionImpl(RecordsManagementServiceRegistry services, NodeRef dispositionActionNodeRef)
{
@@ -92,7 +94,7 @@ public class DispositionActionImpl implements DispositionAction,
if (dispositionActionDefinition == null)
{
// Get the current action
String id = (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID);
String id = (String) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID);
// Get the disposition instructions for the owning node
NodeRef recordNodeRef = services.getNodeService().getPrimaryParent(this.dispositionNodeRef).getParentRef();
@@ -117,7 +119,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public NodeRef getNodeRef()
{
return this.dispositionNodeRef;
return this.dispositionNodeRef;
}
/**
@@ -143,7 +145,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public String getId()
{
return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID);
return (String) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID);
}
/**
@@ -151,7 +153,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public String getName()
{
return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION);
return (String) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION);
}
/**
@@ -159,7 +161,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public Date getAsOfDate()
{
return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_AS_OF);
return (Date) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_AS_OF);
}
/**
@@ -167,7 +169,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public boolean isEventsEligible()
{
return ((Boolean)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_EVENTS_ELIGIBLE)).booleanValue();
return ((Boolean) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_EVENTS_ELIGIBLE)).booleanValue();
}
/**
@@ -175,7 +177,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public Date getCompletedAt()
{
return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT);
return (Date) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT);
}
/**
@@ -183,7 +185,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public String getCompletedBy()
{
return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY);
return (String) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY);
}
/**
@@ -191,7 +193,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public Date getStartedAt()
{
return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT);
return (Date) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT);
}
/**
@@ -199,7 +201,7 @@ public class DispositionActionImpl implements DispositionAction,
*/
public String getStartedBy()
{
return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY);
return (String) services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY);
}
/**
@@ -208,9 +210,9 @@ public class DispositionActionImpl implements DispositionAction,
public List<EventCompletionDetails> getEventCompletionDetails()
{
List<ChildAssociationRef> assocs = services.getNodeService().getChildAssocs(
this.dispositionNodeRef,
ASSOC_EVENT_EXECUTIONS,
RegexQNamePattern.MATCH_ALL);
this.dispositionNodeRef,
ASSOC_EVENT_EXECUTIONS,
RegexQNamePattern.MATCH_ALL);
List<EventCompletionDetails> result = new ArrayList<>(assocs.size());
for (ChildAssociationRef assoc : assocs)
{
@@ -221,11 +223,11 @@ public class DispositionActionImpl implements DispositionAction,
}
/**
* Helper method to create object representation of event completed details from
* node reference.
* Helper method to create object representation of event completed details from node reference.
*
* @param nodeRef node reference
* @return {@link EventCompletionDetails} event completion details
* @param nodeRef
* node reference
* @return {@link EventCompletionDetails} event completion details
*/
private EventCompletionDetails getEventCompletionDetailsFromNodeRef(NodeRef nodeRef)
{
@@ -233,7 +235,7 @@ public class DispositionActionImpl implements DispositionAction,
Map<QName, Serializable> props = this.services.getNodeService().getProperties(nodeRef);
// get the event name
String eventName = (String)props.get(PROP_EVENT_EXECUTION_NAME);
String eventName = (String) props.get(PROP_EVENT_EXECUTION_NAME);
// create event completion details
return new EventCompletionDetails(
@@ -258,7 +260,7 @@ public class DispositionActionImpl implements DispositionAction,
boolean result = defaultValue;
if (value instanceof Boolean)
{
result = ((Boolean)value).booleanValue();
result = ((Boolean) value).booleanValue();
}
return result;
}
@@ -268,8 +270,9 @@ public class DispositionActionImpl implements DispositionAction,
* <p>
* Returns null if event can not be found.
*
* @param eventName name of the event
* @return {@link EventCompletionDetails} event completion details for named event, null otherwise
* @param eventName
* name of the event
* @return {@link EventCompletionDetails} event completion details for named event, null otherwise
*
* @since 2.2
*/
@@ -301,8 +304,7 @@ public class DispositionActionImpl implements DispositionAction,
final EventCompletionDetails event = getEventCompletionDetails(eventName);
if (event != null && !event.isEventComplete())
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork()
{
@@ -352,8 +354,7 @@ public class DispositionActionImpl implements DispositionAction,
final EventCompletionDetails event = getEventCompletionDetails(eventName);
if (event != null && event.isEventComplete())
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork()
{
@@ -381,8 +382,7 @@ public class DispositionActionImpl implements DispositionAction,
@Override
public void refreshEvents()
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork()
{
@@ -407,7 +407,7 @@ public class DispositionActionImpl implements DispositionAction,
if (logger.isDebugEnabled())
{
logger.debug("Removed '" + eventName + "' from next action '" + getName() +
"' (" + getNodeRef() + ")");
"' (" + getNodeRef() + ")");
}
}
}
@@ -425,7 +425,7 @@ public class DispositionActionImpl implements DispositionAction,
if (logger.isDebugEnabled())
{
logger.debug("Added '" + eventName + "' to next action '" + getName() +
"' (" + getNodeRef() + ")");
"' (" + getNodeRef() + ")");
}
}
}
@@ -440,7 +440,7 @@ public class DispositionActionImpl implements DispositionAction,
if (logger.isDebugEnabled())
{
logger.debug("Set events eligible flag to '" + eligible + "' for next action '" + getName() +
"' (" + getNodeRef() + ")");
"' (" + getNodeRef() + ")");
}
return null;
@@ -462,18 +462,17 @@ public class DispositionActionImpl implements DispositionAction,
// Create the event execution object
services.getNodeService().createNode(getNodeRef(),
ASSOC_EVENT_EXECUTIONS,
ASSOC_EVENT_EXECUTIONS,
TYPE_EVENT_EXECUTION,
eventProps);
ASSOC_EVENT_EXECUTIONS,
ASSOC_EVENT_EXECUTIONS,
TYPE_EVENT_EXECUTION,
eventProps);
}
/**
* Calculates and updates the <code>rma:dispositionEventsEligible</code>
* property for the given next disposition action.
* Calculates and updates the <code>rma:dispositionEventsEligible</code> property for the given next disposition action.
*
* @param nextAction The next disposition action
* @param nextAction
* The next disposition action
* @return The result of calculation
*
* @since 2.2
@@ -490,7 +489,7 @@ public class DispositionActionImpl implements DispositionAction,
// get the disposition action definition
DispositionActionDefinition dispositionActionDefinition = getDispositionActionDefinition();
if (dispositionActionDefinition != null)
{
{
if (!dispositionActionDefinition.eligibleOnFirstCompleteEvent())
{
// if one event is complete then the disposition action is eligible
@@ -528,9 +527,12 @@ public class DispositionActionImpl implements DispositionAction,
/**
* Sets declassification review authority and date on records and record folder
*
* @param eventNodeRef Declassification review event node ref
* @param completedAtValue Declassification review authority
* @param completedByValue Declassification review date
* @param eventNodeRef
* Declassification review event node ref
* @param completedAtValue
* Declassification review authority
* @param completedByValue
* Declassification review date
*/
private void setDeclassificationReview(NodeRef eventNodeRef, Date completedAtValue, String completedByValue)
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -49,44 +49,46 @@ public interface DispositionSchedule
/**
* Get the disposition authority
*
* @return {@link String} disposition authority
* @return {@link String} disposition authority
*/
String getDispositionAuthority();
/**
* Get the disposition instructions
*
* @return {@link String} disposition instructions
* @return {@link String} disposition instructions
*/
String getDispositionInstructions();
/**
* Indicates whether the disposal occurs at record level or not
*
* @return boolean true if at record level, false otherwise
* @return boolean true if at record level, false otherwise
*/
boolean isRecordLevelDisposition();
/**
* Gets all the disposition action definitions for the schedule
*
* @return List&lt;{@link DispositionActionDefinition}&gt; disposition action definitions
* @return List&lt;{@link DispositionActionDefinition}&gt; disposition action definitions
*/
List<DispositionActionDefinition> getDispositionActionDefinitions();
/**
* Get the disposition action definition
*
* @param id the action definition id
* @return {@link DispositionActionDefinition} disposition action definition
* @param id
* the action definition id
* @return {@link DispositionActionDefinition} disposition action definition
*/
DispositionActionDefinition getDispositionActionDefinition(String id);
/**
* Get the disposition action definition by the name of the disposition action
*
* @param name disposition action name
* @return {@link DispositionActionDefinition} disposition action definition, null if none
* @param name
* disposition action name
* @return {@link DispositionActionDefinition} disposition action definition, null if none
*/
DispositionActionDefinition getDispositionActionDefinitionByName(String name);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,7 +47,7 @@ import org.alfresco.service.namespace.RegexQNamePattern;
* @author Roy Wetherall
*/
public class DispositionScheduleImpl implements DispositionSchedule,
RecordsManagementModel
RecordsManagementModel
{
private NodeService nodeService;
private RecordsManagementServiceRegistry services;
@@ -55,14 +55,13 @@ public class DispositionScheduleImpl implements DispositionSchedule,
/** authentication helper */
private AuthenticationUtil authenticationUtil;
private List<DispositionActionDefinition> actions;
private Map<String, DispositionActionDefinition> actionsById;
//If name is not the same as node-uuid, then action will be stored here too
//Fix for ALF-2588
// If name is not the same as node-uuid, then action will be stored here too
// Fix for ALF-2588
private Map<String, DispositionActionDefinition> actionsByName;
/** Map of disposition definitions by disposition action name */
private Map<String, DispositionActionDefinition> actionsByDispositionActionName;
@@ -70,11 +69,11 @@ public class DispositionScheduleImpl implements DispositionSchedule,
{
this.authenticationUtil = authenticationUtil;
}
public DispositionScheduleImpl(RecordsManagementServiceRegistry services, NodeService nodeService, NodeRef nodeRef)
public DispositionScheduleImpl(RecordsManagementServiceRegistry services, NodeService nodeService, NodeRef nodeRef)
{
// TODO check that we have a disposition definition node reference
this.dispositionDefinitionNodeRef = nodeRef;
this.nodeService = nodeService;
this.services = services;
@@ -87,13 +86,13 @@ public class DispositionScheduleImpl implements DispositionSchedule,
{
return this.dispositionDefinitionNodeRef;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionAuthority()
*/
public String getDispositionAuthority()
{
return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_AUTHORITY);
return (String) this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_AUTHORITY);
}
/**
@@ -101,7 +100,7 @@ public class DispositionScheduleImpl implements DispositionSchedule,
*/
public String getDispositionInstructions()
{
return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_INSTRUCTIONS);
return (String) this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_INSTRUCTIONS);
}
/**
@@ -109,11 +108,10 @@ public class DispositionScheduleImpl implements DispositionSchedule,
*/
public boolean isRecordLevelDisposition()
{
return authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Boolean>()
{
return authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Boolean>() {
public Boolean doWork() throws Exception
{
Boolean value = (Boolean)nodeService.getProperty(dispositionDefinitionNodeRef, PROP_RECORD_LEVEL_DISPOSITION);
Boolean value = (Boolean) nodeService.getProperty(dispositionDefinitionNodeRef, PROP_RECORD_LEVEL_DISPOSITION);
if (value != null)
{
return value;
@@ -126,15 +124,15 @@ public class DispositionScheduleImpl implements DispositionSchedule,
/**
* Get disposition action definition
*
* @param id action definition identifier
* @return DispositionActionDefinition disposition action definition
* @param id
* action definition identifier
* @return DispositionActionDefinition disposition action definition
*/
public DispositionActionDefinition getDispositionActionDefinition(String id)
{
if (this.actions == null)
{
authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Void>()
{
authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Void>() {
public Void doWork() throws Exception
{
getDispositionActionsImpl();
@@ -150,7 +148,7 @@ public class DispositionScheduleImpl implements DispositionSchedule,
}
return actionDef;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionActionDefinitionByName(java.lang.String)
*/
@@ -173,43 +171,43 @@ public class DispositionScheduleImpl implements DispositionSchedule,
{
getDispositionActionsImpl();
}
return this.actions;
}
/**
* Get the disposition actions into the local cache
*/
private void getDispositionActionsImpl()
{
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(
this.dispositionDefinitionNodeRef,
ASSOC_DISPOSITION_ACTION_DEFINITIONS,
RegexQNamePattern.MATCH_ALL);
this.dispositionDefinitionNodeRef,
ASSOC_DISPOSITION_ACTION_DEFINITIONS,
RegexQNamePattern.MATCH_ALL);
this.actions = new ArrayList<>(assocs.size());
this.actionsById = new HashMap<>(assocs.size());
this.actionsByName = new HashMap<>(assocs.size());
this.actionsByDispositionActionName = new HashMap<>(assocs.size());
int index = 0;
for (ChildAssociationRef assoc : assocs)
{
DispositionActionDefinition da = new DispositionActionDefinitionImpl(services.getRecordsManagementEventService(), services.getRecordsManagementActionService(), nodeService, assoc.getChildRef(), index);
{
DispositionActionDefinition da = new DispositionActionDefinitionImpl(services.getRecordsManagementEventService(), services.getRecordsManagementActionService(), nodeService, assoc.getChildRef(), index);
actions.add(da);
actionsById.put(da.getId(), da);
index++;
String actionNodeName = (String) nodeService.getProperty(assoc.getChildRef(), ContentModel.PROP_NAME);
if (!actionNodeName.equals(da.getId()))
{
//It was imported and now has new ID. Old ID may present in old files.
// It was imported and now has new ID. Old ID may present in old files.
actionsByName.put(actionNodeName, da);
}
String actionDefintionName = (String)nodeService.getProperty(assoc.getChildRef(), PROP_DISPOSITION_ACTION_NAME);
String actionDefintionName = (String) nodeService.getProperty(assoc.getChildRef(), PROP_DISPOSITION_ACTION_NAME);
if (actionDefintionName != null)
{
actionsByDispositionActionName.put(actionDefintionName, da);
}
}
}
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -33,18 +33,16 @@ import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This class offers the default implementation of a strategy for selection of
* disposition schedule for a record when there is more than one which is applicable.
* An example of where this strategy might be used would be in the case of a record
* which was multiply filed.
* This class offers the default implementation of a strategy for selection of disposition schedule for a record when there is more than one which is applicable. An example of where this strategy might be used would be in the case of a record which was multiply filed.
*
* @author neilm
*/
@@ -59,7 +57,8 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
/**
* Set the disposition service
*
* @param dispositionService disposition service
* @param dispositionService
* disposition service
*/
public void setDispositionService(DispositionService dispositionService)
{
@@ -80,25 +79,25 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
}
else
{
// 46 CHAPTER 2
// Records assigned more than 1 disposition must be retained and linked to the record folder (category) with the longest
// retention period.
// 46 CHAPTER 2
// Records assigned more than 1 disposition must be retained and linked to the record folder (category) with the longest
// retention period.
// Assumption: an event-based disposition action has a longer retention
// period than a time-based one - as we cannot know when an event will occur
// TODO Automatic events?
NodeRef recordFolder = null;
if (recordFolders.size() == 1)
{
recordFolder = recordFolders.get(0);
}
else
{
SortedSet<NodeRef> sortedFolders = new TreeSet<>(new DispositionableNodeRefComparator());
sortedFolders.addAll(recordFolders);
recordFolder = sortedFolders.first();
}
NodeRef recordFolder = null;
if (recordFolders.size() == 1)
{
recordFolder = recordFolders.get(0);
}
else
{
SortedSet<NodeRef> sortedFolders = new TreeSet<>(new DispositionableNodeRefComparator());
sortedFolders.addAll(recordFolders);
recordFolder = sortedFolders.first();
}
DispositionSchedule dispSchedule = dispositionService.getDispositionSchedule(recordFolder);
@@ -117,19 +116,14 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
}
/**
* This class defines a natural comparison order between NodeRefs that have
* the dispositionLifecycle aspect applied.
* This order has the following meaning: NodeRefs with a 'lesser' value are considered
* to have a shorter retention period, although the actual retention period may
* not be straightforwardly determined in all cases.
* This class defines a natural comparison order between NodeRefs that have the dispositionLifecycle aspect applied. This order has the following meaning: NodeRefs with a 'lesser' value are considered to have a shorter retention period, although the actual retention period may not be straightforwardly determined in all cases.
*/
class DispositionableNodeRefComparator implements Comparator<NodeRef>
{
public int compare(final NodeRef f1, final NodeRef f2)
{
// Run as admin user
return AuthenticationUtil.runAs(new RunAsWork<Integer>()
{
return AuthenticationUtil.runAs(new RunAsWork<Integer>() {
public Integer doWork()
{
return compareImpl(f1, f2);

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -51,7 +51,8 @@ public interface DispositionService
/**
* Register a disposition property.
*
* @param dispositionProperty disposition property
* @param dispositionProperty
* disposition property
*/
void registerDispositionProperty(DispositionProperty dispositionProperty);
@@ -61,17 +62,17 @@ public interface DispositionService
* @return filtered list of disposition period properties
*/
Collection<DispositionProperty> getDispositionProperties(boolean isRecordLevel, String dispositionAction);
Collection<DispositionProperty> getDispositionProperties();
Collection<DispositionProperty> getDispositionProperties();
/** ========= Disposition Schedule Methods ========= */
/**
* Get the disposition schedule for a given record management node. Traverses the hierarchy to
* find the first disposition schedule in the primary hierarchy.
* Get the disposition schedule for a given record management node. Traverses the hierarchy to find the first disposition schedule in the primary hierarchy.
*
* @param nodeRef node reference to record category, record folder or record
* @return {@link DispositionSchedule} disposition schedule
* @param nodeRef
* node reference to record category, record folder or record
* @return {@link DispositionSchedule} disposition schedule
*/
DispositionSchedule getDispositionSchedule(NodeRef nodeRef);
@@ -79,44 +80,47 @@ public interface DispositionService
// TODO List<DispositionSchedule> getAllDispositionSchedules(NodeRef nodeRef);
/**
* Get the disposition schedule directly associated with the node specified. Returns
* null if none.
* Get the disposition schedule directly associated with the node specified. Returns null if none.
*
* @param nodeRef node reference
* @return {@link DispositionSchedule} disposition schedule directly associated with the node reference, null if none
* @param nodeRef
* node reference
* @return {@link DispositionSchedule} disposition schedule directly associated with the node reference, null if none
*/
DispositionSchedule getAssociatedDispositionSchedule(NodeRef nodeRef);
/**
* Gets the records management container that is directly associated with the disposition schedule.
*
* @param dispositionSchedule disposition schedule
* @return {@link NodeRef} node reference of the associated container
* @param dispositionSchedule
* disposition schedule
* @return {@link NodeRef} node reference of the associated container
*/
NodeRef getAssociatedRecordsManagementContainer(DispositionSchedule dispositionSchedule);
/**
* Indicates whether a disposition schedule has any disposable items under its management
*
* @param dispositionSchdule disposition schedule
* @return boolean true if there are disposable items being managed by, false otherwise
* @param dispositionSchdule
* disposition schedule
* @return boolean true if there are disposable items being managed by, false otherwise
*/
boolean hasDisposableItems(DispositionSchedule dispositionSchdule);
/**
* Gets a list of all the disposable items (records, record folders) that are under the control of
* the disposition schedule.
* Gets a list of all the disposable items (records, record folders) that are under the control of the disposition schedule.
*
* @param dispositionSchedule disposition schedule
* @return {@link List} &lt;{@link NodeRef}&gt; list of disposable items
* @param dispositionSchedule
* disposition schedule
* @return {@link List} &lt;{@link NodeRef}&gt; list of disposable items
*/
List<NodeRef> getDisposableItems(DispositionSchedule dispositionSchedule);
/**
* Indicates whether the node is a disposable item or not (ie is under the control of a disposition schedule)
*
* @param nodeRef node reference
* @return boolean true if node is a disposable item, false otherwise
* @param nodeRef
* node reference
* @return boolean true if node is a disposable item, false otherwise
*/
boolean isDisposableItem(NodeRef nodeRef);
@@ -138,52 +142,57 @@ public interface DispositionService
/**
* Adds a new disposition action definition to the given disposition schedule.
*
* @param schedule The DispositionSchedule to add to
* @param actionDefinitionParams Map of parameters to use to create the action definition
* @param schedule
* The DispositionSchedule to add to
* @param actionDefinitionParams
* Map of parameters to use to create the action definition
*/
DispositionActionDefinition addDispositionActionDefinition(
DispositionSchedule schedule,
Map<QName, Serializable> actionDefinitionParams);
DispositionSchedule schedule,
Map<QName, Serializable> actionDefinitionParams);
/**
* Removes the given disposition action definition from the given disposition
* schedule.
* Removes the given disposition action definition from the given disposition schedule.
*
* @param schedule The DispositionSchedule to remove from
* @param actionDefinition The DispositionActionDefinition to remove
* @param schedule
* The DispositionSchedule to remove from
* @param actionDefinition
* The DispositionActionDefinition to remove
*/
void removeDispositionActionDefinition(
DispositionSchedule schedule,
DispositionActionDefinition actionDefinition);
DispositionSchedule schedule,
DispositionActionDefinition actionDefinition);
/**
* Updates the given disposition action definition belonging to the given disposition
* schedule.
* Updates the given disposition action definition belonging to the given disposition schedule.
*
* @param actionDefinition The DispositionActionDefinition to update
* @param actionDefinitionParams Map of parameters to use to update the action definition
* @param actionDefinition
* The DispositionActionDefinition to update
* @param actionDefinitionParams
* Map of parameters to use to update the action definition
* @return The updated DispositionActionDefinition
*/
DispositionActionDefinition updateDispositionActionDefinition(
DispositionActionDefinition actionDefinition,
Map<QName, Serializable> actionDefinitionParams);
DispositionActionDefinition actionDefinition,
Map<QName, Serializable> actionDefinitionParams);
/** ========= Disposition Action Methods ========= */
/**
* Indicates whether the next disposition action is eligible or not.
*
* @param nodeRef node reference to disposable item
* @return boolean true if next disposition action is eligible, false otherwise
* @param nodeRef
* node reference to disposable item
* @return boolean true if next disposition action is eligible, false otherwise
*/
boolean isNextDispositionActionEligible(NodeRef nodeRef);
/**
* Gets the next disposition action for a given node
*
* @param nodeRef node reference to disposable item
* @return DispositionAction next disposition action, null if none
* @param nodeRef
* node reference to disposable item
* @return DispositionAction next disposition action, null if none
*/
DispositionAction getNextDispositionAction(NodeRef nodeRef);
@@ -191,31 +200,32 @@ public interface DispositionService
// TODO void completeNextDispositionAction(NodeRef nodeRef);
/** ========= Disposition Action History Methods ========= */
/**
* Gets a list of all the completed disposition action in the order they occured.
*
* @param nodeRef record/record folder
* @return List<DispositionAction> list of completed disposition actions
* @param nodeRef
* record/record folder
* @return List<DispositionAction> list of completed disposition actions
*/
List<DispositionAction> getCompletedDispositionActions(NodeRef nodeRef);
/**
* Helper method to get the last completed disposition action. Returns null
* if there is none.
* Helper method to get the last completed disposition action. Returns null if there is none.
*
* @param nodeRef record/record folder
* @return DispositionAction last completed disposition action, null if none
* @param nodeRef
* record/record folder
* @return DispositionAction last completed disposition action, null if none
*/
DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef);
/**
* Indicates whether the disposable item (records, record folders) is cutoff or not.
*
* @param nodeRef node reference
* @return boolean true if the disposable item is cutoff, false otherwise
* @param nodeRef
* node reference
* @return boolean true if the disposable item is cutoff, false otherwise
*
* @since 2.0
*/
@@ -224,7 +234,8 @@ public interface DispositionService
/**
* Marks the disposable item (record or record folder) as cut off, calculating the cut off date
*
* @param nodeRef node reference
* @param nodeRef
* node reference
*
* @since 2.2
*/
@@ -233,31 +244,35 @@ public interface DispositionService
/**
* Updates the next disposition action
*
* @param nodeRef node reference
* @param nodeRef
* node reference
*/
void updateNextDispositionAction(NodeRef nodeRef);
/**
* Updates the next disposition action
*
* @param nodeRef node reference
* @param dispositionSchedule the schedule to be applied
* @param nodeRef
* node reference
* @param dispositionSchedule
* the schedule to be applied
*/
void updateNextDispositionAction(NodeRef nodeRef, DispositionSchedule dispositionSchedule);
/**
* Refreshes the disposition action details of the given node.
*
* @param nodeRef node reference
* @param nodeRef
* node reference
*/
void refreshDispositionAction(NodeRef nodeRef);
/**
* Gets date of the disposition action for the given
* disposition schedule with the given action name
* Gets date of the disposition action for the given disposition schedule with the given action name
*
* @param record
* @param dispositionSchedule nodeRef
* @param dispositionSchedule
* nodeRef
* @param dispositionActionName
* @return date
*/
@@ -266,24 +281,25 @@ public interface DispositionService
/**
* Compute the "disposition as of" date (if necessary) for a disposition action and a node.
*
* @param nodeRef The node which the schedule applies to.
* @param dispositionActionDefinition The definition of the disposition action.
* @param nodeRef
* The node which the schedule applies to.
* @param dispositionActionDefinition
* The definition of the disposition action.
* @return The new "disposition as of" date.
*/
Date calculateAsOfDate(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition);
/**
* Gets the origin disposition schedule for the record, not the calculated one
* in case of multiple dispositions applied to record
* Gets the origin disposition schedule for the record, not the calculated one in case of multiple dispositions applied to record
*
* @param nodeRef record
* @param nodeRef
* record
* @return the initial disposition
*/
DispositionSchedule getOriginDispositionSchedule(NodeRef nodeRef);
/**
* Updates disposition action step when linking or unlinking
* the given record to/from a record folder
* Updates disposition action step when linking or unlinking the given record to/from a record folder
*
* @param record
*/

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -37,6 +37,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies;
@@ -72,8 +75,6 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ParameterCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Disposition service implementation.
@@ -81,10 +82,10 @@ import org.slf4j.LoggerFactory;
* @author Roy Wetherall
*/
@BehaviourBean
public class DispositionServiceImpl extends ServiceBaseImpl
implements DispositionService,
RecordsManagementModel,
RecordsManagementPolicies.OnFileRecord
public class DispositionServiceImpl extends ServiceBaseImpl
implements DispositionService,
RecordsManagementModel,
RecordsManagementPolicies.OnFileRecord
{
/** Logger */
private static final Logger LOGGER = LoggerFactory.getLogger(DispositionServiceImpl.class);
@@ -97,8 +98,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/** Only set the "disposition as of" date. */
DATE_ONLY,
/**
* Set the "disposition as of" date and the name of the next action. This only happens during the creation of a
* disposition schedule impl node under a record or folder.
* Set the "disposition as of" date and the name of the next action. This only happens during the creation of a disposition schedule impl node under a record or folder.
*/
DATE_AND_NAME
}
@@ -127,7 +127,8 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Set node service
*
* @param nodeService the node service
* @param nodeService
* the node service
*/
@Override
public void setNodeService(NodeService nodeService)
@@ -138,7 +139,8 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Set the dictionary service
*
* @param dictionaryService the dictionary service
* @param dictionaryService
* the dictionary service
*/
@Override
public void setDictionaryService(DictionaryService dictionaryService)
@@ -149,7 +151,8 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Set the behaviour filter.
*
* @param behaviourFilter the behaviour filter
* @param behaviourFilter
* the behaviour filter
*/
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
{
@@ -159,7 +162,8 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Set the records management service registry
*
* @param serviceRegistry records management registry service
* @param serviceRegistry
* records management registry service
*/
public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry)
{
@@ -167,15 +171,17 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
/**
* @param filePlanService file plan service
* @param filePlanService
* file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
this.filePlanService = filePlanService;
}
/**
* @param recordFolderService record folder service
* @param recordFolderService
* record folder service
*/
public void setRecordFolderService(RecordFolderService recordFolderService)
{
@@ -183,15 +189,17 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
/**
* @param recordService record service
* @param recordService
* record service
*/
public void setRecordService(RecordService recordService)
{
this.recordService = recordService;
this.recordService = recordService;
}
/**
* @param transactionService transaction service
* @param transactionService
* transaction service
*/
public void setTransactionService(TransactionService transactionService)
{
@@ -204,7 +212,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
* @see RecordsManagementPolicies.OnFileRecord#onFileRecord(NodeRef)
*/
@Override
@Behaviour(kind=BehaviourKind.CLASS, type="rma:record")
@Behaviour(kind = BehaviourKind.CLASS, type = "rma:record")
public void onFileRecord(NodeRef nodeRef)
{
// initialise disposition details
@@ -293,8 +301,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
if (isRecord(nodeRef))
{
// calculate disposition schedule without taking into account the user
DispositionSchedule originDispositionSchedule = AuthenticationUtil.runAsSystem(new RunAsWork<DispositionSchedule>()
{
DispositionSchedule originDispositionSchedule = AuthenticationUtil.runAsSystem(new RunAsWork<DispositionSchedule>() {
@Override
public DispositionSchedule doWork()
{
@@ -302,18 +309,18 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
});
// if the initial disposition schedule of the record is folder based
if (originDispositionSchedule == null ||
if (originDispositionSchedule == null ||
isNotTrue(originDispositionSchedule.isRecordLevelDisposition()))
{
return null;
}
final NextActionFromDisposition dsNextAction = getDispositionActionByNameForRecord(nodeRef);
if (dsNextAction != null)
{
final NodeRef action = dsNextAction.getNextActionNodeRef();
if (isNotTrue((Boolean)nodeService.getProperty(action, PROP_MANUALLY_SET_AS_OF)) && !dsNextAction.getWriteMode().equals(WriteMode.READ_ONLY))
if (isNotTrue((Boolean) nodeService.getProperty(action, PROP_MANUALLY_SET_AS_OF)) && !dsNextAction.getWriteMode().equals(WriteMode.READ_ONLY))
{
final String dispositionActionName = dsNextAction.getNextActionName();
final Date dispositionActionDate = dsNextAction.getNextActionDateAsOf();
@@ -342,7 +349,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
nodeService.setProperty(action, PROP_DISPOSITION_ACTION_NAME, dispositionActionName);
}
}
dsNodeRef = dsNextAction.getDispositionNodeRef();
}
}
@@ -361,8 +368,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
/**
* This method returns a NodeRef
* Gets the disposition instructions
* This method returns a NodeRef Gets the disposition instructions
*
* @param nodeRef
* @return
@@ -388,7 +394,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
NodeRef parent = this.nodeService.getPrimaryParent(nodeRef).getParentRef();
if (parent != null)
{
if (filePlanService.isRecordCategory(parent))
if (filePlanService.isRecordCategory(parent))
{
NodeRef result = getAssociatedDispositionScheduleImpl(parent);
if (result == null)
@@ -401,7 +407,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
return getOriginDispositionSchedule(parent);
}
}
}
return null;
}
@@ -432,8 +438,9 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Gets the node reference of the disposition schedule associated with the container.
*
* @param nodeRef node reference of the container
* @return {@link NodeRef} node reference of the disposition schedule, null if none
* @param nodeRef
* node reference of the container
* @return {@link NodeRef} node reference of the disposition schedule, null if none
*/
private NodeRef getAssociatedDispositionScheduleImpl(NodeRef nodeRef)
{
@@ -476,7 +483,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
if (assocs.size() != 1)
{
// TODO in the future we should be able to support disposition schedule reuse, but for now just warn that
// only the first disposition schedule will be considered
// only the first disposition schedule will be considered
LOGGER.atWarn().log("Retention schedule has more than one associated records management container. " +
"This is not currently supported so only the first container will be considered. " +
"(dispositionScheduleNodeRef={})", dispositionSchedule.getNodeRef());
@@ -506,10 +513,8 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
/**
* Method that provides a boolean if given Records Management Container has disposable items.
* This method is similar to getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer) but with improved performance:
* For RecordLevelDisposition it will limit Record retrieval to 1.
* Early returns once the first occurrence is found.
* Method that provides a boolean if given Records Management Container has disposable items. This method is similar to getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer) but with improved performance: For RecordLevelDisposition it will limit Record retrieval to 1. Early returns once the first occurrence is found.
*
* @param isRecordLevelDisposition
* @param rmContainer
* @return
@@ -615,7 +620,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
// Check is sub-type of rm:recordCategory
QName nodeRefType = nodeService.getType(nodeRef);
if (!TYPE_RECORD_CATEGORY.equals(nodeRefType) &&
!dictionaryService.isSubClass(nodeRefType, TYPE_RECORD_CATEGORY))
!dictionaryService.isSubClass(nodeRefType, TYPE_RECORD_CATEGORY))
{
throw new InvalidArgumentException("The given id:'" + nodeRef.getId() + "' (nodeType:" + nodeRef
+ ") is not valid. Expected nodeType is:" + TYPE_RECORD_CATEGORY);
@@ -635,15 +640,15 @@ public class DispositionServiceImpl extends ServiceBaseImpl
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL);
if (assocs.isEmpty())
{
DispositionSchedule currentDispositionSchdule = getDispositionSchedule(nodeRef);
if (currentDispositionSchdule != null)
{
List<NodeRef> items = getDisposableItemsImpl(currentDispositionSchdule.isRecordLevelDisposition(), nodeRef);
if (!items.isEmpty())
{
throw new AlfrescoRuntimeException("Can not create a retention schedule if there are disposable items already under the control of an other retention schedule");
}
}
DispositionSchedule currentDispositionSchdule = getDispositionSchedule(nodeRef);
if (currentDispositionSchdule != null)
{
List<NodeRef> items = getDisposableItemsImpl(currentDispositionSchdule.isRecordLevelDisposition(), nodeRef);
if (!items.isEmpty())
{
throw new AlfrescoRuntimeException("Can not create a retention schedule if there are disposable items already under the control of an other retention schedule");
}
}
// Create the disposition schedule object
dsNodeRef = nodeService.createNode(
@@ -675,11 +680,11 @@ public class DispositionServiceImpl extends ServiceBaseImpl
*/
@Override
public DispositionActionDefinition addDispositionActionDefinition(
DispositionSchedule schedule,
Map<QName, Serializable> actionDefinitionParams)
DispositionSchedule schedule,
Map<QName, Serializable> actionDefinitionParams)
{
// make sure at least a name has been defined
String name = (String)actionDefinitionParams.get(PROP_DISPOSITION_ACTION_NAME);
String name = (String) actionDefinitionParams.get(PROP_DISPOSITION_ACTION_NAME);
if (name == null || name.isEmpty())
{
throw new IllegalArgumentException("'name' parameter is mandatory when creating a disposition action definition");
@@ -689,10 +694,10 @@ public class DispositionServiceImpl extends ServiceBaseImpl
// create the child association from the schedule to the action definition
NodeRef actionNodeRef = this.nodeService.createNode(schedule.getNodeRef(),
ASSOC_DISPOSITION_ACTION_DEFINITIONS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
QName.createValidLocalName(name)),
TYPE_DISPOSITION_ACTION_DEFINITION, actionDefinitionParams).getChildRef();
ASSOC_DISPOSITION_ACTION_DEFINITIONS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
QName.createValidLocalName(name)),
TYPE_DISPOSITION_ACTION_DEFINITION, actionDefinitionParams).getChildRef();
// get the updated disposition schedule and retrieve the new action definition
NodeRef scheduleParent = this.nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef();
@@ -710,7 +715,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
if (hasDisposableItems(schedule))
{
throw new AlfrescoRuntimeException("Can not remove action definitions from schedule '" +
schedule.getNodeRef() + "' as one or more record or record folders are present.");
schedule.getNodeRef() + "' as one or more record or record folders are present.");
}
// remove the child node representing the action definition
@@ -718,17 +723,18 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
/**
* Updates the given disposition action definition belonging to the given disposition
* schedule.
* Updates the given disposition action definition belonging to the given disposition schedule.
*
* @param actionDefinition The DispositionActionDefinition to update
* @param actionDefinitionParams Map of parameters to use to update the action definition
* @param actionDefinition
* The DispositionActionDefinition to update
* @param actionDefinitionParams
* Map of parameters to use to update the action definition
* @return The updated DispositionActionDefinition
*/
@Override
public DispositionActionDefinition updateDispositionActionDefinition(
DispositionActionDefinition actionDefinition,
Map<QName, Serializable> actionDefinitionParams)
DispositionActionDefinition actionDefinition,
Map<QName, Serializable> actionDefinitionParams)
{
// update the node with properties
this.nodeService.addProperties(actionDefinition.getNodeRef(), actionDefinitionParams);
@@ -742,11 +748,12 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/** ========= Disposition Action Methods ========= */
/**
* Initialises the details of the next disposition action based on the details of a disposition
* action definition.
* Initialises the details of the next disposition action based on the details of a disposition action definition.
*
* @param nodeRef node reference
* @param dispositionActionDefinition disposition action definition
* @param nodeRef
* node reference
* @param dispositionActionDefinition
* disposition action definition
*/
private DispositionAction initialiseDispositionAction(final NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition)
{
@@ -771,12 +778,12 @@ public class DispositionServiceImpl extends ServiceBaseImpl
DispositionAction da;
// check if current transaction is a READ ONLY one and if true create the node in a READ WRITE transaction
if (AlfrescoTransactionSupport.getTransactionReadState().equals(TxnReadState.TXN_READ_ONLY)) {
if (AlfrescoTransactionSupport.getTransactionReadState().equals(TxnReadState.TXN_READ_ONLY))
{
da = transactionService.getRetryingTransactionHelper().doInTransaction(
() -> createDispositionAction(nodeRef, props),
false,
true
);
true);
}
else
{
@@ -793,10 +800,13 @@ public class DispositionServiceImpl extends ServiceBaseImpl
return da;
}
/** Creates a new disposition action object
/**
* Creates a new disposition action object
*
* @param nodeRef node reference
* @param props properties of the disposition action to be created
* @param nodeRef
* node reference
* @param props
* properties of the disposition action to be created
* @return the disposition action object
*/
private DispositionAction createDispositionAction(final NodeRef nodeRef, Map<QName, Serializable> props)
@@ -814,8 +824,10 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Compute the "disposition as of" date (if necessary) for a disposition action and a node.
*
* @param nodeRef The node which the schedule applies to.
* @param dispositionActionDefinition The definition of the disposition action.
* @param nodeRef
* The node which the schedule applies to.
* @param dispositionActionDefinition
* The definition of the disposition action.
* @return The new "disposition as of" date.
*/
@Override
@@ -841,7 +853,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
else
{
contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty);
contextDate = (Date) this.nodeService.getProperty(nodeRef, periodProperty);
}
}
@@ -849,14 +861,14 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
// doesn't matter if the period property isn't set ... the asOfDate will get updated later
// when the value of the period property is set
contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty);
contextDate = (Date) this.nodeService.getProperty(nodeRef, periodProperty);
}
}
else
{
if (period.getPeriodType().equals(Immediately.PERIOD_TYPE))
{
contextDate = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
contextDate = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
}
else
{
@@ -922,7 +934,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
DispositionActionDefinition dad = da.getDispositionActionDefinition();
if (dad != null)
{
boolean firstComplete = authenticationUtil.runAsSystem(() -> dad.eligibleOnFirstCompleteEvent());
boolean firstComplete = authenticationUtil.runAsSystem(() -> dad.eligibleOnFirstCompleteEvent());
List<ChildAssociationRef> assocs = getInternalNodeService().getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS,
RegexQNamePattern.MATCH_ALL);
@@ -960,10 +972,11 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
/**
* Get the next disposition action node. Null if none present.
* Get the next disposition action node. Null if none present.
*
* @param nodeRef the disposable node reference
* @return NodeRef the next disposition action, null if none
* @param nodeRef
* the disposable node reference
* @return NodeRef the next disposition action, null if none
*/
private NodeRef getNextDispositionActionNodeRef(NodeRef nodeRef)
{
@@ -992,7 +1005,6 @@ public class DispositionServiceImpl extends ServiceBaseImpl
return result;
}
/** ========= Disposition Action History Methods ========= */
/**
@@ -1017,14 +1029,14 @@ public class DispositionServiceImpl extends ServiceBaseImpl
@Override
public DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef)
{
DispositionAction result = null;
List<DispositionAction> list = getCompletedDispositionActions(nodeRef);
if (!list.isEmpty())
{
// Get the last disposition action in the list
result = list.get(list.size()-1);
}
return result;
DispositionAction result = null;
List<DispositionAction> list = getCompletedDispositionActions(nodeRef);
if (!list.isEmpty())
{
// Get the last disposition action in the list
result = list.get(list.size() - 1);
}
return result;
}
/**
@@ -1045,8 +1057,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
ParameterCheck.mandatory("nodeRef", nodeRef);
RunAsWork<Void> runAsWork = new RunAsWork<Void>()
{
RunAsWork<Void> runAsWork = new RunAsWork<Void>() {
/**
* @see RunAsWork#doWork()
*/
@@ -1073,9 +1084,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
public void updateNextDispositionAction(final NodeRef nodeRef, final DispositionSchedule dispositionSchedule)
{
RunAsWork<Void> runAsWork = new RunAsWork<Void>()
{
RunAsWork<Void> runAsWork = new RunAsWork<Void>() {
/**
* @see RunAsWork#doWork()
*/
@@ -1119,7 +1128,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
// When the record has multiple disposition schedules the current disposition action may not be found by id
// In this case it will be searched by name
if(currentDispositionActionDefinition == null)
if (currentDispositionActionDefinition == null)
{
String currentADName = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION);
currentDispositionActionDefinition = dispositionSchedule.getDispositionActionDefinitionByName(currentADName);
@@ -1163,7 +1172,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
// check that the node ref is a filed record or record folder
if (FilePlanComponentKind.RECORD_FOLDER.equals(filePlanService.getFilePlanComponentKind(nodeRef)) ||
FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef)))
FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef)))
{
if (!isDisposableItemCutoff(nodeRef))
{
@@ -1180,18 +1189,17 @@ public class DispositionServiceImpl extends ServiceBaseImpl
applyCutoff(nodeRef);
// remove uncut off aspect if applied
if(nodeService.hasAspect(nodeRef, ASPECT_UNCUT_OFF))
if (nodeService.hasAspect(nodeRef, ASPECT_UNCUT_OFF))
{
nodeService.removeAspect(nodeRef, ASPECT_UNCUT_OFF);
}
// close the record folder if it isn't already closed!
if (recordFolderService.isRecordFolder(nodeRef) &&
!recordFolderService.isRecordFolderClosed(nodeRef))
!recordFolderService.isRecordFolderClosed(nodeRef))
{
// runAs system so that we can close a record that has already been cutoff
authenticationUtil.runAsSystem(new RunAsWork<Void>()
{
authenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork() throws Exception
{
@@ -1237,9 +1245,9 @@ public class DispositionServiceImpl extends ServiceBaseImpl
public void recalculateNextDispositionStep(NodeRef record)
{
List<NodeRef> recordFolders = recordFolderService.getRecordFolders(record);
DispositionAction nextDispositionAction = getNextDispositionAction(record);
if (nextDispositionAction != null)
{
NextActionFromDisposition dsNextAction = getNextDispositionAction(record, recordFolders, nextDispositionAction);
@@ -1247,8 +1255,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
final NodeRef action = dsNextAction.getNextActionNodeRef();
final Date dispositionActionDate = dsNextAction.getNextActionDateAsOf();
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork()
{
@@ -1263,12 +1270,12 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Helper method to apply the cut off
*
* @param nodeRef node to cut off
* @param nodeRef
* node to cut off
*/
private void applyCutoff(final NodeRef nodeRef)
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork()
{
@@ -1282,14 +1289,12 @@ public class DispositionServiceImpl extends ServiceBaseImpl
});
}
/**
* Calculate next disposition action for a record
*
* @param record
* @return next disposition action (name, date) and the disposition associated
*/
/**
* Calculate next disposition action for a record
*
* @param record
* @return next disposition action (name, date) and the disposition associated
*/
protected NextActionFromDisposition getDispositionActionByNameForRecord(NodeRef record)
{
@@ -1315,6 +1320,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Calculate next disposition action when the record already has one
*
* @param recordFolders
* @param nextDispositionAction
* @return next disposition action and the associated disposition schedule
@@ -1335,7 +1341,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
Date dispActionDate = getDispositionActionDate(record, dsNodeRef, recordNextDispositionActionName);
if (dispActionDate == null || (nextDispositionActionDate != null
&& nextDispositionActionDate.before(dispActionDate)))
&& nextDispositionActionDate.before(dispActionDate)))
{
nextDispositionActionDate = dispActionDate;
dispositionNodeRef = dsNodeRef;
@@ -1349,7 +1355,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
if (dispositionNodeRef == null)
{
return null;
return null;
}
WriteMode mode = determineWriteMode(recordNextDispositionActionDate, nextDispositionActionDate);
@@ -1358,12 +1364,12 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
/**
* Determine what should be updated for an existing disposition schedule impl. We only update the date if the
* existing date is earlier than the calculated one.
* Determine what should be updated for an existing disposition schedule impl. We only update the date if the existing date is earlier than the calculated one.
*
* @param recordNextDispositionActionDate The next action date found on the record node (or folder node).
* @param nextDispositionActionDate The next action date calculated from the current disposition schedule(s)
* affecting the node.
* @param recordNextDispositionActionDate
* The next action date found on the record node (or folder node).
* @param nextDispositionActionDate
* The next action date calculated from the current disposition schedule(s) affecting the node.
* @return READ_ONLY if nothing should be updated, or DATE_ONLY if the date needs updating.
*/
private WriteMode determineWriteMode(Date recordNextDispositionActionDate, Date nextDispositionActionDate)
@@ -1379,6 +1385,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
/**
* Calculate first disposition action when the record doesn't have one
*
* @param recordFolders
* @return next disposition action and the associated disposition schedule
*/
@@ -1405,20 +1412,20 @@ public class DispositionServiceImpl extends ServiceBaseImpl
if (newAction == null)
{
NodeRef recordOrFolder = record;
if (!ds.isRecordLevelDisposition())
if (!ds.isRecordLevelDisposition())
{
recordOrFolder = folder;
}
DispositionAction firstDispositionAction = initialiseDispositionAction(recordOrFolder, firstDispositionActionDef);
newAction = firstDispositionAction.getNodeRef();
newDispositionActionName = (String)nodeService.getProperty(newAction, PROP_DISPOSITION_ACTION_NAME);
newDispositionActionName = (String) nodeService.getProperty(newAction, PROP_DISPOSITION_ACTION_NAME);
newDispositionActionDateAsOf = firstDispositionAction.getAsOfDate();
}
else if (firstDispositionActionDef.getPeriod() != null)
{
Date firstActionDate = calculateAsOfDate(record, firstDispositionActionDef);
if (firstActionDate == null || (newDispositionActionDateAsOf != null
&& newDispositionActionDateAsOf.before(firstActionDate)))
&& newDispositionActionDateAsOf.before(firstActionDate)))
{
newDispositionActionName = firstDispositionActionDef.getName();
newDispositionActionDateAsOf = firstActionDate;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -60,7 +60,7 @@ import org.alfresco.service.namespace.QName;
*/
@BehaviourBean
public class DispositionProperty extends BaseBehaviourBean
implements NodeServicePolicies.OnUpdatePropertiesPolicy
implements NodeServicePolicies.OnUpdatePropertiesPolicy
{
/** Property QName */
private QName propertyName;
@@ -81,7 +81,8 @@ public class DispositionProperty extends BaseBehaviourBean
private Set<String> excludedDispositionActions;
/**
* @param namespaceService namespace service
* @param namespaceService
* namespace service
*/
public void setNamespaceService(NamespaceService namespaceService)
{
@@ -89,7 +90,8 @@ public class DispositionProperty extends BaseBehaviourBean
}
/**
* @param dispositionService disposition service
* @param dispositionService
* disposition service
*/
public void setDispositionService(DispositionService dispositionService)
{
@@ -97,7 +99,8 @@ public class DispositionProperty extends BaseBehaviourBean
}
/**
* @param propertyName property name (as string)
* @param propertyName
* property name (as string)
*/
public void setName(String propertyName)
{
@@ -105,7 +108,7 @@ public class DispositionProperty extends BaseBehaviourBean
}
/**
* @return property QName
* @return property QName
*/
public QName getQName()
{
@@ -113,7 +116,7 @@ public class DispositionProperty extends BaseBehaviourBean
}
/**
* @return property definition
* @return property definition
*/
public PropertyDefinition getPropertyDefinition()
{
@@ -121,7 +124,8 @@ public class DispositionProperty extends BaseBehaviourBean
}
/**
* @param excludedDispositionActions list of excluded disposition actions
* @param excludedDispositionActions
* list of excluded disposition actions
*/
public void setExcludedDispositionActions(Set<String> excludedDispositionActions)
{
@@ -156,16 +160,18 @@ public class DispositionProperty extends BaseBehaviourBean
/**
* Indicates whether the disposition property applies given the context.
*
* @param isRecordLevel true if record level disposition schedule, false otherwise
* @param dispositionAction disposition action name
* @return boolean true if applies, false otherwise
* @param isRecordLevel
* true if record level disposition schedule, false otherwise
* @param dispositionAction
* disposition action name
* @return boolean true if applies, false otherwise
*/
public boolean applies(boolean isRecordLevel, String dispositionAction)
{
boolean result = false;
if ((isRecordLevel && appliesToRecordLevel) ||
(!isRecordLevel && appliesToFolderLevel))
(!isRecordLevel && appliesToFolderLevel))
{
if (excludedDispositionActions != null && excludedDispositionActions.size() != 0)
{
@@ -187,12 +193,10 @@ public class DispositionProperty extends BaseBehaviourBean
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/
@Override
@Behaviour
(
@Behaviour(
kind = BehaviourKind.CLASS,
type = "rma:dispositionLifecycle",
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT)
public void onUpdateProperties(
final NodeRef nodeRef,
final Map<QName, Serializable> before,
@@ -203,12 +207,11 @@ public class DispositionProperty extends BaseBehaviourBean
// has the property we care about changed?
if (isPropertyUpdated(before, after))
{
AuthenticationUtil.runAs(new RunAsWork<Void>()
{
AuthenticationUtil.runAs(new RunAsWork<Void>() {
@Override
public Void doWork()
{
Date updatedDateValue = (Date)after.get(propertyName);
Date updatedDateValue = (Date) after.get(propertyName);
if (updatedDateValue != null)
{
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef);
@@ -238,7 +241,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
throw new AlfrescoRuntimeException(
"Error updating property " + propertyName.toPrefixString(namespaceService) +
" to null, because property is being used to determine a disposition date.");
" to null, because property is being used to determine a disposition date.");
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,11 +47,11 @@ public class BasicIdentifierGenerator extends IdentifierGeneratorBase
@Override
public String generateId(Map<String, Serializable> context)
{
NodeRef nodeRef = (NodeRef)context.get(IdentifierService.CONTEXT_NODEREF);
NodeRef nodeRef = (NodeRef) context.get(IdentifierService.CONTEXT_NODEREF);
Long dbId = 0l;
if (nodeRef != null)
{
dbId = (Long)nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID);
dbId = (Long) nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID);
}
else
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -43,14 +43,17 @@ public interface IdentifierGenerator
{
/**
* The content type this generator is applicible to.
* @return QName the type
*
* @return QName the type
*/
QName getType();
/**
* Generates the next id based on the provided context.
* @param context map of context values
* @return String the next id
*
* @param context
* map of context values
* @return String the next id
*/
String generateId(Map<String, Serializable> context);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -37,13 +37,13 @@ public abstract class IdentifierGeneratorBase implements IdentifierGenerator
{
/** Identifier service */
private IdentifierService identifierService;
/** Node service */
protected NodeService nodeService;
/** Content type */
private QName type;
private QName type;
/**
* Initialisation method
*/
@@ -51,37 +51,40 @@ public abstract class IdentifierGeneratorBase implements IdentifierGenerator
{
identifierService.register(this);
}
/**
* Set identifier service.
*
* @param identifierService identifier service
* @param identifierService
* identifier service
*/
public void setIdentifierService(IdentifierService identifierService)
{
this.identifierService = identifierService;
}
/**
* Set the node service
*
* @param nodeService node service
* @param nodeService
* node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* Set type.
*
* @param type content type
* @param type
* content type
*/
public void setTypeAsString(String type)
{
this.type = QName.createQName(type);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator#getType()
*/
@@ -90,12 +93,14 @@ public abstract class IdentifierGeneratorBase implements IdentifierGenerator
{
return type;
}
/**
* Function to pad a string with zero '0' characters to the required length
*
* @param s String to pad with leading zero '0' characters
* @param len Length to pad to
* @param s
* String to pad with leading zero '0' characters
* @param len
* Length to pad to
* @return padded string or the original if already at &gt;=len characters
*/
protected String padString(String s, int len)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,24 +47,28 @@ public interface IdentifierService
/**
* Register an identifier generator implementation with the service.
*
* @param identifierGenerator identifier generator implementation
* @param identifierGenerator
* identifier generator implementation
*/
void register(IdentifierGenerator identifierGenerator);
/**
* Generate an identifier for a node with the given type and parent.
*
* @param type type of the node
* @param parent parent of the ndoe
* @return String generated identifier
* @param type
* type of the node
* @param parent
* parent of the ndoe
* @return String generated identifier
*/
String generateIdentifier(QName type, NodeRef parent);
/**
* Generate an identifier for the given node.
*
* @param nodeRef node reference
* @return String generated identifier
* @param nodeRef
* node reference
* @return String generated identifier
*/
String generateIdentifier(NodeRef nodeRef);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -31,6 +31,9 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.dictionary.ClassDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -39,8 +42,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @author Roy Wetherall
@@ -62,7 +63,8 @@ public class IdentifierServiceImpl implements IdentifierService
/**
* Set the node service
*
* @param nodeService node service
* @param nodeService
* node service
*/
public void setNodeService(NodeService nodeService)
{
@@ -72,7 +74,8 @@ public class IdentifierServiceImpl implements IdentifierService
/**
* Set the dictionary service
*
* @param dictionaryService dictionary service
* @param dictionaryService
* dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
@@ -131,9 +134,11 @@ public class IdentifierServiceImpl implements IdentifierService
/**
* Generate an identifier for a given type of object with the accompanying context.
*
* @param type content type
* @param context context
* @return String identifier
* @param type
* content type
* @param context
* context
* @return String identifier
*/
private String generateIdentifier(QName type, Map<String, Serializable> context)
{
@@ -165,7 +170,8 @@ public class IdentifierServiceImpl implements IdentifierService
/**
*
* @param type content type (could be aspect or type)
* @param type
* content type (could be aspect or type)
* @return
*/
private IdentifierGenerator lookupGenerator(QName type)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -34,6 +34,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
@@ -58,14 +63,9 @@ import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.util.ParameterCheck;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* Helper bean containing methods useful when sending records
* management notifications via the {@link NotificationService}
* Helper bean containing methods useful when sending records management notifications via the {@link NotificationService}
*
* @author Roy Wetherall
*/
@@ -101,7 +101,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
private NodeRef rejectedTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_rejected_template");
/**
* @param notificationService notification service
* @param notificationService
* notification service
*/
public void setNotificationService(NotificationService notificationService)
{
@@ -109,7 +110,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param filePlanService file plan service
* @param filePlanService
* file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
@@ -117,7 +119,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param filePlanRoleService file plan role service
* @param filePlanRoleService
* file plan role service
*/
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
@@ -125,7 +128,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param notificationRole rm notification role
* @param notificationRole
* rm notification role
*/
public void setNotificationRole(String notificationRole)
{
@@ -133,7 +137,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param searchService search service
* @param searchService
* search service
*/
public void setSearchService(SearchService searchService)
{
@@ -141,7 +146,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param namespaceService namespace service
* @param namespaceService
* namespace service
*/
public void setNamespaceService(NamespaceService namespaceService)
{
@@ -149,7 +155,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param siteService site service
* @param siteService
* site service
*/
public void setSiteService(SiteService siteService)
{
@@ -157,7 +164,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param authorityService authority service
* @param authorityService
* authority service
*/
public void setAuthorityService(AuthorityService authorityService)
{
@@ -165,7 +173,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param nodeService node service
* @param nodeService
* node service
*/
public void setNodeService(NodeService nodeService)
{
@@ -173,7 +182,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @param tenantAdminService tenant admin service
* @param tenantAdminService
* tenant admin service
*/
public void setTenantAdminService(TenantAdminService tenantAdminService)
{
@@ -181,7 +191,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @return superseded email template
* @return superseded email template
*/
public NodeRef getSupersededTemplate()
{
@@ -189,7 +199,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @return rejected email template
* @return rejected email template
*/
public NodeRef getRejectedTemplate()
{
@@ -197,18 +207,17 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
/**
* @return due for review email template
* @return due for review email template
*/
public NodeRef getDueForReviewTemplate()
{
if (dueForReviewTemplate == null)
{
List<NodeRef> nodeRefs =
searchService.selectNodes(
getRootNode(),
"app:company_home/app:dictionary/cm:records_management/cm:records_management_email_templates/cm:notify-records-due-for-review-email.ftl", null,
namespaceService,
false);
List<NodeRef> nodeRefs = searchService.selectNodes(
getRootNode(),
"app:company_home/app:dictionary/cm:records_management/cm:records_management_email_templates/cm:notify-records-due-for-review-email.ftl", null,
namespaceService,
false);
if (nodeRefs.size() == 1)
{
dueForReviewTemplate = nodeRefs.get(0);
@@ -220,13 +229,12 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Helper method to get root node in a tenant safe way.
*
* @return NodeRef root node of spaces store
* @return NodeRef root node of spaces store
*/
private NodeRef getRootNode()
{
String tenantDomain = tenantAdminService.getCurrentUserDomain();
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<NodeRef>()
{
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<NodeRef>() {
public NodeRef doWork()
{
return nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
@@ -237,7 +245,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Sends records due for review email notification.
*
* @param records records due for review
* @param records
* records due for review
*/
public void recordsDueForReviewEmailNotification(final List<NodeRef> records)
{
@@ -274,7 +283,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
throw new AlfrescoRuntimeException(
"Unable to send record due for review email notification, because notification group was empty.");
"Unable to send record due for review email notification, because notification group was empty.");
}
}
}
@@ -283,7 +292,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Sends record superseded email notification.
*
* @param record superseded record
* @param record
* superseded record
*/
public void recordSupersededEmailNotification(final NodeRef record)
{
@@ -321,7 +331,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Sends record rejected email notification.
*
* @param record rejected record
* @param record
* rejected record
*/
public void recordRejectedEmailNotification(NodeRef record, String recordId, String recordCreator)
{
@@ -360,7 +371,8 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Helper method to check if the mandatory properties are set
*
* @param record rejected record
* @param record
* rejected record
*/
private boolean canSendRejectEmail(NodeRef record, String recordCreator)
{
@@ -401,13 +413,13 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Gets the rm root given a context node.
*
* @param context context node reference
* @return {@link NodeRef} rm root node reference
* @param context
* context node reference
* @return {@link NodeRef} rm root node reference
*/
private NodeRef getRMRoot(final NodeRef context)
{
return AuthenticationUtil.runAs(new RunAsWork<NodeRef>()
{
return AuthenticationUtil.runAs(new RunAsWork<NodeRef>() {
@Override
public NodeRef doWork()
{
@@ -421,13 +433,13 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Gets the group name for the notification role.
*
* @param root rm root node
* @return String notification role's group name
* @param root
* rm root node
* @return String notification role's group name
*/
private String getGroupName(final NodeRef root)
{
return AuthenticationUtil.runAs(new RunAsWork<String>()
{
return AuthenticationUtil.runAs(new RunAsWork<String>() {
@Override
public String doWork()
{
@@ -440,8 +452,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
private boolean doesGroupContainUsers(final String groupName)
{
return AuthenticationUtil.runAs(new RunAsWork<Boolean>()
{
return AuthenticationUtil.runAs(new RunAsWork<Boolean>() {
@Override
public Boolean doWork() throws Exception
{
@@ -454,13 +465,13 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
/**
* Get the site name, default if none/undetermined.
*
* @param root rm root
* @return String site name
* @param root
* rm root
* @return String site name
*/
private String getSiteName(final NodeRef root)
{
return AuthenticationUtil.runAs(new RunAsWork<String>()
{
return AuthenticationUtil.runAs(new RunAsWork<String>() {
@Override
public String doWork()
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -49,26 +49,38 @@ public class RecordsManagementPermissionPostProcessor extends PermissionPostProc
{
/** node service */
private NodeService nodeService;
public void setNodeService(NodeService nodeService) {this.nodeService=nodeService;}
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/** permission service */
private PermissionService permissionService;
public void setPermissionService(PermissionService permissionService) {this.permissionService=permissionService;}
public void setPermissionService(PermissionService permissionService)
{
this.permissionService = permissionService;
}
/** The permission model DAO. */
private PermissionModel permissionModel;
public void setPermissionModel(PermissionModel permissionModel) {this.permissionModel=permissionModel;}
public void setPermissionModel(PermissionModel permissionModel)
{
this.permissionModel = permissionModel;
}
/**
* @see org.alfresco.repo.security.permissions.processor.PermissionPostProcessor#process(AccessStatus, NodeRef, String, List, List)
*/
@Override
public AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm,
List<String> configuredReadPermissions, List<String> configuredFilePermissions)
List<String> configuredReadPermissions, List<String> configuredFilePermissions)
{
AccessStatus result = accessStatus;
if (AccessStatus.DENIED.equals(accessStatus) &&
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
{
// if read denied on rm artifact
if (PermissionService.READ.equals(perm) || isPermissionContained(perm, configuredReadPermissions))
@@ -91,8 +103,10 @@ public class RecordsManagementPermissionPostProcessor extends PermissionPostProc
/**
* Check if a given permission is implied by a list of permission groups.
*
* @param perm The name of the permission in question.
* @param configuredPermissions The list of permission group names.
* @param perm
* The name of the permission in question.
* @param configuredPermissions
* The list of permission group names.
* @return true if the permission is contained or implied by the list of permissions.
*/
private boolean isPermissionContained(String perm, List<String> configuredPermissions)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -45,7 +45,8 @@ public interface RecordableVersionConfigService
/**
* Gets the recordable versions
*
* @param nodeRef The node reference for which the recordable versions should be retrieved
* @param nodeRef
* The node reference for which the recordable versions should be retrieved
* @return The list of recordable versions
*/
List<Version> getVersions(NodeRef nodeRef);
@@ -53,8 +54,10 @@ public interface RecordableVersionConfigService
/**
* Sets the recordable version for the given node
*
* @param nodeRef The node reference for which the recorable version should be set
* @param version The version to be set
* @param nodeRef
* The node reference for which the recorable version should be set
* @param version
* The version to be set
*/
void setVersion(NodeRef nodeRef, String version);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,10 +27,11 @@
package org.alfresco.module.org_alfresco_module_rm.recordableversion;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE;
import static org.alfresco.util.ParameterCheck.mandatory;
import static org.alfresco.util.ParameterCheck.mandatoryString;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.util.ArrayList;
import java.util.List;
@@ -65,7 +66,8 @@ public class RecordableVersionConfigServiceImpl implements RecordableVersionConf
/**
* Sets the node service
*
* @param nodeService The node service
* @param nodeService
* The node service
*/
public void setNodeService(NodeService nodeService)
{
@@ -109,8 +111,10 @@ public class RecordableVersionConfigServiceImpl implements RecordableVersionConf
/**
* Checks if the specified recordable version policy has been selected for the document
*
* @param recordableVersionPolicy The recordable version policy
* @param nodeRef Node reference of the document
* @param recordableVersionPolicy
* The recordable version policy
* @param nodeRef
* Node reference of the document
* @return <code>true</code> if the specified recordable version policy has been selected for the document, <code>false</code> otherwise
*/
private boolean isVersionPolicySelected(RecordableVersionPolicy recordableVersionPolicy, NodeRef nodeRef)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,7 +47,8 @@ public interface RecordFolderService
/**
* Sets up the a record folder from a standard folder.
*
* @param nodeRef node reference of the folder to setup
* @param nodeRef
* node reference of the folder to setup
*
* @since 2.2
*/
@@ -56,8 +57,9 @@ public interface RecordFolderService
/**
* Indicates whether the given node is a record folder or not.
*
* @param nodeRef node reference
* @return boolean true if record folder, false otherwise
* @param nodeRef
* node reference
* @return boolean true if record folder, false otherwise
*
* @since 2.2
*/
@@ -66,8 +68,9 @@ public interface RecordFolderService
/**
* Indicates whether the contents of a record folder are all declared.
*
* @param nodeRef node reference (record folder)
* @return boolean true if record folder contents are declared, false otherwise
* @param nodeRef
* node reference (record folder)
* @return boolean true if record folder contents are declared, false otherwise
*
* @since 2.2
*/
@@ -76,60 +79,69 @@ public interface RecordFolderService
/**
* Indicates whether a record folder is closed or not.
*
* @param nodeRef node reference (record folder)
* @return boolean true if record folder is closed, false otherwise
* @param nodeRef
* node reference (record folder)
* @return boolean true if record folder is closed, false otherwise
*
* @since 2.2
*/
boolean isRecordFolderClosed(NodeRef nodeRef);
/**
* Create a record folder in the rm container. The record folder will take the name and type
* provided.
* Create a record folder in the rm container. The record folder will take the name and type provided.
*
* @param rmContainer records management container
* @param name name
* @param type type
* @return NodeRef node reference of record folder
* @param rmContainer
* records management container
* @param name
* name
* @param type
* type
* @return NodeRef node reference of record folder
*
* @since 2.2
*/
NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type);
/**
* Create a record folder in the rm container. The record folder will take the name, type and
* properties provided.
* Create a record folder in the rm container. The record folder will take the name, type and properties provided.
*
* @param rmContainer records management container
* @param name name
* @param type type
* @param properties properties
* @return NodeRef node reference of record folder
* @param rmContainer
* records management container
* @param name
* name
* @param type
* type
* @param properties
* properties
* @return NodeRef node reference of record folder
*
* @since 2.2
*/
NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map<QName, Serializable> properties);
/**
* Create a record folder in the rm container. The record folder will take the name provided.
* Type defaults to rm:recordFolder.
* Create a record folder in the rm container. The record folder will take the name provided. Type defaults to rm:recordFolder.
*
* @param rmContainer records management container
* @param name name
* @return NodeRef node reference of record folder
* @param rmContainer
* records management container
* @param name
* name
* @return NodeRef node reference of record folder
*
* @since 2.2
*/
NodeRef createRecordFolder(NodeRef rmContainer, String name);
/**
* Create a record folder in the rm container. The record folder will take the name and
* properties provided. Type defaults to rm:recordFolder.
* Create a record folder in the rm container. The record folder will take the name and properties provided. Type defaults to rm:recordFolder.
*
* @param rmContainer records management container
* @param name name
* @param properties properties
* @return NodeRef node reference of record folder
* @param rmContainer
* records management container
* @param name
* name
* @param properties
* properties
* @return NodeRef node reference of record folder
*
* @since 2.2
*/
@@ -138,8 +150,9 @@ public interface RecordFolderService
/**
* Get all the record folders that a record is filed into.
*
* @param record the record node reference
* @return List list of folder record node references
* @param record
* the record node reference
* @return List list of folder record node references
*
* @since 2.2
*/
@@ -161,7 +174,8 @@ public interface RecordFolderService
/**
* Closes the record folder. If the given node reference is a record the parent will be retrieved and processed.
*
* @param nodeRef the record folder node reference
* @param nodeRef
* the record folder node reference
*
* @since 2.2
*/

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -33,6 +33,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
@@ -49,9 +53,6 @@ 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.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* Record Folder Service Implementation
@@ -59,9 +60,9 @@ import org.springframework.extensions.surf.util.I18NUtil;
* @author Roy Wetherall
* @since 2.1
*/
public class RecordFolderServiceImpl extends ServiceBaseImpl
implements RecordFolderService,
RecordsManagementModel
public class RecordFolderServiceImpl extends ServiceBaseImpl
implements RecordFolderService,
RecordsManagementModel
{
/** Logger */
private static Log logger = LogFactory.getLog(RecordFolderServiceImpl.class);
@@ -83,7 +84,8 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
private FilePlanService filePlanService;
/**
* @param dispositionService disposition service
* @param dispositionService
* disposition service
*/
public void setDispositionService(DispositionService dispositionService)
{
@@ -91,7 +93,8 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
}
/**
* @param recordService record service
* @param recordService
* record service
*/
public void setRecordService(RecordService recordService)
{
@@ -99,7 +102,8 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
}
/**
* @param filePlanService file plan service
* @param filePlanService
* file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
@@ -167,8 +171,7 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_EXPECTED));
}
return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>()
{
return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>() {
public Boolean doWork() throws Exception
{
return ((Boolean) nodeService.getProperty(nodeRef, PROP_IS_CLOSED));
@@ -208,14 +211,14 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
// Check that the parent is a container
QName parentType = nodeService.getType(rmContainer);
if (!TYPE_RECORD_CATEGORY.equals(parentType) &&
!dictionaryService.isSubClass(parentType, TYPE_RECORD_CATEGORY))
!dictionaryService.isSubClass(parentType, TYPE_RECORD_CATEGORY))
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_TYPE, parentType.toString()));
}
// Check that the the provided type is a sub-type of rm:recordFolder
if (!TYPE_RECORD_FOLDER.equals(type) &&
!dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER))
!dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER))
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_TYPE, type.toString()));
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -50,9 +50,12 @@ public class RelationshipDefinitionImpl implements RelationshipDefinition
/**
* Constructor for creating a relationship definition
*
* @param uniqueName The unique name of the relationship definition
* @param type The type of the relationship definition
* @param displayName The display name of the relationship definition
* @param uniqueName
* The unique name of the relationship definition
* @param type
* The type of the relationship definition
* @param displayName
* The display name of the relationship definition
*/
public RelationshipDefinitionImpl(String uniqueName, RelationshipType type, RelationshipDisplayName displayName)
{
@@ -77,7 +80,8 @@ public class RelationshipDefinitionImpl implements RelationshipDefinition
/**
* Sets the name of the relationship definition
*
* @param uniqueName The name of the relationship definition
* @param uniqueName
* The name of the relationship definition
*/
private void setUniqueName(String uniqueName)
{
@@ -96,7 +100,8 @@ public class RelationshipDefinitionImpl implements RelationshipDefinition
/**
* Sets the type of the relationship definition
*
* @param type The type of the relationship definition
* @param type
* The type of the relationship definition
*/
private void setType(RelationshipType type)
{
@@ -115,7 +120,8 @@ public class RelationshipDefinitionImpl implements RelationshipDefinition
/**
* Sets the display name of the relationship definition
*
* @param displayName The display name of the relationship definition
* @param displayName
* The display name of the relationship definition
*/
private void setDisplayName(RelationshipDisplayName displayName)
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,12 +47,12 @@ public class RelationshipDisplayName
private String targetText;
/**
* Constructor for creating the relationship display name.
* In case of a bidirectional relationship the source
* text and target text will be the same.
* Constructor for creating the relationship display name. In case of a bidirectional relationship the source text and target text will be the same.
*
* @param sourceText The source text of the relationship
* @param targetText The target text of the relationship
* @param sourceText
* The source text of the relationship
* @param targetText
* The target text of the relationship
*/
public RelationshipDisplayName(String sourceText, String targetText)
{
@@ -76,7 +76,8 @@ public class RelationshipDisplayName
/**
* Sets the source text of the relationship
*
* @param sourceText The source text of the relationship
* @param sourceText
* The source text of the relationship
*/
private void setSourceText(String sourceText)
{
@@ -96,7 +97,8 @@ public class RelationshipDisplayName
/**
* Sets the target text of the relationship
*
* @param targetText The target text of the relationship
* @param targetText
* The target text of the relationship
*/
private void setTargetText(String targetText)
{
@@ -111,9 +113,9 @@ public class RelationshipDisplayName
{
StringBuilder sb = new StringBuilder();
sb.append("(")
.append("source=").append(sourceText)
.append(", target=").append(targetText)
.append(")");
.append("source=").append(sourceText)
.append(", target=").append(targetText)
.append(")");
return sb.toString();
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -42,7 +42,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
*/
public class RelationshipImpl implements Relationship, Serializable
{
/** serial UID */
/** serial UID */
private static final long serialVersionUID = 9120649510198344978L;
/** The unique name of the relationship */
@@ -57,9 +57,12 @@ public class RelationshipImpl implements Relationship, Serializable
/**
* Constructor for creating a relationship
*
* @param uniqueName The unique name of the relationship
* @param source The source of the relationship
* @param target The target of the relationship
* @param uniqueName
* The unique name of the relationship
* @param source
* The source of the relationship
* @param target
* The target of the relationship
*/
public RelationshipImpl(String uniqueName, NodeRef source, NodeRef target)
{
@@ -84,7 +87,8 @@ public class RelationshipImpl implements Relationship, Serializable
/**
* Sets the unique name of the relationship
*
* @param uniqueName The unique name of the relationship
* @param uniqueName
* The unique name of the relationship
*/
private void setUniqueName(String uniqueName)
{
@@ -103,7 +107,8 @@ public class RelationshipImpl implements Relationship, Serializable
/**
* Sets the source of the relationship
*
* @param source The source of the relationship
* @param source
* The source of the relationship
*/
private void setSource(NodeRef source)
{
@@ -122,13 +127,14 @@ public class RelationshipImpl implements Relationship, Serializable
/**
* Sets the target of the relationship
*
* @param target The target of the relationship
* @param target
* The target of the relationship
*/
private void setTarget(NodeRef target)
{
this.target = target;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@@ -151,7 +157,7 @@ public class RelationshipImpl implements Relationship, Serializable
return false;
}
}
/**
* @see java.lang.Object#hashCode()
*/
@@ -160,7 +166,7 @@ public class RelationshipImpl implements Relationship, Serializable
{
int prime = 31;
int result = prime + uniqueName.hashCode();
result = (prime*result) + source.hashCode();
return (prime*result) + target.hashCode();
result = (prime * result) + source.hashCode();
return (prime * result) + target.hashCode();
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -54,7 +54,8 @@ public interface RelationshipService
/**
* Gets the relationship definition for the given unique name
*
* @param uniqueName The unique name of the relationship definition
* @param uniqueName
* The unique name of the relationship definition
* @return The relationship definition for the given unique name if it exist, <code>null</code> otherwise
*/
RelationshipDefinition getRelationshipDefinition(String uniqueName);
@@ -62,7 +63,8 @@ public interface RelationshipService
/**
* Creates a relationship definition using the display name
*
* @param displayName The display name of the relationship definition
* @param displayName
* The display name of the relationship definition
* @return The new relationship definition
*/
RelationshipDefinition createRelationshipDefinition(RelationshipDisplayName displayName);
@@ -70,8 +72,10 @@ public interface RelationshipService
/**
* Updates an existing relationship definition
*
* @param uniqueName The unique name of the relationship definition
* @param displayName The display name of the relationship definition
* @param uniqueName
* The unique name of the relationship definition
* @param displayName
* The display name of the relationship definition
* @return The updated relationship definition
*/
RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName);
@@ -79,7 +83,8 @@ public interface RelationshipService
/**
* Removes a relationship definition
*
* @param uniqueName The unique name of the relationship definition
* @param uniqueName
* The unique name of the relationship definition
* @return <code>true</code> if the relationship definition was removed successfully, <code>false</code> otherwise
*/
boolean removeRelationshipDefinition(String uniqueName);
@@ -87,7 +92,8 @@ public interface RelationshipService
/**
* Checks if a relationship exists or not
*
* @param uniqueName The unique name of the relationship definition
* @param uniqueName
* The unique name of the relationship definition
* @return <code>true</code> if the relationship definition exists, <code>false</code> otherwise
*/
boolean existsRelationshipDefinition(String uniqueName);
@@ -95,19 +101,21 @@ public interface RelationshipService
/**
* Gets all the relationships that come out from the given node reference
*
* @param nodeRef The node reference
* @param nodeRef
* The node reference
* @return All relationships that come out from the given node reference
*/
Set<Relationship> getRelationshipsFrom(NodeRef nodeRef);
/**
* Gets all the relationships that come out from the given node reference
* that match the a given name filter.
* Gets all the relationships that come out from the given node reference that match the a given name filter.
* <p>
* Exact match only.
*
* @param nodeRef The node reference
* @param nameFilter Name filter for results
* @param nodeRef
* The node reference
* @param nameFilter
* Name filter for results
* @return All relationships that come out from the given node reference
*
* @since 2.3.1
@@ -117,19 +125,21 @@ public interface RelationshipService
/**
* Gets all the relationships that go into the given node reference
*
* @param nodeRef The node reference
* @param nodeRef
* The node reference
* @return All relationships that go into the given node reference
*/
Set<Relationship> getRelationshipsTo(NodeRef nodeRef);
/**
* Gets all the relationships that go into the given node reference
* that match the a given name filter.
* Gets all the relationships that go into the given node reference that match the a given name filter.
* <p>
* Exact match only.
*
* @param nodeRef The node reference
* @param nameFilter Name filter for results
* @param nodeRef
* The node reference
* @param nameFilter
* Name filter for results
* @return All relationships that go into the given node reference
*
* @since 2.3.1
@@ -137,22 +147,26 @@ public interface RelationshipService
Set<Relationship> getRelationshipsTo(NodeRef nodeRef, String nameFilter);
/**
* Adds a relationship from the given node <code>source</code>
* to the give node <code>target</code> with the given unique name
* Adds a relationship from the given node <code>source</code> to the give node <code>target</code> with the given unique name
*
* @param uniqueName The unique name of the relationship
* @param source The node reference which the relationship come from
* @param target The node reference which the relationship go to
* @param uniqueName
* The unique name of the relationship
* @param source
* The node reference which the relationship come from
* @param target
* The node reference which the relationship go to
*/
void addRelationship(String uniqueName, NodeRef source, NodeRef target);
/**
* Removes the relationship from the given node <code>source</code>
* to the given node <code>target</code> with the given unique name
* Removes the relationship from the given node <code>source</code> to the given node <code>target</code> with the given unique name
*
* @param uniqueName The unique name of the relationship
* @param source The node reference which the relationship come from
* @param target The node reference which the relationship go to
* @param uniqueName
* The unique name of the relationship
* @param source
* The node reference which the relationship come from
* @param target
* The node reference which the relationship go to
*/
void removeRelationship(String uniqueName, NodeRef source, NodeRef target);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,10 +27,11 @@
package org.alfresco.module.org_alfresco_module_rm.relationship;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_FROZEN;
import static org.alfresco.util.ParameterCheck.mandatory;
import static org.alfresco.util.ParameterCheck.mandatoryString;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.util.HashSet;
import java.util.List;
@@ -87,7 +88,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Sets the policy component instance
*
* @param policyComponent The policy component instance
* @param policyComponent
* The policy component instance
*/
public void setPolicyComponent(PolicyComponent policyComponent)
{
@@ -166,25 +168,25 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
switch (type)
{
case BIDIRECTIONAL:
case BIDIRECTIONAL:
title = displayName.getSourceText();
break;
title = displayName.getSourceText();
break;
case PARENTCHILD:
case PARENTCHILD:
String sourceText = displayName.getSourceText();
String targetText = displayName.getTargetText();
title = composeAssociationDefinitionTitle(sourceText, targetText);
break;
String sourceText = displayName.getSourceText();
String targetText = displayName.getTargetText();
title = composeAssociationDefinitionTitle(sourceText, targetText);
break;
default:
default:
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
.append(type.toString())
.append("'.");
throw new AlfrescoRuntimeException(sb.toString());
throw new AlfrescoRuntimeException(sb.toString());
}
// If this title is already taken...
@@ -192,8 +194,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
StringBuilder sb = new StringBuilder();
sb.append("Cannot create a relationship definition for the display name: '")
.append(displayName.toString())
.append("' as there is already a relationship definition with this display name.");
.append(displayName.toString())
.append("' as there is already a relationship definition with this display name.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -207,8 +209,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
StringBuilder sb = new StringBuilder();
sb.append("The aspect: '")
.append(customAspectName)
.append("' is undefined.");
.append(customAspectName)
.append("' is undefined.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -220,8 +222,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
StringBuilder sb = new StringBuilder();
sb.append("The association: '")
.append(customAssoc.getName())
.append("' already exists.");
.append(customAssoc.getName())
.append("' already exists.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -229,23 +231,23 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
switch (type)
{
case BIDIRECTIONAL:
case BIDIRECTIONAL:
newAssoc = customAssocsAspect.createAssociation(generatedShortQName);
break;
newAssoc = customAssocsAspect.createAssociation(generatedShortQName);
break;
case PARENTCHILD:
case PARENTCHILD:
newAssoc = customAssocsAspect.createChildAssociation(generatedShortQName);
break;
newAssoc = customAssocsAspect.createChildAssociation(generatedShortQName);
break;
default:
default:
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
.append(type.toString())
.append("'.");
throw new AlfrescoRuntimeException(sb.toString());
throw new AlfrescoRuntimeException(sb.toString());
}
newAssoc.setSourceMandatory(false);
@@ -275,8 +277,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
StringBuilder sb = new StringBuilder();
sb.append("The relationship definition for the unique name '")
.append(uniqueName)
.append("' was not found.");
.append(uniqueName)
.append("' was not found.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -285,56 +287,56 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
switch (type)
{
case BIDIRECTIONAL:
case BIDIRECTIONAL:
title = displayName.getSourceText();
title = displayName.getSourceText();
if (isBlank(title))
{
StringBuilder sb = new StringBuilder();
sb.append("Label text '")
if (isBlank(title))
{
StringBuilder sb = new StringBuilder();
sb.append("Label text '")
.append(title)
.append(" cannot be blank.");
throw new AlfrescoRuntimeException(sb.toString());
}
throw new AlfrescoRuntimeException(sb.toString());
}
break;
break;
case PARENTCHILD:
case PARENTCHILD:
String sourceText = displayName.getSourceText();
String targetText = displayName.getTargetText();
String sourceText = displayName.getSourceText();
String targetText = displayName.getTargetText();
if (isBlank(sourceText) || isBlank(targetText))
{
StringBuilder sb = new StringBuilder();
sb.append("Neither source text '")
if (isBlank(sourceText) || isBlank(targetText))
{
StringBuilder sb = new StringBuilder();
sb.append("Neither source text '")
.append(sourceText)
.append("' nor target text '")
.append(targetText)
.append(" can be blank.");
throw new AlfrescoRuntimeException(sb.toString());
}
throw new AlfrescoRuntimeException(sb.toString());
}
title = composeAssociationDefinitionTitle(sourceText, targetText);
title = composeAssociationDefinitionTitle(sourceText, targetText);
break;
break;
default:
default:
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
.append(type.toString())
.append("'.");
throw new AlfrescoRuntimeException(sb.toString());
throw new AlfrescoRuntimeException(sb.toString());
}
if (existsTitle(title))
{
StringBuilder sb = new StringBuilder();
sb.append("Cannot update the relationship definition as '")
.append(title)
.append("' already exists.");
.append(title)
.append("' already exists.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -388,7 +390,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
return getRelationshipsFrom(nodeRef, null);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsFrom(org.alfresco.service.cmr.repository.NodeRef, String)
*/
@@ -416,7 +418,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
return getRelationshipsTo(nodeRef, null);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsTo(org.alfresco.service.cmr.repository.NodeRef, String)
*/
@@ -435,7 +437,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
return relationships;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#addRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -445,25 +447,23 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
mandatoryString("uniqueName", uniqueName);
mandatory("source", source);
mandatory("target", target);
// check the source node exists
if (!getNodeService().exists(source))
{
throw new AlfrescoRuntimeException("Can't create relationship '" + uniqueName + "', because source node doesn't exist.");
}
// check the target node exists
if (!getNodeService().exists(target))
{
throw new AlfrescoRuntimeException("Can't create relationship " + uniqueName + ", because target node doesn't exist.");
}
if (getNodeService().hasAspect(target, ASPECT_FROZEN))
{
StringBuilder sb = new StringBuilder();
sb.append("Relationship cannot be created as the target '").
append(getNodeService().getProperty(target, ContentModel.PROP_NAME)).
append("' is in a hold.");
sb.append("Relationship cannot be created as the target '").append(getNodeService().getProperty(target, ContentModel.PROP_NAME)).append("' is in a hold.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -472,9 +472,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
if (associationDefinition == null)
{
StringBuilder sb = new StringBuilder();
sb.append("No association definition found for '").
append(uniqueName).
append("'.");
sb.append("No association definition found for '").append(uniqueName).append("'.");
throw new IllegalArgumentException(sb.toString());
}
@@ -487,13 +485,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
if (associationAlreadyExists)
{
StringBuilder sb = new StringBuilder();
sb.append("Association '").
append(associationDefinitionName.getLocalName()).
append("' already exists from '").
append(source).
append("' to '").
append(target).
append("'.");
sb.append("Association '").append(associationDefinitionName.getLocalName()).append("' already exists from '").append(source).append("' to '").append(target).append("'.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -528,9 +520,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
if (associationDefinition == null)
{
StringBuilder sb = new StringBuilder();
sb.append("No association definition found for '").
append(uniqueName).
append("'.");
sb.append("No association definition found for '").append(uniqueName).append("'.");
throw new IllegalArgumentException(sb.toString());
}
@@ -543,8 +533,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
if (associationDefinition.isChild())
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork()
{
@@ -572,7 +561,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Creates the relationship definition from the association definition
*
* @param associationDefinition The association definition
* @param associationDefinition
* The association definition
* @return The relationship definition if <code>associationDefinition</code> exists, <code>null</code> otherwise
*/
private RelationshipDefinition createRelationshipDefinition(AssociationDefinition associationDefinition)
@@ -597,7 +587,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Gets the relationship type from the association definition
*
* @param associationDefinition The association definition
* @param associationDefinition
* The association definition
* @return The type of the relationship definition
*/
private RelationshipType getRelationshipType(AssociationDefinition associationDefinition)
@@ -619,8 +610,10 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Gets the relationship display name of the relationship definition
*
* @param type The type of the relationship definition
* @param title The title of the association definition
* @param type
* The type of the relationship definition
* @param title
* The title of the association definition
* @return The relationship display name of the relationship definition
*/
private RelationshipDisplayName getRelationshipDisplayName(RelationshipType type, String title)
@@ -630,26 +623,26 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
switch (type)
{
case BIDIRECTIONAL:
case BIDIRECTIONAL:
sourceText = title;
targetText = title;
break;
sourceText = title;
targetText = title;
break;
case PARENTCHILD:
case PARENTCHILD:
String[] sourceAndTarget = splitAssociationDefinitionTitle(title);
sourceText = sourceAndTarget[0];
targetText = sourceAndTarget[1];
break;
String[] sourceAndTarget = splitAssociationDefinitionTitle(title);
sourceText = sourceAndTarget[0];
targetText = sourceAndTarget[1];
break;
default:
default:
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
StringBuilder sb = new StringBuilder();
sb.append("Unsupported relationship type: '")
.append(type.toString())
.append("'.");
throw new AlfrescoRuntimeException(sb.toString());
throw new AlfrescoRuntimeException(sb.toString());
}
return new RelationshipDisplayName(sourceText, targetText);
@@ -658,7 +651,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Generates relationships from the given association references
*
* @param associationRefs Association references
* @param associationRefs
* Association references
* @return Relationships generated from the given association references
*/
private Set<Relationship> generateRelationshipFromAssociationRef(List<AssociationRef> associationRefs, String nameFilter)
@@ -669,7 +663,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
String uniqueName = associationRef.getTypeQName().getLocalName();
if (existsRelationshipDefinition(uniqueName) &&
(nameFilter == null || uniqueName.equals(nameFilter)))
(nameFilter == null || uniqueName.equals(nameFilter)))
{
NodeRef from = associationRef.getSourceRef();
NodeRef to = associationRef.getTargetRef();
@@ -683,7 +677,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Generates relationships from the given child association references
*
* @param childAssociationRefs Child association references
* @param childAssociationRefs
* Child association references
* @return Relationships generated from the given child association references
*/
private Set<Relationship> generateRelationshipFromParentChildAssociationRef(List<ChildAssociationRef> childAssociationRefs, String nameFilter)
@@ -693,8 +688,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
for (ChildAssociationRef childAssociationRef : childAssociationRefs)
{
String uniqueName = childAssociationRef.getQName().getLocalName();
if (existsRelationshipDefinition(uniqueName)&&
(nameFilter == null || uniqueName.equals(nameFilter)))
if (existsRelationshipDefinition(uniqueName) &&
(nameFilter == null || uniqueName.equals(nameFilter)))
{
NodeRef from = childAssociationRef.getParentRef();
NodeRef to = childAssociationRef.getChildRef();
@@ -708,7 +703,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Determines the relationship type from the display name
*
* @param displayName The display name of the relationship
* @param displayName
* The display name of the relationship
* @return The relationship type from the display name
*/
private RelationshipType determineRelationshipTypeFromDisplayName(RelationshipDisplayName displayName)
@@ -740,9 +736,12 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Invoke before create reference policy
*
* @param source The source node reference
* @param target The target node reference
* @param associationDefinitionName The association definition name
* @param source
* The source node reference
* @param target
* The target node reference
* @param associationDefinitionName
* The association definition name
*/
private void invokeBeforeCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName)
{
@@ -756,9 +755,12 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Invoke on create reference policy
*
* @param source The source node reference
* @param target The target node reference
* @param associationDefinitionName The association definition name
* @param source
* The source node reference
* @param target
* The target node reference
* @param associationDefinitionName
* The association definition name
*/
private void invokeOnCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName)
{
@@ -772,9 +774,12 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Invoke before remove reference policy
*
* @param source The source node reference
* @param target The target node reference
* @param associationDefinitionName The association definition name
* @param source
* The source node reference
* @param target
* The target node reference
* @param associationDefinitionName
* The association definition name
*/
private void invokeBeforeRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName)
{
@@ -788,9 +793,12 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Invoke on remove reference policy
*
* @param source The source node reference
* @param target The target node reference
* @param associationDefinitionName The association definition name
* @param source
* The source node reference
* @param target
* The target node reference
* @param associationDefinitionName
* The association definition name
*/
private void invokeOnRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName)
{
@@ -802,12 +810,14 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
}
/**
* Check if an instance of the association already exists from the given
* source node reference to the given target node reference
* Check if an instance of the association already exists from the given source node reference to the given target node reference
*
* @param associationDefinition The association definition
* @param source The source node reference
* @param target The target node reference
* @param associationDefinition
* The association definition
* @param source
* The source node reference
* @param target
* The target node reference
* @return <code>true</code> if an association already exists, <code>false</code> otherwise
*/
private boolean associationExists(AssociationDefinition associationDefinition, NodeRef source, NodeRef target)
@@ -844,7 +854,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Gets the association definition for the given unique name
*
* @param uniqueName The unique name
* @param uniqueName
* The unique name
* @return The association definition for the given unique name if exists, <code>null</code> otherwise
*/
private AssociationDefinition getAssociationDefinition(String uniqueName)
@@ -868,7 +879,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Gets the qualified name of the association definition for the given unique name
*
* @param uniqueName The unique name
* @param uniqueName
* The unique name
* @return The qualified name of the association definition for the given unique name
*/
private QName getAssociationDefinitionName(String uniqueName)
@@ -879,8 +891,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
{
StringBuilder sb = new StringBuilder();
sb.append("The qualified name for '")
.append(uniqueName)
.append("' was not found.");
.append(uniqueName)
.append("' was not found.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -888,12 +900,14 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
}
/**
* This method writes the specified String into the association's title property.
* For RM custom properties and references, Title is used to store the identifier.
* This method writes the specified String into the association's title property. For RM custom properties and references, Title is used to store the identifier.
*
* NOTE: Currently RMC custom associations only
* @param associationDefinitionQName Qualified name for the association definition
* @param newTitle The new title
*
* @param associationDefinitionQName
* Qualified name for the association definition
* @param newTitle
* The new title
* @return Qualified name for the association definition
*/
private QName persistUpdatedAssocTitle(QName associationDefinitionQName, String newTitle)
@@ -904,9 +918,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
if (assocDefn == null)
{
StringBuilder sb = new StringBuilder();
sb.append("Cannot find the association definiton for '").
append(associationDefinitionQName.getLocalName()).
append("'.");
sb.append("Cannot find the association definiton for '").append(associationDefinitionQName.getLocalName()).append("'.");
throw new AlfrescoRuntimeException(sb.toString());
}
@@ -937,7 +949,8 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
/**
* Generates a qualified name for the given relationship definition unique name
*
* @param uniqueName The unique name of the relationship definition
* @param uniqueName
* The unique name of the relationship definition
* @return The qualified name of relationship definition
*/
private QName generateRelationshipDefinitionQNameFor(String uniqueName)
@@ -958,9 +971,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen
if (existingQName != null)
{
StringBuilder sb = new StringBuilder();
sb.append("Cannot create qualified name for given unique name '").
append(uniqueName).
append("' as it already exists.");
sb.append("Cannot create qualified name for given unique name '").append(uniqueName).append("' as it already exists.");
throw new AlfrescoRuntimeException(sb.toString());
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -38,6 +38,5 @@ import org.alfresco.api.AlfrescoPublicApi;
@AlfrescoPublicApi
public enum RelationshipType
{
BIDIRECTIONAL,
PARENTCHILD
BIDIRECTIONAL, PARENTCHILD
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -31,6 +31,8 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport;
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
@@ -46,11 +48,9 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* Extend versionable aspect auto-version behaviour to allow versions to be
* created when the content type is changed.
* Extend versionable aspect auto-version behaviour to allow versions to be created when the content type is changed.
*
* Note: this behaviour should be merged into core asap
*
@@ -62,157 +62,167 @@ public class ExtendedVersionableAspect implements NodeServicePolicies.OnSetNodeT
{
/** The i18n'ized messages */
private static final String MSG_AUTO_VERSION = "create_version.auto_version";
/** Transaction resource key */
private static final String KEY_VERSIONED_NODEREFS = "versioned_noderefs";
/** node service */
private NodeService nodeService;
/** version service */
private VersionService versionService;
/** lock service */
private LockService lockService;
/** alfresco transaction support */
private AlfrescoTransactionSupport alfrescoTransactionSupport;
/** authentication util */
private AuthenticationUtil authenticationUtil;
/** indicates whether auto version should be triggered on type change */
private boolean isAutoVersionOnTypeChange = false;
/**
* @param nodeService node service
* @param nodeService
* node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @param versionService version service
* @param versionService
* version service
*/
public void setVersionService(VersionService versionService)
{
this.versionService = versionService;
}
/**
* @param lockService lock service
* @param lockService
* lock service
*/
public void setLockService(LockService lockService)
{
this.lockService = lockService;
}
/**
* @param alfrescoTransactionSupport alfresco transaction support
* @param alfrescoTransactionSupport
* alfresco transaction support
*/
public void setAlfrescoTransactionSupport(AlfrescoTransactionSupport alfrescoTransactionSupport)
{
this.alfrescoTransactionSupport = alfrescoTransactionSupport;
}
/**
* @param authenticationUtil authentication util
* @param authenticationUtil
* authentication util
*/
public void setAuthenticationUtil(AuthenticationUtil authenticationUtil)
{
this.authenticationUtil = authenticationUtil;
}
/**
* @param isAutoVersionOnTypeChange true if auto version on type change, false otherwise
* @param isAutoVersionOnTypeChange
* true if auto version on type change, false otherwise
*/
public void setAutoVersionOnTypeChange(boolean isAutoVersionOnTypeChange)
{
this.isAutoVersionOnTypeChange = isAutoVersionOnTypeChange;
}
/**
* On set node type behaviour
*
* @param nodeRef node reference
* @param oldType old type
* @param newType new type
* @param nodeRef
* node reference
* @param oldType
* old type
* @param newType
* new type
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
@Behaviour
(
type="cm:versionable",
kind=BehaviourKind.CLASS,
notificationFrequency=NotificationFrequency.TRANSACTION_COMMIT
)
@Behaviour(
type = "cm:versionable",
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT)
public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType)
{
if (isAutoVersionOnTypeChange &&
nodeService.exists(nodeRef) &&
!lockService.isLockedAndReadOnly(nodeRef) &&
nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) &&
!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY))
nodeService.exists(nodeRef) &&
!lockService.isLockedAndReadOnly(nodeRef) &&
nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) &&
!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY))
{
Map<NodeRef, NodeRef> versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
Map<NodeRef, NodeRef> versionedNodeRefs = (Map) alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
if (versionedNodeRefs == null || !versionedNodeRefs.containsKey(nodeRef))
{
// Determine whether the node is auto versionable (for content updates) or not
boolean autoVersion = false;
Boolean value = (Boolean)nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION);
Boolean value = (Boolean) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION);
if (value != null)
{
// If the value is not null then
// If the value is not null then
autoVersion = value.booleanValue();
}
// NOTE: auto version on type change is a global setting, if thins extension was moved into the
// core then cm:versionable could be extended with a property consistent with the current
// implementation
// NOTE: auto version on type change is a global setting, if thins extension was moved into the
// core then cm:versionable could be extended with a property consistent with the current
// implementation
if (autoVersion)
{
// Create the auto-version
Map<String, Serializable> versionProperties = new HashMap<>(1);
versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_AUTO_VERSION));
createVersionImpl(nodeRef, versionProperties);
}
}
}
}
}
/**
* On create version implementation method.
*
* @param nodeRef node reference
* @param versionProperties version properties
* @param nodeRef
* node reference
* @param versionProperties
* version properties
*/
private void createVersionImpl(final NodeRef nodeRef, final Map<String, Serializable> versionProperties)
{
authenticationUtil.runAsSystem(new RunAsWork<Void>()
{
authenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork() throws Exception
public Void doWork() throws Exception
{
recordCreateVersion(nodeRef, null);
versionService.createVersion(nodeRef, versionProperties);
return null;
}
});
});
}
/**
* Record that the new version has been created
*
* @param versionableNode versionable node reference
* @param version version
* @param versionableNode
* versionable node reference
* @param version
* version
*/
@SuppressWarnings("unchecked")
private void recordCreateVersion(NodeRef versionableNode, Version version)
private void recordCreateVersion(NodeRef versionableNode, Version version)
{
Map<NodeRef, NodeRef> versionedNodeRefs = (Map<NodeRef, NodeRef>)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
Map<NodeRef, NodeRef> versionedNodeRefs = (Map<NodeRef, NodeRef>) alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
if (versionedNodeRefs == null)
{
versionedNodeRefs = new HashMap<>();

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -47,14 +47,13 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
/**
* Extended version node service implementation that supports the retrieval of
* recorded version state.
* Extended version node service implementation that supports the retrieval of recorded version state.
*
* @author Roy Wetherall
* @since 2.3
*/
public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
implements RecordableVersionModel
implements RecordableVersionModel
{
/** record service */
private RecordService recordService;
@@ -62,8 +61,9 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
/** record model URI's */
private List<String> recordModelURIs;
/**
* @param recordModelURIs namespaces specific to records
/**
* @param recordModelURIs
* namespaces specific to records
*/
public void setRecordModelURIs(List<String> recordModelURIs)
{
@@ -71,7 +71,8 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
}
/**
* @param recordService record service
* @param recordService
* record service
*/
public void setRecordService(RecordService recordService)
{
@@ -90,15 +91,15 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
NodeRef converted = VersionUtil.convertNodeRef(nodeRef);
if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION))
{
NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF);
NodeRef record = (NodeRef) dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF);
if (record != null && dbNodeService.exists(record))
{
Map<QName, Serializable> properties = dbNodeService.getProperties(record);
Map<QName, Serializable> properties = dbNodeService.getProperties(record);
return processProperties(converted, properties);
}
else
{
return (Map<QName, Serializable>)Collections.EMPTY_MAP;
return (Map<QName, Serializable>) Collections.EMPTY_MAP;
}
}
else
@@ -110,7 +111,8 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
/**
* Process properties map before returning as frozen state.
*
* @param properties properties map
* @param properties
* properties map
* @return {@link Map}&lt;{@link QName}, {@link Serializable}&gt; processed property map
*/
protected Map<QName, Serializable> processProperties(NodeRef version, Map<QName, Serializable> properties)
@@ -141,8 +143,10 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
/**
* Process version properties.
*
* @param version version node reference
* @param properties properties map
* @param version
* version node reference
* @param properties
* properties map
*/
protected void processVersionProperties(NodeRef version, Map<QName, Serializable> properties) throws InvalidNodeRefException
{
@@ -151,11 +155,11 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
if (versionProperties != null)
{
String versionLabel = (String)versionProperties.get(Version2Model.PROP_QNAME_VERSION_LABEL);
String versionLabel = (String) versionProperties.get(Version2Model.PROP_QNAME_VERSION_LABEL);
properties.put(ContentModel.PROP_VERSION_LABEL, versionLabel);
// Convert frozen sys:referenceable properties
NodeRef nodeRef = (NodeRef)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF);
NodeRef nodeRef = (NodeRef) versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF);
if (nodeRef != null)
{
properties.put(ContentModel.PROP_STORE_PROTOCOL, nodeRef.getStoreRef().getProtocol());
@@ -163,42 +167,42 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
properties.put(ContentModel.PROP_NODE_UUID, nodeRef.getId());
}
Long dbid = (Long)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_DBID);
Long dbid = (Long) versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_DBID);
properties.put(ContentModel.PROP_NODE_DBID, dbid);
// Convert frozen cm:auditable properties
String creator = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATOR);
String creator = (String) versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATOR);
if (creator != null)
{
properties.put(ContentModel.PROP_CREATOR, creator);
}
Date created = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATED);
Date created = (Date) versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATED);
if (created != null)
{
properties.put(ContentModel.PROP_CREATED, created);
}
// TODO - check use-cases for get version, revert, restore ....
String modifier = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIER);
String modifier = (String) versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIER);
if (modifier != null)
{
properties.put(ContentModel.PROP_MODIFIER, modifier);
}
Date modified = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIED);
Date modified = (Date) versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIED);
if (modified != null)
{
properties.put(ContentModel.PROP_MODIFIED, modified);
}
Date accessed = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_ACCESSED);
Date accessed = (Date) versionProperties.get(Version2Model.PROP_QNAME_FROZEN_ACCESSED);
if (accessed != null)
{
properties.put(ContentModel.PROP_ACCESSED, accessed);
}
String owner = (String)versionProperties.get(PROP_FROZEN_OWNER);
String owner = (String) versionProperties.get(PROP_FROZEN_OWNER);
if (owner != null)
{
properties.put(ContentModel.PROP_OWNER, owner);
@@ -219,15 +223,15 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION))
{
NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF);
NodeRef record = (NodeRef) dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF);
if (record != null && dbNodeService.exists(record))
{
Set<QName> aspects = dbNodeService.getAspects(record);
Set<QName> aspects = dbNodeService.getAspects(record);
return processAspects(aspects);
}
else
{
return (Set<QName>)Collections.EMPTY_SET;
return (Set<QName>) Collections.EMPTY_SET;
}
}
else
@@ -239,8 +243,9 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl
/**
* Process frozen aspects.
*
* @param aspects aspect set
* @return {@link Set}&lt;{@link QName}&gt; processed aspect set
* @param aspects
* aspect set
* @return {@link Set}&lt;{@link QName}&gt; processed aspect set
*/
protected Set<QName> processAspects(Set<QName> aspects)
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -45,32 +45,36 @@ public interface RecordableVersionService
* <p>
* Returns false if not versionable or no version.
*
* @param nodeRef node reference
* @return boolean true if latest version recorded, false otherwise
* @param nodeRef
* node reference
* @return boolean true if latest version recorded, false otherwise
*/
boolean isCurrentVersionRecorded(NodeRef nodeRef);
/**
* Indicates whether a version is recorded or not.
*
* @param version version
* @return boolean true if recorded version, false otherwise
* @param version
* version
* @return boolean true if recorded version, false otherwise
*/
boolean isRecordedVersion(Version version);
/**
* If the version is a recorded version, gets the related version record.
*
* @param version version
* @return NodeRef node reference of version record
* @param version
* version
* @return NodeRef node reference of version record
*/
NodeRef getVersionRecord(Version version);
/**
* Gets the version that relates to the version record
*
* @param record version record node reference
* @return Version version or null if not found
* @param record
* version record node reference
* @return Version version or null if not found
*/
Version getRecordedVersion(NodeRef record);
@@ -79,7 +83,8 @@ public interface RecordableVersionService
* <p>
* Does not create a record if the node is not versionable or the latest version is already recorded.
*
* @param nodeRef node reference
* @param nodeRef
* node reference
* @return NodeRef node reference to the created record.
*/
NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef);
@@ -89,18 +94,22 @@ public interface RecordableVersionService
* <p>
* Does not create a record if the node is not versionable or the latest version is already recorded.
*
* @param filePlan parent node reference
* @param nodeRef node reference
* @param autoVersion true, create new record version from latest version, false creates a record from the latest frozen version
* @return NodeRef node reference to the created record.
* @param filePlan
* parent node reference
* @param nodeRef
* node reference
* @param autoVersion
* true, create new record version from latest version, false creates a record from the latest frozen version
* @return NodeRef node reference to the created record.
*/
NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef, boolean autoVersion);
/**
* Indicates whether a record version is destroyed or not.
*
* @param version version
* @return boolean true if destroyed, false otherwise
* @param version
* version
* @return boolean true if destroyed, false otherwise
*/
boolean isRecordedVersionDestroyed(Version version);
@@ -109,7 +118,8 @@ public interface RecordableVersionService
* <p>
* Note this method does not destroy the associated record, instead it marks the version as destroyed.
*
* @param version version
* @param version
* version
*/
void destroyRecordedVersion(Version version);
@@ -123,7 +133,8 @@ public interface RecordableVersionService
/**
* Create a snapshot version of current node
*
* @param nodeRef node reference
* @param nodeRef
* node reference
*/
void createSnapshotVersion(NodeRef nodeRef);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -33,18 +33,16 @@ import java.util.Map;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.workflow.activiti.ActivitiScriptNode;
import org.alfresco.repo.workflow.activiti.ActivitiScriptNodeList;
import org.alfresco.util.ParameterCheck;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* An assignment handler for the request info workflow.
* An RM manager/admin can select one or more user(s) and/or
* one or more group(s) when starting the request info workflow.
* This assignment handler assigns for everyone a task (it is a pooled task).
* An assignment handler for the request info workflow. An RM manager/admin can select one or more user(s) and/or one or more group(s) when starting the request info workflow. This assignment handler assigns for everyone a task (it is a pooled task).
*
* @author Tuna Aksoy
* @since 2.1
@@ -124,7 +122,8 @@ public class RequestInfoAssignmentHandler implements TaskListener
/**
* Helper method for building the workflow description
*
* @param recordName The name of the record
* @param recordName
* The name of the record
* @return Returns the workflow description
*/
private String getWorkflowDescription(String recordName)
@@ -134,7 +133,7 @@ public class RequestInfoAssignmentHandler implements TaskListener
sb.append(" '");
sb.append(recordName);
sb.append("'");
return sb.toString();
return sb.toString();
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -29,13 +29,12 @@ package org.alfresco.workflow.requestInfo;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.alfresco.util.ParameterCheck;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.util.ParameterCheck;
/**
* Request info workflow notifier.
* After the pooled task has been finished the initiator of the workflow will
* get a task to verify the information. The initiator will also receive an email.
* Request info workflow notifier. After the pooled task has been finished the initiator of the workflow will get a task to verify the information. The initiator will also receive an email.
*
* @author Tuna Aksoy
* @since 2.1
@@ -66,7 +65,8 @@ public class RequestInfoNotifier implements TaskListener
/**
* Helper method for building the workflow description
*
* @param recordName The name of the record
* @param recordName
* The name of the record
* @return Returns the workflow description
*/
private String getWorkflowDescription(String recordName)
@@ -76,6 +76,6 @@ public class RequestInfoNotifier implements TaskListener
sb.append(" '");
sb.append(recordName);
sb.append("'");
return sb.toString();
return sb.toString();
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -32,6 +32,8 @@ import java.util.List;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.context.Context;
import org.apache.commons.lang3.StringUtils;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -42,7 +44,6 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.ParameterCheck;
import org.apache.commons.lang3.StringUtils;
/**
* Util class for the request info workflow
@@ -83,9 +84,9 @@ public final class RequestInfoUtils
/**
* Helper method to extract the record name from the task
*
* @param delegateTask The delegate task
* @return Returns the name of the record or an empty string if the record name could not be found
(may be because the record has been deleted in the mean time)
* @param delegateTask
* The delegate task
* @return Returns the name of the record or an empty string if the record name could not be found (may be because the record has been deleted in the mean time)
*/
public static String getRecordName(DelegateTask delegateTask)
{
@@ -99,7 +100,7 @@ public final class RequestInfoUtils
if (childAssocs.size() > 0)
{
NodeRef docRef= childAssocs.get(0).getChildRef();
NodeRef docRef = childAssocs.get(0).getChildRef();
recordName = (String) nodeService.getProperty(docRef, ContentModel.PROP_NAME);
}
@@ -109,12 +110,9 @@ public final class RequestInfoUtils
/**
* Helper method to extract the initiator from the task
*
* @param delegateTask The delegate task
* @return Returns the initiator of the workflow. First it will be checked if
* a rule creator exists, which means the the workflow was started via rule.
* In this case the creator of the rule will receive the review task.
* If a rule creator cannot be found the code will try to find the initiator
* of the workflow. If also this is not the case the admin user will be returned.
* @param delegateTask
* The delegate task
* @return Returns the initiator of the workflow. First it will be checked if a rule creator exists, which means the the workflow was started via rule. In this case the creator of the rule will receive the review task. If a rule creator cannot be found the code will try to find the initiator of the workflow. If also this is not the case the admin user will be returned.
*/
public static String getInitiator(DelegateTask delegateTask)
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* Copyright (C) 2005 - 2025 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -30,12 +30,11 @@ package org.alfresco.workflow.requestInfo;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.alfresco.util.ParameterCheck;
/**
* A variable handler for saving the task variables to the execution context.
* Some of the information will be needed in other tasks (e.g. "rmwf_message").
* This variable handler saves the local task variable to the execution context.
* A variable handler for saving the task variables to the execution context. Some of the information will be needed in other tasks (e.g. "rmwf_message"). This variable handler saves the local task variable to the execution context.
*
* @author Tuna Aksoy
* @since 2.1