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
NodeRef supersededTemplate = notificationHelper.getSupersededTemplate();
NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef();
// build the node properties
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4);
props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template.");
props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl");
props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl");
props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template");
// get the assoc qname
QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl"));
// create the node
ChildAssociationRef node = nodeService.createNode(parent,
ContentModel.ASSOC_CONTAINS,
assocQName,
ContentModel.TYPE_CONTENT,
props);
// put the content
ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true);
InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_REJECTED);
writer.putContent(is);
if (nodeService.exists(supersededTemplate) == true)
{
NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef();
// build the node properties
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4);
props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template.");
props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl");
props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl");
props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template");
// get the assoc qname
QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl"));
// create the node
ChildAssociationRef node = nodeService.createNode(parent,
ContentModel.ASSOC_CONTAINS,
assocQName,
ContentModel.TYPE_CONTENT,
props);
// put the content
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.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
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
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

View File

@@ -75,7 +75,7 @@ public class RMv21ReportServicePatch extends ModulePatchComponent
protected void executePatch() throws Throwable
{
// 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)
{