mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Add logging to rm query DAO implementation
This commit is contained in:
@@ -56,4 +56,6 @@ log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info
|
||||
# Job debug
|
||||
#
|
||||
#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug
|
||||
log4j.logger.org.alfresco.repo.web.scripts.roles.DynamicAuthoritiesGet=info
|
||||
log4j.logger.org.alfresco.repo.web.scripts.roles.DynamicAuthoritiesGet=info
|
||||
|
||||
log4j.logger.org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAOImpl=debug
|
@@ -43,7 +43,6 @@ import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.version.Version2Model;
|
||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -58,6 +57,11 @@ import org.mybatis.spring.SqlSessionTemplate;
|
||||
*/
|
||||
public class RecordsManagementQueryDAOImpl implements RecordsManagementQueryDAO, RecordsManagementModel
|
||||
{
|
||||
/** logger */
|
||||
@SuppressWarnings("unused")
|
||||
private static final Log logger = LogFactory.getLog(RecordsManagementQueryDAOImpl.class);
|
||||
|
||||
/** query names */
|
||||
private static final String COUNT_IDENTIFIER = "alfresco.query.rm.select_CountRMIndentifier";
|
||||
private static final String GET_CHILDREN_PROPERTY_VALUES = "select_GetStringPropertyValuesOfChildren";
|
||||
private static final String SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL = "select_NodeIdsWhichReferenceContentUrl";
|
||||
@@ -152,9 +156,21 @@ public class RecordsManagementQueryDAOImpl implements RecordsManagementQueryDAO,
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a set of node reference which reference the provided content URL
|
||||
*
|
||||
* @param String contentUrl content URL
|
||||
* @return Set<String> set of node references as strings
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getNodeRefsWhichReferenceContentUrl(String contentUrl)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Getting nodes that reference content URL = " + contentUrl);
|
||||
}
|
||||
|
||||
// create the content URL entity used to query for nodes
|
||||
ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
|
||||
contentUrlEntity.setContentUrl(contentUrl);
|
||||
if (contentUrlEntity.getContentUrlShort() != null)
|
||||
@@ -162,28 +178,60 @@ public class RecordsManagementQueryDAOImpl implements RecordsManagementQueryDAO,
|
||||
contentUrlEntity.setContentUrlShort(contentUrlEntity.getContentUrlShort().toLowerCase());
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Executing query " + SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL);
|
||||
}
|
||||
|
||||
// Get all the node ids which reference the given content url
|
||||
List<Long> nodeIds = template.selectList(SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL, contentUrlEntity);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Query " + SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL + " returned " + nodeIds.size() + " results");
|
||||
}
|
||||
|
||||
// create a set of uuids which reference the content url
|
||||
Set<String> nodesReferencingContentUrl = new HashSet<>();
|
||||
for(Long nodeId : nodeIds)
|
||||
{
|
||||
StringBuilder logMessage = null;
|
||||
String uuidToAdd;
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logMessage = new StringBuilder("Adding uuid ");
|
||||
}
|
||||
|
||||
// if the referencing node is a version2Store reference to the content url, add the uuid for the version 2 frozen node ref
|
||||
NodeRef version2FrozenNodeRef = (NodeRef) nodeDAO.getNodeProperty(nodeId, Version2Model.PROP_QNAME_FROZEN_NODE_REF);
|
||||
if (version2FrozenNodeRef != null)
|
||||
{
|
||||
{
|
||||
uuidToAdd = version2FrozenNodeRef.getId();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logMessage.append(uuidToAdd).append(" (from version)");
|
||||
}
|
||||
}
|
||||
|
||||
// add the uuid for the node ref of the referencing node
|
||||
else
|
||||
{
|
||||
uuidToAdd = (String) nodeDAO.getNodeProperty(nodeId, ContentModel.PROP_NODE_UUID);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logMessage.append(uuidToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
nodesReferencingContentUrl.add(uuidToAdd);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(logMessage.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return nodesReferencingContentUrl;
|
||||
|
@@ -46,8 +46,6 @@ import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.extensions.webscripts.GUID;
|
||||
|
||||
import javax.xml.soap.Node;
|
||||
|
||||
/**
|
||||
* Integration test for RM-4804
|
||||
*
|
||||
|
Reference in New Issue
Block a user