RM-765: Remove DOD meta-data from core RM model

* remove DOD meta-date from record aspect
 * create dod record aspect in dod model to contain dod specific meta-data (modelled as record mate data aspect so can be added manaually and UI reacts accodingly without modification)
 * automatically add dod record aspect to record when created (maintains status quo for the time being)
 * allow groups to be automatically added to form UI template when record meta-data found on record (DOD meta-data automatically displayed and editable if present)
 * add simple module patch frameowrk so RM patches going forward are module schema based (so order and application is predictable)
 * fix up existing patchs (pre 2.2) so basic order is guarenteed
 * add patch for DOD data reshuffle
 * general restructuring of patch configuration and implementations for clarity



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@59943 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2014-01-15 13:52:30 +00:00
parent ce69cc2341
commit a212fef8e2
76 changed files with 1340 additions and 1113 deletions

View File

@@ -1,36 +1,36 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException}
*/
public class CannotApplyConstraintMetadataException extends CustomMetadataException
{
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));
}
}
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException}
*/
public class CannotApplyConstraintMetadataException extends CustomMetadataException
{
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

@@ -1,32 +1,32 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException}
*/
public abstract class CustomMetadataException extends Exception
{
private static final long serialVersionUID = -6676112294794381360L;
public CustomMetadataException(String msg)
{
super(msg);
}
}
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException}
*/
public abstract class CustomMetadataException extends Exception
{
private static final long serialVersionUID = -6676112294794381360L;
public CustomMetadataException(String msg)
{
super(msg);
}
}

View File

@@ -1,36 +1,36 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException}
*/
public class InvalidCustomAspectMetadataException extends CustomMetadataException
{
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));
}
}
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException}
*/
public class InvalidCustomAspectMetadataException extends CustomMetadataException
{
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

@@ -1,35 +1,35 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.NotCustomisableMetadataException}
*/
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));
}
}
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.NotCustomisableMetadataException}
*/
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

