ACE-1447: Added 'cm:indexControl' aspect to surf-config folder and its children so they wouldn’t be indexed. Also added an asynchronous patch.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@72733 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2014-06-02 04:03:57 +00:00
parent 33e6e44d4a
commit 5a021b2565
16 changed files with 1113 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -280,5 +280,27 @@ public interface PatchDAO
* @return
*/
public List<Long> getNodesByContentPropertyMimetypeId(Long mimetypeId, Long minNodeId, Long maxNodeId);
/**
* Gets the total number of nodes which match the given Type QName.
*
* @param typeQName the qname to search for
* @return count of nodes that match the typeQName
*/
public long getCountNodesWithTypId(QName typeQName);
/**
* Finds folders of the shared surf-config (for all tenants):
* <ul>
* <li> company_home/sites/surf-config/components </li>
* <li>company_home/sites/surf-config/pages </li>
* <li>company_home/sites/surf-config/pages/user </li>
* <li>company_home/sites/surf-config/pages/user{userId} </li>
* </ul>
* @param minNodeId - min node id in the result set - inclusive
* @param maxNodeId - max node id in the result set - exclusive
* @return list of children nodeRefs
*/
public List<NodeRef> getChildrenOfTheSharedSurfConfigFolder(Long minNodeId, Long maxNodeId);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -108,6 +108,9 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
private static final String SELECT_NODES_BY_TYPE_URI = "alfresco.patch.select_NodesByTypeUriId";
private static final String SELECT_NODES_BY_ASPECT_QNAME = "alfresco.patch.select_NodesByAspectQName";
private static final String SELECT_NODES_BY_CONTENT_MIMETYPE = "alfresco.patch.select_NodesByContentMimetype";
private static final String SELECT_COUNT_NODES_WITH_TYPE_ID = "alfresco.patch.select_CountNodesWithTypeId";
private static final String SELECT_CHILDREN_OF_THE_SHARED_SURFCONFIG_FOLDER = "alfresco.patch.select_ChildrenOfTheSharedSurfConfigFolder";
private LocaleDAO localeDAO;
@@ -703,4 +706,52 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
params.put("maxNodeId", maxNodeId);
return (List<Long>) template.selectList(SELECT_NODES_BY_CONTENT_MIMETYPE, params);
}
@Override
public long getCountNodesWithTypId(QName typeQName)
{
// Resolve the QName
Pair<Long, QName> qnameId = qnameDAO.getQName(typeQName);
if (qnameId == null)
{
return 0L;
}
IdsEntity params = new IdsEntity();
params.setIdOne(qnameId.getFirst());
Long count = (Long) template.selectOne(SELECT_COUNT_NODES_WITH_TYPE_ID, params);
if (count == null)
{
return 0L;
}
else
{
return count;
}
}
@Override
public List<NodeRef> getChildrenOfTheSharedSurfConfigFolder(Long minNodeId, Long maxNodeId)
{
Map<String, Object> params = new HashMap<String, Object>(2);
params.put("minNodeId", minNodeId);
params.put("maxNodeId", maxNodeId);
final List<NodeRef> results = new ArrayList<NodeRef>(1000);
ResultHandler resultHandler = new ResultHandler()
{
@SuppressWarnings("unchecked")
public void handleResult(ResultContext context)
{
Map<String, Object> row = (Map<String, Object>) context.getResultObject();
String protocol = (String) row.get("protocol");
String identifier = (String) row.get("identifier");
String uuid = (String) row.get("uuid");
NodeRef nodeRef = new NodeRef(new StoreRef(protocol, identifier), uuid);
results.add(nodeRef);
}
};
template.select(SELECT_CHILDREN_OF_THE_SHARED_SURFCONFIG_FOLDER, params, resultHandler);
return results;
}
}