mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged BRANCHES/V2.2 to BRANCHES/V2.3:
97444: RM-1586 Restricted the custom metadata property names to alphanumeric and a few special characters 97026: RM-1660 Fixed NPE exception on schema upgrade Also fixed transaction type for the capabilities schema update. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.3@97447 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -59,6 +59,12 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
|
||||
/** module patch target module schema number */
|
||||
private int targetSchema;
|
||||
|
||||
/** if it should use a read only transaction */
|
||||
private boolean txnReadOnly = true;
|
||||
|
||||
/** if it should use a new transaction */
|
||||
private boolean txnRequiresNew = false;
|
||||
|
||||
/**
|
||||
* Initiialisation method
|
||||
*/
|
||||
@@ -67,6 +73,16 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
|
||||
modulePatchExecuter.register(this);
|
||||
}
|
||||
|
||||
protected void setTxnReadOnly(boolean txnReadOnly)
|
||||
{
|
||||
this.txnReadOnly = txnReadOnly;
|
||||
}
|
||||
|
||||
protected void setTxnRequiresNew(boolean txnRequiresNew)
|
||||
{
|
||||
this.txnRequiresNew = txnRequiresNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modulePatchExecuter module patch executer
|
||||
*/
|
||||
@@ -216,8 +232,8 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
|
||||
// do patch in transaction
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new ApplyCallback(),
|
||||
true,
|
||||
false);
|
||||
txnReadOnly,
|
||||
txnRequiresNew);
|
||||
|
||||
if (LOGGER.isInfoEnabled())
|
||||
{
|
||||
|
@@ -128,5 +128,13 @@ public abstract class CapabilityPatch extends AbstractModulePatch
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
setTxnReadOnly(false);
|
||||
setTxnRequiresNew(true);
|
||||
super.apply();
|
||||
}
|
||||
|
||||
protected abstract void applyCapabilityPatch(NodeRef filePlan);
|
||||
}
|
||||
|
@@ -126,35 +126,45 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
|
||||
|
||||
NodeRef filePlan = filePlanService.getFilePlan(filePlanComponentNodeRef);
|
||||
|
||||
// set the file plan node reference
|
||||
if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null)
|
||||
if(filePlan != null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF, filePlan);
|
||||
// set the file plan node reference
|
||||
if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF, filePlan);
|
||||
}
|
||||
|
||||
// only set the admin permissions on record categories, record folders and records
|
||||
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(filePlanComponentNodeRef);
|
||||
if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) ||
|
||||
FilePlanComponentKind.RECORD_FOLDER.equals(kind) ||
|
||||
FilePlanComponentKind.RECORD.equals(kind))
|
||||
{
|
||||
// ensure the that the records management role has read and file on the node
|
||||
Role adminRole = filePlanRoleService.getRole(filePlan, "Administrator");
|
||||
if (adminRole != null)
|
||||
{
|
||||
permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||
}
|
||||
|
||||
// ensure that the default vital record default values have been set (RM-753)
|
||||
Serializable vitalRecordIndicator = nodeService.getProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR);
|
||||
if (vitalRecordIndicator == null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR, false);
|
||||
}
|
||||
Serializable reviewPeriod = nodeService.getProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD);
|
||||
if (reviewPeriod == null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD, new Period("none|0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only set the admin permissions on record categories, record folders and records
|
||||
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(filePlanComponentNodeRef);
|
||||
if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) ||
|
||||
FilePlanComponentKind.RECORD_FOLDER.equals(kind) ||
|
||||
FilePlanComponentKind.RECORD.equals(kind))
|
||||
else
|
||||
{
|
||||
// ensure the that the records management role has read and file on the node
|
||||
Role adminRole = filePlanRoleService.getRole(filePlan, "Administrator");
|
||||
if (adminRole != null)
|
||||
if (LOGGER.isWarnEnabled())
|
||||
{
|
||||
permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||
}
|
||||
|
||||
// ensure that the default vital record default values have been set (RM-753)
|
||||
Serializable vitalRecordIndicator = nodeService.getProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR);
|
||||
if (vitalRecordIndicator == null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR, false);
|
||||
}
|
||||
Serializable reviewPeriod = nodeService.getProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD);
|
||||
if (reviewPeriod == null)
|
||||
{
|
||||
nodeService.setProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD, new Period("none|0"));
|
||||
LOGGER.warn(" ... node " + filePlanComponent.toString() + " was skiped, beacuse there was no associated file plan.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user