Merged V2.9 to HEAD

9846: Merged V2.2 to V2.9
      9805: Merged V2.1 to V2.2
         9450: WCM - fix minor typo
         9456: Added direct QName child node handling test
         9462: ACT-759 - nested forks issue.
         9495: Lowered thread priority for index merge threads to default 5
         9534: Fixed ETWOONE-242: ContentMetadataExtracter can optionally ditch unextracted aspect-linked properties
         9559: Fixed SDK classpath
         9560: Fix ETWOONE-241
         9583: Fix for ETWOONE-250 (FacesContext null issue when authenticating via a ticket or guest auth)
         9592: (ALREADY ON HEAD)
         9709: Upgrade commons pool


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10607 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-09-01 10:29:50 +00:00
parent 9d3076326f
commit c6a5357918
6 changed files with 163 additions and 22 deletions

View File

@@ -56,14 +56,18 @@ import org.alfresco.service.namespace.QName;
*/
public class ContentMetadataExtracter extends ActionExecuterAbstractBase
{
/**
* The node service
*/
private NodeService nodeService;
private ContentService contentService;
private DictionaryService dictionaryService;
private MetadataExtracterRegistry metadataExtracterRegistry;
private boolean carryAspectProperties;
public ContentMetadataExtracter()
{
carryAspectProperties = true;
}
/**
* Set the node service
*
* @param nodeService the node service
*/
public void setNodeService(NodeService nodeService)
@@ -71,11 +75,6 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
this.nodeService = nodeService;
}
/**
* Our content service
*/
private ContentService contentService;
/**
* @param contentService The contentService to set.
*/
@@ -84,11 +83,6 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
this.contentService = contentService;
}
/**
* The dictionary service
*/
private DictionaryService dictionaryService;
/**
* @param dictService The DictionaryService to set.
*/
@@ -97,11 +91,6 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
this.dictionaryService = dictService;
}
/**
* Our Extracter
*/
private MetadataExtracterRegistry metadataExtracterRegistry;
/**
* @param metadataExtracterRegistry The metadataExtracterRegistry to set.
*/
@@ -110,6 +99,18 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
this.metadataExtracterRegistry = metadataExtracterRegistry;
}
/**
* Whether or not aspect-related properties must be carried to the new version of the node
*
* @param carryAspectProperties <tt>true</tt> (default) to carry all aspect-linked
* properties forward. <tt>false</tt> will clean the
* aspect of any unextracted values.
*/
public void setCarryAspectProperties(boolean carryAspectProperties)
{
this.carryAspectProperties = carryAspectProperties;
}
/**
* @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.service.cmr.repository.NodeRef,
* NodeRef)
@@ -155,6 +156,7 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
// Check that all properties have the appropriate aspect applied
Set<QName> requiredAspectQNames = new HashSet<QName>(3);
Set<QName> aspectPropertyQNames = new HashSet<QName>(17);
for (QName propertyQName : modifiedProperties.keySet())
{
@@ -169,6 +171,21 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
{
QName aspectQName = propertyContainerDef.getName();
requiredAspectQNames.add(aspectQName);
// Get all properties associated with the aspect
Set<QName> aspectProperties = propertyContainerDef.getProperties().keySet();
aspectPropertyQNames.addAll(aspectProperties);
}
}
if (!carryAspectProperties)
{
// Remove any node properties that are defined on the aspects but were not extracted
for (QName aspectPropertyQName : aspectPropertyQNames)
{
if (!modifiedProperties.containsKey(aspectPropertyQName))
{
nodeProperties.remove(aspectPropertyQName);
}
}
}