@@ -1,36 +1,36 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException}
*/
public class PropertyAlreadyExistsMetadataException extends CustomMetadataException
{
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));
}
}
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException}
*/
public class PropertyAlreadyExistsMetadataException extends CustomMetadataException
{
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

@@ -18,6 +18,7 @@
*/
package org.alfresco.module.org_alfresco_module_rm.bootstrap;
import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter;
import org.alfresco.repo.module.ImporterModuleComponent;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -31,15 +32,31 @@ import org.alfresco.service.cmr.repository.StoreRef;
*/
public class BootstrapImporterModuleComponent extends ImporterModuleComponent
{
/** root config nore id */
private static final String CONFIG_NODEID = "rm_config_folder";
/** node service */
private NodeService nodeService;
/** module patch executer */
private ModulePatchExecuter modulePatchExecuter;
/**
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @param modulePatchExecuter module patch executer
*/
public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter)
{
this.modulePatchExecuter = modulePatchExecuter;
}
/**
* Need to check whether this module has already been executed.
*
@@ -53,7 +70,13 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID);
if (nodeService.exists(nodeRef) == false)
{
// execute internal
super.executeInternal();
System.out.println("Initialising schema version from config value");
// initialise the schema version (based on current configured value)
modulePatchExecuter.initSchemaVersion();
}
}
catch (Throwable exception)

View File

@@ -32,16 +32,7 @@ public interface DOD5015Model
public static final String DOD_URI = "http://www.alfresco.org/model/dod5015/1.0";
public static final String DOD_PREFIX = "dod";
// DOD Record
public static final QName ASPECT_DOD_5015_RECORD = QName.createQName(DOD_URI, "dod5015record");
public static final QName PROP_ORIGINATOR = QName.createQName(DOD_URI, "originator");
public static final QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(DOD_URI, "originatingOrganization");
public static final QName PROP_PUBLICATION_DATE = QName.createQName(DOD_URI, "publicationDate");
public static final QName PROP_MEDIA_TYPE = QName.createQName(DOD_URI, "mediaType");
public static final QName PROP_FORMAT = QName.createQName(DOD_URI, "format");
public static final QName PROP_DATE_RECEIVED = QName.createQName(DOD_URI, "dateReceived");
// DOD 5015 Custom Type aspects and their properties
// Scanned Record
public static final QName ASPECT_SCANNED_RECORD = QName.createQName(DOD_URI, "scannedRecord");
public static final QName PROP_SCANNED_FORMAT = QName.createQName(DOD_URI, "scannedFormat");

View File

@@ -1,63 +0,0 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.dod5015.model.dod.aspect;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.annotation.Behaviour;
import org.alfresco.repo.policy.annotation.BehaviourBean;
import org.alfresco.repo.policy.annotation.BehaviourKind;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
/**
* dod:dod5015record behaviour bean
*
* @author Roy Wetherall
* @since 2.2
*/
@BehaviourBean
public class DOD5015RecordAspect extends BaseBehaviourBean
implements NodeServicePolicies.OnAddAspectPolicy,
DOD5015Model
{
/**
* Ensure that the DOD record aspect meta-data is applied.
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
@Behaviour
(
kind=BehaviourKind.CLASS,
type="rma:record",
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
@Override
public void onAddAspect(NodeRef nodeRef, QName aspect)
{
if (nodeService.exists(nodeRef) == true &&
nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) == false)
{
nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null);
}
}
}

View File

@@ -426,7 +426,8 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
ParameterCheck.mandatory("filePlan", filePlan);
if (isFilePlan(filePlan) == false)
{
throw new AlfrescoRuntimeException("Unable to get the container " + containerName + ", because passed node is not a file plan.");
throw new AlfrescoRuntimeException("Unable to get the container " + containerName +
", because passed node is not a file plan. (type=" + nodeService.getType(filePlan).toString() + ")");
}
NodeRef result = null;

View File

@@ -124,7 +124,7 @@ public abstract class RecordsManagementFormFilter<ItemType> extends AbstractFilt
* @param props
* @param setId
*/
protected void addPropertyFieldsToGroup(Form form, Map<QName, PropertyDefinition> props, String setId, String setLabel)
protected void addPropertyFieldsToGroup(Form form, Map<QName, PropertyDefinition> props, String setId)
{
if (props != null)
{
@@ -137,7 +137,7 @@ public abstract class RecordsManagementFormFilter<ItemType> extends AbstractFilt
NodeRef nodeRef = new NodeRef(id);
Serializable value = nodeService.getProperty(nodeRef, entry.getKey());
FieldGroup group = new FieldGroup(setId, setLabel, false, false, null);
FieldGroup group = new FieldGroup(setId, null, false, false, null);
Field field = FieldUtils.makePropertyField(prop, value, group, namespaceService, dictionaryService);
form.addField(field);

View File

@@ -39,9 +39,7 @@ import org.alfresco.repo.forms.Form;
import org.alfresco.repo.forms.PropertyFieldDefinition;
import org.alfresco.repo.forms.processor.node.FieldUtils;
import org.alfresco.repo.forms.processor.node.FormFieldConstants;
import org.alfresco.repo.i18n.StaticMessageLookup;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -171,7 +169,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
for (QName customisable : customisables)
{
addPropertyFieldsToGroup(form, rmAdminService.getCustomPropertyDefinitions(customisable), CUSTOM_RM_FIELD_GROUP_ID, null);
addPropertyFieldsToGroup(form, rmAdminService.getCustomPropertyDefinitions(customisable), CUSTOM_RM_FIELD_GROUP_ID);
}
}
@@ -190,15 +188,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
{
String aspectName = aspect.getPrefixedQName(namespaceService).toPrefixString().replace(":", "-");
String setId = RM_METADATA_PREFIX + aspectName;
String setLabel = null;
AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect);
if (aspectDefinition != null)
{
setLabel = aspectDefinition.getTitle(new StaticMessageLookup());
}
addPropertyFieldsToGroup(form, dictionaryService.getPropertyDefs(aspect), setId, setLabel);
addPropertyFieldsToGroup(form, dictionaryService.getPropertyDefs(aspect), setId);
}
}
}

