RM-991: Failed to applay patch AVMToADMRemoteStorePatch during upgrade from 3.4.13 to 4.2.0 with RM on Postgres

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@56093 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-09-27 13:22:51 +00:00
parent 7c03089524
commit 06625fb26f
3 changed files with 29 additions and 26 deletions

View File

@@ -91,29 +91,32 @@ public class NotificationTemplatePatch_v21 extends ModulePatchComponent
{ {
// get the parent node // get the parent node
NodeRef supersededTemplate = notificationHelper.getSupersededTemplate(); NodeRef supersededTemplate = notificationHelper.getSupersededTemplate();
NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef(); if (nodeService.exists(supersededTemplate) == true)
{
// build the node properties NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef();
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4);
props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template."); // build the node properties
props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl"); Map<QName, Serializable> props = new HashMap<QName, Serializable>(4);
props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl"); props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template.");
props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template"); props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl");
props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl");
// get the assoc qname props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template");
QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl"));
// get the assoc qname
// create the node QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl"));
ChildAssociationRef node = nodeService.createNode(parent,
ContentModel.ASSOC_CONTAINS, // create the node
assocQName, ChildAssociationRef node = nodeService.createNode(parent,
ContentModel.TYPE_CONTENT, ContentModel.ASSOC_CONTAINS,
props); assocQName,
ContentModel.TYPE_CONTENT,
// put the content props);
ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true);
InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_REJECTED); // put the content
writer.putContent(is); ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true);
InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_REJECTED);
writer.putContent(is);
}
} }
} }
} }

View File

@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
@@ -84,7 +83,8 @@ public class RMv21BehaviorScriptsPatch extends ModulePatchComponent implements B
// check that the rm config root has been correctly bootstrapped // check that the rm config root has been correctly bootstrapped
if (nodeService.exists(RM_CONFIG) == false) if (nodeService.exists(RM_CONFIG) == false)
{ {
throw new AlfrescoRuntimeException("Unable to complete the patch because RM config root folder does not exist in the data dictionary."); // we don't need to do anything
return;
} }
// check that the behavior scripts folder exists // check that the behavior scripts folder exists

View File

@@ -75,7 +75,7 @@ public class RMv21ReportServicePatch extends ModulePatchComponent
protected void executePatch() throws Throwable protected void executePatch() throws Throwable
{ {
// check whether report dir exists or not // check whether report dir exists or not
if (nodeService.exists(TEMPLATE_ROOT) == false) if (nodeService.exists(RM_CONFIG_FOLDER) == true && nodeService.exists(TEMPLATE_ROOT) == false)
{ {
if (logger.isDebugEnabled() == true) if (logger.isDebugEnabled() == true)
{ {