Tweak to code as part of ACE-3671. Needed to handle a null facetsRoot folder during a webscript POST.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@92841 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2015-01-04 16:28:41 +00:00
parent 11a8f28044
commit 9f56ff88e0

View File

@@ -423,11 +423,12 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean
} }
// Get the facet root node reference // Get the facet root node reference
final NodeRef facetRoot = getFacetsRoot(); NodeRef facetRoot = getFacetsRoot();
if (facetRoot == null) if (facetRoot == null)
{ {
createFacetsRootFolder(); facetRoot = createFacetsRootFolder();
} }
final NodeRef finalFacetRoot = facetRoot;
return AuthenticationUtil.runAs(new RunAsWork<NodeRef>() return AuthenticationUtil.runAs(new RunAsWork<NodeRef>()
{ {
@@ -438,13 +439,13 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean
{ {
public NodeRef execute() throws Exception public NodeRef execute() throws Exception
{ {
behaviourFilter.disableBehaviour(facetRoot, ContentModel.ASPECT_AUDITABLE); behaviourFilter.disableBehaviour(finalFacetRoot, ContentModel.ASPECT_AUDITABLE);
try try
{ {
Map<QName, Serializable> properties = createNodeProperties(facetProperties); Map<QName, Serializable> properties = createNodeProperties(facetProperties);
// We don't want the node to be indexed // We don't want the node to be indexed
properties.put(ContentModel.PROP_IS_INDEXED, false); properties.put(ContentModel.PROP_IS_INDEXED, false);
NodeRef ref = nodeService.createNode(facetRoot, ContentModel.ASSOC_CONTAINS, NodeRef ref = nodeService.createNode(finalFacetRoot, ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, filterID), QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, filterID),
SolrFacetModel.TYPE_FACET_FIELD, properties).getChildRef(); SolrFacetModel.TYPE_FACET_FIELD, properties).getChildRef();
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
@@ -455,7 +456,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean
} }
finally finally
{ {
behaviourFilter.enableBehaviour(facetRoot, ContentModel.ASPECT_AUDITABLE); behaviourFilter.enableBehaviour(finalFacetRoot, ContentModel.ASPECT_AUDITABLE);
} }
} }
}, false); }, false);