View File

@@ -100,12 +100,12 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
public static final QName ASPECT_RECORD = QName.createQName(RM_URI, "record");
public static final QName PROP_DATE_FILED = QName.createQName(RM_URI, "dateFiled");
public static final QName PROP_ORIGIONAL_NAME = QName.createQName(RM_URI, "origionalName");
// public static final QName PROP_ORIGINATOR = QName.createQName(RM_URI, "originator");
// public static final QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(RM_URI, "originatingOrganization");
// public static final QName PROP_PUBLICATION_DATE = QName.createQName(RM_URI, "publicationDate");
// public static final QName PROP_MEDIA_TYPE = QName.createQName(RM_URI, "mediaType");
// public static final QName PROP_FORMAT = QName.createQName(RM_URI, "format");
// public static final QName PROP_DATE_RECEIVED = QName.createQName(RM_URI, "dateReceived");
public static final QName PROP_ORIGINATOR = QName.createQName(RM_URI, "originator");
public static final QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(RM_URI, "originatingOrganization");
public static final QName PROP_PUBLICATION_DATE = QName.createQName(RM_URI, "publicationDate");
public static final QName PROP_MEDIA_TYPE = QName.createQName(RM_URI, "mediaType");
public static final QName PROP_FORMAT = QName.createQName(RM_URI, "format");
public static final QName PROP_DATE_RECEIVED = QName.createQName(RM_URI, "dateReceived");
// Common record details
public static final QName PROP_LOCATION = QName.createQName(RM_URI, "location");

View File

