Merged 1.4 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4229 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4230 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4232 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4233 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4234 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4235 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4239 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4240 .
   svn resolved root\projects\web-client\source\java\org\alfresco\web\app\AlfrescoNavigationHandler.java
   svn resolved root\projects\web-client\source\web\WEB-INF\faces-config-beans.xml
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4241 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4242 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4243 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4244 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4244 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4245 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4245 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4246 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4247 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4248 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4248 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4249 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4250 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4251 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4251 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4252 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4633 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-12-18 13:18:44 +00:00
parent 08759fbe26
commit 8e0a637886
21 changed files with 636 additions and 72 deletions

View File

@@ -1325,14 +1325,11 @@ public class LuceneIndexerImpl2 extends LuceneBase2 implements LuceneIndexer2
counter.increment();
}
// TODO: DC: Should this also include aspect child definitions?
QName nodeTypeRef = nodeService.getType(nodeRef);
TypeDefinition nodeTypeDef = getDictionaryService().getType(nodeTypeRef);
// check for child associations
if (includeDirectoryDocuments)
{
if (nodeTypeDef != null && nodeTypeDef.getChildAssociations().size() > 0)
if (mayHaveChildren(nodeRef))
{
if (directPaths.contains(pair.getFirst()))
{
@@ -1429,6 +1426,34 @@ public class LuceneIndexerImpl2 extends LuceneBase2 implements LuceneIndexer2
return docs;
}
/**
* Does the node type or any applied aspect allow this node to have child associations?
*
* @param nodeRef
* @return
*/
private boolean mayHaveChildren(NodeRef nodeRef)
{
// 1) Does the type support children?
QName nodeTypeRef = nodeService.getType(nodeRef);
TypeDefinition nodeTypeDef = getDictionaryService().getType(nodeTypeRef);
if ((nodeTypeDef != null) && (nodeTypeDef.getChildAssociations().size() > 0))
{
return true;
}
// 2) Do any of the applied aspects support children?
Set<QName> aspects = nodeService.getAspects(nodeRef);
for (QName aspect : aspects)
{
AspectDefinition aspectDef = getDictionaryService().getAspect(aspect);
if ((aspectDef != null) && (aspectDef.getChildAssociations().size() > 0))
{
return true;
}
}
return false;
}
private ArrayList<NodeRef> getParents(Path path)
{
ArrayList<NodeRef> parentsInDepthOrderStartingWithSelf = new ArrayList<NodeRef>(8);

View File

@@ -107,6 +107,8 @@ public class LuceneTest2 extends TestCase
QName orderLong = QName.createQName(TEST_NAMESPACE, "orderLong");
QName orderInt = QName.createQName(TEST_NAMESPACE, "orderInt");
QName aspectWithChildren = QName.createQName(TEST_NAMESPACE, "aspectWithChildren");
TransactionService transactionService;
@@ -391,6 +393,38 @@ public class LuceneTest2 extends TestCase
super(arg0);
}
public void testAuxDataIsPresent() throws Exception
{
luceneFTS.pause();
testTX.commit();
testTX = transactionService.getUserTransaction();
testTX.begin();
runBaseTests();
LuceneSearcherImpl2 searcher = LuceneSearcherImpl2.getSearcher(rootNodeRef.getStoreRef(), indexerAndSearcher);
searcher.setNodeService(nodeService);
searcher.setDictionaryService(dictionaryService);
searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver("namespace"));
ResultSet results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "ID:\"" + n14 + "\"", null, null);
assertEquals(1, results.length()); // one node
results.close();
nodeService.addAspect(n14, aspectWithChildren, null);
testTX.commit();
testTX = transactionService.getUserTransaction();
testTX.begin();
searcher = LuceneSearcherImpl2.getSearcher(rootNodeRef.getStoreRef(), indexerAndSearcher);
searcher.setNodeService(nodeService);
searcher.setDictionaryService(dictionaryService);
searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver("namespace"));
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "ID:\"" + n14 + "\"", null, null);
assertEquals(10, results.length()); // one node + 9 aux paths to n14
results.close();
}
public void testFirst() throws Exception
{
testReadAgainstDelta();

View File

@@ -267,6 +267,22 @@
</types>
<aspects>
<aspect name="test:aspectWithChildren">
<title>Aspect With Children</title>
<associations>
<child-association name="test:unused">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>sys:base</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</child-association>
</associations>
</aspect>
<aspect name="test:testSuperAspect">
<title>Test Super Aspect</title>
</aspect>