@@ -21,7 +21,6 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
import org.alfresco.repo.content.ContentServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.annotation.Behaviour;
import org.alfresco.repo.policy.annotation.BehaviourBean;
import org.alfresco.repo.policy.annotation.BehaviourKind;
@@ -34,9 +33,9 @@ import org.springframework.extensions.surf.util.I18NUtil;
* @author Roy Wetherall
* @since 2.2
*/
@BehaviourBean
@BehaviourBean
(
defaultType = "rma:ghosted" // optional
defaultType = "rma:ghosted"
)
public class GhostedAspect extends BaseBehaviourBean
implements ContentServicePolicies.OnContentUpdatePolicy
@@ -48,18 +47,11 @@ public class GhostedAspect extends BaseBehaviourBean
* Ensure that the content of a ghosted node can not be updated.
*
* @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean)
*/
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS, // required, use ASSOC for association behaviors
notificationFrequency = NotificationFrequency.EVERY_EVENT, // (defaults to EVERY_EVENT)
policy = "alf:onContentUpdate", // (defaults to alf:<methodname>)
type = "rma:ghosted" // required, unless defaultType set
// isService (default false)
// name (only needs to specified if associated behvaiour object needs to be accessed)
// assocType (defaults to cm:contains, used with BehaviourKind.ASSOC)
kind = BehaviourKind.CLASS
)
public void onContentUpdate(NodeRef Content, boolean bNew)
{

View File

@@ -0,0 +1,260 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanNameAware;
/**
* Abstract module patch implementation.
*
* @author Roy Wetherall
* @since 2.2
*/
public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
/** logger */
protected static Log logger = LogFactory.getLog(ModulePatch.class);
/** module patch service */
private ModulePatchExecuter modulePatchExecuter;
/** transaction service */
protected TransactionService transactionService;
/** module patch id */
private String id;
/** module patch description */
private String description;
/** module id */
private String moduleId;
/** module patch fixes from module schema number */
private int fixesFromSchema;
/** module patch fixes to module schema number */
private int fixesToSchema;
/** module patch target module schema number */
private int targetSchema;
/**
* Initiialisation method
*/
public void init()
{
modulePatchExecuter.register(this);
}
/**
* @param modulePatchExecuter module patch executer
*/
public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter)
{
this.modulePatchExecuter = modulePatchExecuter;
}
/**
* @param transactionService transaction service
*/
public void setTransactionService(TransactionService transactionService)
{
this.transactionService = transactionService;
}
/**
* @param id module patch id
*/
public void setId(String id)
{
this.id = id;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getId()
*/
@Override
public String getId()
{
return id;
}
/**
* Convenience method to set the module patch id to the bean name (if not already specified)
*/
@Override
public void setBeanName(String beanName)
{
if (id == null)
{
id = beanName;
}
}
/**
* @param description module patch description
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getDescription()
*/
@Override
public String getDescription()
{
return description;
}
/**
* @param moduleId module id
*/
public void setModuleId(String moduleId)
{
this.moduleId = moduleId;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getModuleId()
*/
@Override
public String getModuleId()
{
return moduleId;
}
public void setFixesFromSchema(int fixesFromSchema)
{
this.fixesFromSchema = fixesFromSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesFromSchema()
*/
@Override
public int getFixesFromSchema()
{
return fixesFromSchema;
}
public void setFixesToSchema(int fixesToSchema)
{
this.fixesToSchema = fixesToSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesToSchema()
*/
@Override
public int getFixesToSchema()
{
return fixesToSchema;
}
public void setTargetSchema(int targetSchema)
{
this.targetSchema = targetSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getTargetSchema()
*/
@Override
public int getTargetSchema()
{
return targetSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#apply()
*/
@Override
public void apply()
{
if (logger.isInfoEnabled() == true)
{
logger.info("Executing module patch \"" + description + "\"");
}
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... id=" + id +
",moduleId=" + moduleId +
",from=" + fixesFromSchema +
",to=" + fixesToSchema +
",target=" + targetSchema);
}
transactionService.getRetryingTransactionHelper().doInTransaction(
new ApplyCallback(),
true,
false);
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... module patch applied");
}
}
/**
* Apply patch internal method. Implementations can assume a transaction has
* been started.
*/
public abstract void applyInternal();
/**
* Apply callback worker class implementation
*/
private class ApplyCallback implements RetryingTransactionCallback<Void>
{
/**
* @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute()
*/
@Override
public Void execute() throws Throwable
{
applyInternal();
return null;
}
}
/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
public int compareTo(ModulePatch o)
{
int result = 0;
if (getTargetSchema() < o.getTargetSchema())
{
result = -1;
}
else if (getTargetSchema() > o.getTargetSchema())
{
result = 1;
}
return result;
}
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
/**
* Module Patch Interface
*
* @author Roy Wetherall
* @since 2.2
*/
public interface ModulePatch extends Comparable<ModulePatch>
{
/**
* @return module patch id
*/
String getId();
/**
* @return module patch description
*/
String getDescription();
/**
* @return module id this patch applies to
*/
String getModuleId();
/**
* @return smallest module schema number that this patch may be applied to
*/
int getFixesFromSchema();
/**
* @return largest module schema number that this patch may be applied to
*/
int getFixesToSchema();
/**
* @return module schema number that this patch attempts to bring the repo up to
*/
int getTargetSchema();
/**
* Apply the module patch
*/
void apply();
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
/**
* Module patch service interface
*
* @author Roy Wetherall
* @since 2.2
*/
public interface ModulePatchExecuter
{
/**
* Register module patch with the module patch executer
*
* @param modulePatch module patch
*/
void register(ModulePatch modulePatch);
/**
* Init the schema version number
*/
void initSchemaVersion();
}

View File

@@ -0,0 +1,168 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.module.AbstractModuleComponent;
import org.alfresco.service.cmr.attributes.AttributeService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Module patch executer base implementation
*
* @author Roy Wetherall
* @since 2.2
*/
public class ModulePatchExecuterImpl extends AbstractModuleComponent
implements ModulePatchExecuter
{
/** logger */
protected static Log logger = LogFactory.getLog(ModulePatchExecuterImpl.class);
/** default start schema */
private static final int START_SCHEMA = 0;
/** attribute key */
private static final String KEY_MODULE_SCHEMA = "module-schema";
/** configured module schema version */
protected int moduleSchema = START_SCHEMA;
/** attribute service */
protected AttributeService attributeService;
/** module patches */
protected Map<String, ModulePatch> modulePatches = new HashMap<String, ModulePatch>(21);
/**
* @param attributeService attribute service
*/
public void setAttributeService(AttributeService attributeService)
{
this.attributeService = attributeService;
}
/**
* @param moduleSchema configured module schema version
*/
public void setModuleSchema(int moduleSchema)
{
this.moduleSchema = moduleSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#register(org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch)
*/
@Override
public void register(ModulePatch modulePatch)
{
// ensure that the module patch being registered relates to the module id
if (getModuleId().equals(modulePatch.getModuleId()) == false)
{
throw new AlfrescoRuntimeException("Unable to register module patch, becuase module id is invalid.");
}
if (logger.isDebugEnabled() == true)
{
logger.debug("Registering module patch " + modulePatch.getId() + " for module " + getModuleId());
}
modulePatches.put(modulePatch.getId(), modulePatch);
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executeInternal() throws Throwable
{
// get current schema version
int currentSchema = getCurrentSchema();
if (logger.isDebugEnabled() == true)
{
logger.debug("Running module patch executer (currentSchema=" + currentSchema + ", configuredSchema=" + moduleSchema + ")");
}
if (moduleSchema > currentSchema)
{
// determine what patches should be applied
List<ModulePatch> patchesToApply = new ArrayList<ModulePatch>(13);
for (ModulePatch modulePatch : modulePatches.values())
{
if (modulePatch.getFixesFromSchema() <= currentSchema &&
modulePatch.getFixesToSchema() >= currentSchema)
{
patchesToApply.add(modulePatch);
}
}
// apply the patches in the correct order
Collections.sort(patchesToApply);
for (ModulePatch patchToApply : patchesToApply)
{
patchToApply.apply();
}
// update the schema
updateSchema(moduleSchema);
}
}
/**
* Get the currently recorded schema version for the module
*
* @return int currently recorded schema version
*/
protected int getCurrentSchema()
{
Integer result = START_SCHEMA;
if (attributeService.exists(KEY_MODULE_SCHEMA, getModuleId()) == true)
{
result = (Integer)attributeService.getAttribute(KEY_MODULE_SCHEMA, getModuleId());
}
return result;
}
/**
* Update the recorded schema version for the module.
*
* @param newSchema new schema version
*/
protected void updateSchema(int newSchema)
{
attributeService.setAttribute(new Integer(newSchema), KEY_MODULE_SCHEMA, getModuleId());
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#initSchemaVersion()
*/
@Override
public void initSchemaVersion()
{
updateSchema(moduleSchema);
}
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright (C) 2005-2013 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* RM v2.2 patch to updated modified capabilities.
*
* @author Tuna Aksoy
* @since 2.2
*/
public class RMv22CapabilityPatch extends BaseRMCapabilityPatch
{
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
{
Set<NodeRef> filePlans = getFilePlans();
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... updating " + filePlans.size() + " file plans");
}
for (NodeRef filePlan : filePlans)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... updating file plan " + filePlan.toString());
}
// add new capability
addCapability(filePlan,
"FileDestructionReport",
FilePlanRoleService.ROLE_ADMIN,
FilePlanRoleService.ROLE_RECORDS_MANAGER);
}
}
}

View File

@@ -16,8 +16,9 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.compatibility;
import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuterImpl;
import org.alfresco.repo.module.AbstractModuleComponent;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
@@ -31,6 +32,7 @@ import org.apache.commons.logging.LogFactory;
* @author Roy Wetherall
* @since 2.1
*/
@Deprecated
public abstract class ModulePatchComponent extends AbstractModuleComponent
{
/** logger */
@@ -42,6 +44,9 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
/** Behaviour filter */
protected BehaviourFilter behaviourFilter;
/** module patch executer */
protected ModulePatchExecuterImpl modulePatchExecuter;
/**
* @param retryingTransactionHelper retrying transaction helper
*/
@@ -58,6 +63,24 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
this.behaviourFilter = behaviourFilter;
}
/**
* @param modulePatchExecuter module patch executer
*/
public void setModulePatchExecuter(ModulePatchExecuterImpl modulePatchExecuter)
{
this.modulePatchExecuter = modulePatchExecuter;
}
/**
* Init method
*/
@Override
public void init()
{
super.init();
modulePatchExecuter.getDependsOn().add(this);
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v20;
import java.io.InputStream;
import java.io.Serializable;
@@ -25,6 +25,7 @@ import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper;
import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.cmr.audit.AuditService;
import org.alfresco.service.cmr.repository.ContentService;
@@ -39,8 +40,12 @@ import org.alfresco.service.namespace.QName;
import org.springframework.beans.factory.BeanNameAware;
/**
* Notification template patch implementation
*
* @author Roy Wetherall
* @since 2.0
*/
@SuppressWarnings("deprecation")
public class NotificationTemplatePatch extends ModulePatchComponent
implements BeanNameAware
{

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v20;
import java.io.Serializable;
import java.util.List;
@@ -26,6 +26,7 @@ import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.domain.node.NodeDAO;
@@ -43,7 +44,9 @@ import org.springframework.beans.factory.BeanNameAware;
* RM v2.0 File Plan Node Ref Patch
*
* @author Roy Wetherall
* @since 2.0
*/
@SuppressWarnings("deprecation")
public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{

View File

@@ -16,12 +16,13 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v20;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent;
import org.alfresco.repo.domain.node.NodeDAO;
import org.alfresco.repo.domain.patch.PatchDAO;
import org.alfresco.repo.domain.qname.QNameDAO;
@@ -33,9 +34,10 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* RM v2.0 Model Updates Patch
*
*
* @author Roy Wetherall
* @since 2.0
*/
@SuppressWarnings("deprecation")
public class RMv2ModelPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{

View File

@@ -16,13 +16,14 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v20;
import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent;
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails;
import org.alfresco.service.cmr.repository.ContentService;
@@ -34,9 +35,10 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* RM v2.0 Saved Search Patch
*
*
* @author Roy Wetherall
* @since 2.0
*/
@SuppressWarnings("deprecation")
public class RMv2SavedSearchPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.io.InputStream;
import java.io.Serializable;
@@ -40,7 +40,7 @@ import org.alfresco.service.namespace.QName;
* @author Tuna Aksoy
* @since 2.1
*/
public class NotificationTemplatePatch_v21 extends ModulePatchComponent
public class NotificationTemplatePatch_v21 extends RMv21PatchComponent
{
/** Email template path */
private static final String PATH_REJECTED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl";

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.io.Serializable;
import java.util.HashMap;
@@ -44,7 +44,8 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Craig Tan
* @since 2.1
*/
public class RMv21BehaviorScriptsPatch extends ModulePatchComponent implements BeanNameAware
@SuppressWarnings("deprecation")
public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements BeanNameAware
{
/** rm config folder root lookup */
protected static final NodeRef RM_CONFIG = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder");
@@ -81,7 +82,7 @@ public class RMv21BehaviorScriptsPatch extends ModulePatchComponent implements B
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchComponent#executePatch()
* @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch()
*/
@Override
protected void executePatch() throws Throwable

View File

@@ -16,11 +16,16 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef;
/**
@@ -29,8 +34,91 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @author Roy Wetherall
* @since 2.1
*/
public class RMv21CapabilityPatch extends BaseRMCapabilityPatch
@SuppressWarnings("deprecation")
public class RMv21CapabilityPatch extends RMv21PatchComponent
{
/** File plan service */
private FilePlanService filePlanService;
/** File plan role service */
private FilePlanRoleService filePlanRoleService;
/** Capability service */
private CapabilityService capabilityService;
/**
* @param filePlanRoleService file plan role service
*/
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.filePlanRoleService = filePlanRoleService;
}
/**
* @param capabilityService capability service
*/
public void setCapabilityService(CapabilityService capabilityService)
{
this.capabilityService = capabilityService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* Helper method to get the file plans
*
* @return Set of file plan node references
*/
protected Set<NodeRef> getFilePlans()
{
return filePlanService.getFilePlans();
}
/**
* Adds a new capability to the specified roles.
*
* @param filePlan file plan
* @param capabilityName capability name
* @param roles roles
*/
protected void addCapability(NodeRef filePlan, String capabilityName, String ... roles)
{
Capability capability = capabilityService.getCapability(capabilityName);
if (capability == null)
{
throw new AlfrescoRuntimeException("Unable to bootstrap RMv21 capabilities, because capability " + capabilityName + " does not exist.");
}
for (String roleName : roles)
{
Role role = filePlanRoleService.getRole(filePlan, roleName);
if (role != null)
{
// get the roles current capabilities
Set<Capability> capabilities = role.getCapabilities();
// only update if the capability is missing
if (capabilities.contains(capability) == false)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... adding capability " + capabilityName + " to role " + role.getName());
}
capabilities.add(capability);
filePlanRoleService.updateRole(filePlan, role.getName(), role.getDisplayLabel(), capabilities);
}
}
}
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.util.HashSet;
import java.util.List;
@@ -47,7 +47,8 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Roy Wetherall
* @since 2.1
*/
public class RMv21InPlacePatch extends ModulePatchComponent
@SuppressWarnings("deprecation")
public class RMv21InPlacePatch extends RMv21PatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
/** Extended reader and writer role details */
@@ -202,7 +203,6 @@ public class RMv21InPlacePatch extends ModulePatchComponent
NodeRef container = filePlanService.getHoldContainer(filePlan);
@SuppressWarnings("deprecation")
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
@@ -221,7 +221,6 @@ public class RMv21InPlacePatch extends ModulePatchComponent
NodeRef container = filePlanService.getTransferContainer(filePlan);
@SuppressWarnings("deprecation")
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{

View File

@@ -0,0 +1,76 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent;
import org.alfresco.repo.module.ModuleComponent;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* Convenience class to ensure all V2.0 patches are executed before v2.1
*
* @author Roy Wetherall
* @since 2.2
*/
@SuppressWarnings("deprecation")
public abstract class RMv21PatchComponent extends ModulePatchComponent
implements ApplicationContextAware
{
/** application context */
private ApplicationContext applicationContext;
/**
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
this.applicationContext = applicationContext;
}
/**
* init method
*/
@Override
public void init()
{
super.init();
// manual addition of V20 patch dependencies
List<ModuleComponent> depends = getDependsOn();
addDependency(depends, "org_alfresco_module_rm_notificationTemplatePatch");
addDependency(depends, "org_alfresco_module_rm_RMv2ModelPatch");
addDependency(depends, "org_alfresco_module_rm_RMv2FilePlanNodeRefPatch");
addDependency(depends, "org_alfresco_module_rm_RMv2SavedSearchPatch");
}
/**
* @param depends list of module dependencies
* @param beanName bean name
*/
private void addDependency(List<ModuleComponent> depends, String beanName)
{
ModuleComponent moduleComponent = (ModuleComponent)applicationContext.getBean(beanName);
depends.add(moduleComponent);
}
}

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.io.Serializable;
import java.util.HashMap;
@@ -40,7 +40,8 @@ import org.springframework.extensions.surf.util.I18NUtil;
*
* @author Roy Wetherall
*/
public class RMv2RMAdminUserPatch extends ModulePatchComponent implements BeanNameAware
@SuppressWarnings("deprecation")
public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNameAware
{
/** I18N */
private static final String MSG_FIRST_NAME = "bootstrap.rmadmin.firstName";

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.util.List;
@@ -39,7 +39,8 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Roy Wetherall
* @since 2.1
*/
public class RMv21RecordInheritancePatch extends ModulePatchComponent
@SuppressWarnings("deprecation")
public class RMv21RecordInheritancePatch extends RMv21PatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
/** file plan permission service */

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.io.InputStream;
import java.io.Serializable;
@@ -40,7 +40,8 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Roy Wetherall
* @since 2.1
*/
public class RMv21ReportServicePatch extends ModulePatchComponent
@SuppressWarnings("deprecation")
public class RMv21ReportServicePatch extends RMv21PatchComponent
implements BeanNameAware
{
private static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates");

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v21;
import java.util.Arrays;
import java.util.HashSet;
@@ -36,7 +36,8 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Tuna Aksoy
* @since 2.1
*/
public class RMv21RolesPatch extends ModulePatchComponent implements BeanNameAware
@SuppressWarnings("deprecation")
public class RMv21RolesPatch extends RMv21PatchComponent implements BeanNameAware
{
/** file plan service */
private FilePlanService filePlanService;
@@ -63,7 +64,7 @@ public class RMv21RolesPatch extends ModulePatchComponent implements BeanNameAwa
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchComponent#executePatch()
* @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch()
*/
@Override
protected void executePatch() throws Throwable

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v22;
import java.util.Set;
@@ -24,18 +24,20 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Base class for the capability patch classes
* RM v2.2 patch to updated modified capabilities.
*
* @author Tuna Aksoy
* @since 2.2
*/
public abstract class BaseRMCapabilityPatch extends ModulePatchComponent
public class RMv22CapabilityPatch extends AbstractModulePatch
{
/** File plan service */
private FilePlanService filePlanService;
@@ -117,4 +119,32 @@ public abstract class BaseRMCapabilityPatch extends ModulePatchComponent
}
}
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal()
*/
@Override
public void applyInternal()
{
Set<NodeRef> filePlans = getFilePlans();
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... updating " + filePlans.size() + " file plans");
}
for (NodeRef filePlan : filePlans)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... updating file plan " + filePlan.toString());
}
// add new capability
addCapability(filePlan,
"FileDestructionReport",
FilePlanRoleService.ROLE_ADMIN,
FilePlanRoleService.ROLE_RECORDS_MANAGER);
}
}
}

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.patch;
package org.alfresco.module.org_alfresco_module_rm.patch.v22;
import java.io.InputStream;
import java.io.Serializable;
@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
@@ -39,7 +40,7 @@ import org.alfresco.service.namespace.QName;
* @author Tuna Aksoy
* @since 2.2
*/
public class RMv22ReportTemplatePatch extends ModulePatchComponent
public class RMv22ReportTemplatePatch extends AbstractModulePatch
{
/** Report template path */
private static final String REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl";
@@ -70,8 +71,11 @@ public class RMv22ReportTemplatePatch extends ModulePatchComponent
this.contentService = contentService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal()
*/
@Override
protected void executePatch() throws Throwable
public void applyInternal()
{
NodeRef transferReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, TRANSFER_REPORT);
NodeRef destructionReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, DESTRUCTION_REPORT);

View File

@@ -0,0 +1,33 @@
package org.alfresco.repo.admin.patch;
/**
*
* @author Roy Wetherall
*/
public class AppliedModulePatch extends AppliedPatch
{
private String moduleId;
public AppliedModulePatch()
{
super();
}
public AppliedModulePatch(AppliedModulePatch appliedModulePatch)
{
super(appliedModulePatch);
this.moduleId = appliedModulePatch.getModuleId();
}
public String getModuleId()
{
return this.moduleId;
}
public void setModuleId(String moduleId)
{
this.moduleId = moduleId;
}
}

View File

@@ -0,0 +1 @@
Files in this directory will be added to the jar.