diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties
index 6dbb633ad4..994a81636e 100644
--- a/config/alfresco/messages/patch-service.properties
+++ b/config/alfresco/messages/patch-service.properties
@@ -161,5 +161,8 @@ patch.redeploySubmitProcess.description=Re-deploy WCM Submit Process Definition.
patch.AVMLocking.description=Adds existing web projects to locking service.
patch.AVMLocking.result=Necessary web projects added.
+patch.AVMAspects.description=Changes storage of aspects on AVM Nodes.
+patch.AVMAspects.result=Aspects were moved.
+
patch.ReadmeTemplate.description=Deployed ReadMe Template
patch.webScriptsReadme.description=Applied ReadMe template to Web Scripts folders
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index 1fbd327e61..7abea2ce3d 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -753,23 +753,23 @@
classpath:alfresco/dbscripts/upgrade/2.1/${db.script.dialect}/AlfrescoSchemaUpdate-2.1-VersionColumns.sql
-
-
- patch.webscriptsExtension
- patch.webscriptsExtension.description
- 0
- 54
- 55
-
-
-
-
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/webScriptsExtensions.xml
-
-
+
+
+ patch.webscriptsExtension
+ patch.webscriptsExtension.description
+ 0
+ 54
+ 55
+
+
+
+
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/webScriptsExtensions.xml
+
+
@@ -814,18 +814,18 @@
-
-
-
- patch.AVMLocking
- patch.AVMLocking.description
- 0
- 58
- 59
-
-
-
-
+
+
+
+ patch.AVMLocking
+ patch.AVMLocking.description
+ 0
+ 58
+ 59
+
+
+
+
patch.ReadmeTemplate
@@ -862,5 +862,15 @@
-
+
+
+ patch.AVMAspects
+ patch.AVMAspects.description
+ 0
+ 60
+ 61
+
+
+
+
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index fa81832ca9..675d274391 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -19,4 +19,4 @@ version.build=@build-number@
# Schema number
-version.schema=60
+version.schema=61
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/AVMAspectsPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/AVMAspectsPatch.java
new file mode 100644
index 0000000000..968bb6c723
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/AVMAspectsPatch.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing
+ */
+
+package org.alfresco.repo.admin.patch.impl;
+
+import java.util.Iterator;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.avm.AVMAspectName;
+import org.alfresco.repo.avm.AVMAspectNameDAO;
+
+/**
+ * Patches from old style aspect storage for AVM to new style.
+ * @author britt
+ */
+public class AVMAspectsPatch extends AbstractPatch
+{
+ private static final String MSG_SUCCESS = "patch.AVMAspects.result";
+
+ private AVMAspectNameDAO fAVMAspectDAO;
+
+ public void setAvmAspectNameDAO(AVMAspectNameDAO dao)
+ {
+ fAVMAspectDAO = dao;
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.repo.admin.patch.AbstractPatch#applyInternal()
+ */
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ Iterator iter = fAVMAspectDAO.iterator();
+ while (iter.hasNext())
+ {
+ AVMAspectName aspect = iter.next();
+ aspect.getNode().getAspects().add(aspect.getName());
+ fAVMAspectDAO.delete(aspect);
+ }
+ return I18NUtil.getMessage(MSG_SUCCESS);
+ }
+}
diff --git a/source/java/org/alfresco/repo/avm/AVMAspectNameDAO.java b/source/java/org/alfresco/repo/avm/AVMAspectNameDAO.java
index 57efbc5b94..265d699780 100644
--- a/source/java/org/alfresco/repo/avm/AVMAspectNameDAO.java
+++ b/source/java/org/alfresco/repo/avm/AVMAspectNameDAO.java
@@ -23,6 +23,7 @@
package org.alfresco.repo.avm;
+import java.util.Iterator;
import java.util.List;
import org.alfresco.service.namespace.QName;
@@ -72,4 +73,10 @@ public interface AVMAspectNameDAO
* @return Whether the aspect is there.
*/
public boolean exists(AVMNode node, QName name);
+
+ /**
+ * Get an iterator over all aspect instances.
+ * @return
+ */
+ public Iterator iterator();
}
diff --git a/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java b/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java
index 0ec294c906..6aa70e5c0e 100644
--- a/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java
+++ b/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java
@@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.PropertyValue;
@@ -226,7 +227,7 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
/* (non-Javadoc)
* @see org.alfresco.service.cmr.avm.AVMService#getAspects(int, java.lang.String)
*/
- public List getAspects(int version, String path)
+ public Set getAspects(int version, String path)
{
return fService.getAspects(version, path);
}
diff --git a/source/java/org/alfresco/repo/avm/AVMNode.java b/source/java/org/alfresco/repo/avm/AVMNode.java
index 5597593afa..5251f7743a 100644
--- a/source/java/org/alfresco/repo/avm/AVMNode.java
+++ b/source/java/org/alfresco/repo/avm/AVMNode.java
@@ -23,6 +23,7 @@
package org.alfresco.repo.avm;
import java.util.Map;
+import java.util.Set;
import org.alfresco.repo.domain.DbAccessControlList;
import org.alfresco.repo.domain.PropertyValue;
@@ -228,4 +229,10 @@ public interface AVMNode
* @param guid
*/
public void setGuid(String guid);
+
+ /**
+ * Get the Aspects that this node has.
+ * @return A Set of Aspects names.
+ */
+ public Set getAspects();
}
diff --git a/source/java/org/alfresco/repo/avm/AVMNodeImpl.java b/source/java/org/alfresco/repo/avm/AVMNodeImpl.java
index 6173d9604f..b07abfb443 100644
--- a/source/java/org/alfresco/repo/avm/AVMNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMNodeImpl.java
@@ -25,8 +25,10 @@ package org.alfresco.repo.avm;
import java.io.Serializable;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.alfresco.repo.avm.util.RawServices;
import org.alfresco.repo.domain.DbAccessControlList;
@@ -83,11 +85,17 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
private String fGUID;
+ /**
+ * The Aspects that belong to this node.
+ */
+ private Set fAspects;
+
/**
* Default constructor.
*/
protected AVMNodeImpl()
{
+ fAspects = new HashSet();
}
/**
@@ -98,6 +106,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
protected AVMNodeImpl(long id,
AVMStore store)
{
+ fAspects = new HashSet();
fID = id;
fVersionID = -1;
fIsRoot = false;
@@ -351,16 +360,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
protected void copyAspects(AVMNode other)
{
- List aspects =
- AVMDAOs.Instance().fAVMAspectNameDAO.get(other);
- for (AVMAspectName name : aspects)
- {
- AVMAspectName newName =
- new AVMAspectNameImpl();
- newName.setName(name.getName());
- newName.setNode(this);
- AVMDAOs.Instance().fAVMAspectNameDAO.save(newName);
- }
+ fAspects = new HashSet(other.getAspects());
}
protected void copyACLs(AVMNode other)
@@ -538,4 +538,21 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
{
fGUID = guid;
}
+
+ /* (non-Javadoc)
+ * @see org.alfresco.repo.avm.AVMNode#getAspects()
+ */
+ public Set getAspects()
+ {
+ return fAspects;
+ }
+
+ /**
+ * Set the aspects on this node.
+ * @param aspects
+ */
+ public void setAspects(Set aspects)
+ {
+ fAspects = aspects;
+ }
}
diff --git a/source/java/org/alfresco/repo/avm/AVMNodeService.java b/source/java/org/alfresco/repo/avm/AVMNodeService.java
index d4a997edfc..5b50ef7e88 100644
--- a/source/java/org/alfresco/repo/avm/AVMNodeService.java
+++ b/source/java/org/alfresco/repo/avm/AVMNodeService.java
@@ -742,8 +742,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
}
try
{
- List aspects = fAVMService.getAspects(version, path);
- for (QName name : aspects)
+ for (QName name : fAVMService.getAspects(version, path))
{
result.add(name);
}
diff --git a/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java b/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java
index 0ff33f3a7b..d93f61fdd1 100644
--- a/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java
+++ b/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java
@@ -8,6 +8,7 @@ import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.PropertyValue;
@@ -476,7 +477,7 @@ public class AVMRemoteLocal implements AVMRemote
/* (non-Javadoc)
* @see org.alfresco.service.cmr.remote.AVMRemote#getAspects(int, java.lang.String)
*/
- public List getAspects(int version, String path)
+ public Set getAspects(int version, String path)
{
return fService.getAspects(version, path);
}
diff --git a/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java b/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java
index 32bf2347d7..a571d65316 100644
--- a/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java
+++ b/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java
@@ -11,6 +11,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.PropertyValue;
@@ -1013,7 +1014,7 @@ public class AVMRemoteTransportService implements AVMRemoteTransport, Runnable
/* (non-Javadoc)
* @see org.alfresco.service.cmr.remote.AVMRemoteTransport#getAspects(java.lang.String, int, java.lang.String)
*/
- public List getAspects(String ticket, int version, String path)
+ public Set getAspects(String ticket, int version, String path)
{
fAuthService.validate(ticket);
return fAVMService.getAspects(version, path);
diff --git a/source/java/org/alfresco/repo/avm/AVMRepository.java b/source/java/org/alfresco/repo/avm/AVMRepository.java
index 1a92087a90..9918a4e2c8 100644
--- a/source/java/org/alfresco/repo/avm/AVMRepository.java
+++ b/source/java/org/alfresco/repo/avm/AVMRepository.java
@@ -31,6 +31,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.content.ContentStore;
@@ -2260,7 +2261,7 @@ public class AVMRepository
* @param path The path to the node.
* @return A List of the QNames of the Aspects.
*/
- public List getAspects(int version, String path)
+ public Set getAspects(int version, String path)
{
fLookupCount.set(1);
try
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
index e50e932a3d..15c71736f0 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
@@ -31,6 +31,7 @@ import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.DbAccessControlList;
@@ -1285,7 +1286,7 @@ public class AVMServiceImpl implements AVMService
* @param path The path to the node.
* @return A List of the QNames of the aspects.
*/
- public List getAspects(int version, String path)
+ public Set getAspects(int version, String path)
{
if (path == null)
{
@@ -1424,7 +1425,7 @@ public class AVMServiceImpl implements AVMService
// In either case copy properties, aspects, and acls.
Map props = getNodeProperties(version, desc.getPath());
setNodeProperties(newPath, props);
- List aspects = getAspects(version, desc.getPath());
+ Set aspects = getAspects(version, desc.getPath());
for (QName aspect : aspects)
{
addAspect(newPath, aspect);
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceTest.java b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
index 66b2f3f562..93f5b08917 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceTest.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
@@ -101,6 +101,105 @@ import org.alfresco.util.Pair;
*/
public class AVMServiceTest extends AVMServiceTestBase
{
+ /**
+ * Test properties.
+ */
+ public void testProperties()
+ {
+ try
+ {
+ setupBasicTree();
+
+ StoreRef storeRef = AVMNodeConverter.ToStoreRef("main");
+ SearchService searchService = fIndexerAndSearcher.getSearcher(storeRef, true);
+ ResultSet results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}SillyProperty")+":\"Silly\"");
+ assertEquals(0, results.length());
+ results.close();
+
+ QName name = QName.createQName("silly.uri", "SillyProperty");
+ PropertyValue value = new PropertyValue(name, "Silly Property Value");
+ fService.setNodeProperty("main:/a/b/c/foo", name, value);
+ fService.createSnapshot("main", null, null);
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}SillyProperty")+":\"Silly\"");
+ assertEquals(1, results.length());
+ results.close();
+ PropertyValue returned = fService.getNodeProperty(-1, "main:/a/b/c/foo", name);
+ assertEquals(value.toString(), returned.toString());
+ Map props = fService.getNodeProperties(-1, "main:/a/b/c/foo");
+ assertEquals(1, props.size());
+ assertEquals(value.toString(), props.get(name).toString());
+
+
+ props = new HashMap();
+ QName n1 = QName.createQName("silly.uri", "Prop1");
+ PropertyValue p1 = new PropertyValue(null, new Date(System.currentTimeMillis()));
+ props.put(n1, p1);
+ QName n2 = QName.createQName("silly.uri", "Prop2");
+ PropertyValue p2 = new PropertyValue(null, "A String Property.");
+ props.put(n2, p2);
+ QName n3 = QName.createQName("silly.uri", "Prop3");
+ PropertyValue p3 = new PropertyValue(null, 42);
+ props.put(n3, p3);
+ fService.setNodeProperties("main:/a/b/c/bar", props);
+ fService.createSnapshot("main", null, null);
+ props = fService.getNodeProperties(-1, "main:/a/b/c/bar");
+ assertEquals(3, props.size());
+ assertEquals(p1.toString(), props.get(n1).toString());
+ assertEquals(p2.toString(), props.get(n2).toString());
+ assertEquals(p3.toString(), props.get(n3).toString());
+
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + props.get(n1).getStringValue() +"\"");
+ assertEquals(1, results.length());
+ results.close();
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + props.get(n2).getStringValue() +"\"");
+ assertEquals(1, results.length());
+ results.close();
+
+ fService.deleteNodeProperty("main:/a/b/c/bar", n1);
+ fService.createSnapshot("main", null, null);
+
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + props.get(n1).getStringValue() +"\"");
+ assertEquals(0, results.length());
+ results.close();
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + props.get(n2).getStringValue() +"\"");
+ assertEquals(1, results.length());
+ results.close();
+
+ props = fService.getNodeProperties(-1, "main:/a/b/c/bar");
+ assertEquals(2, props.size());
+ assertEquals(p2.toString(), props.get(n2).toString());
+ assertEquals(p3.toString(), props.get(n3).toString());
+ fService.deleteNodeProperties("main:/a/b/c/bar");
+ fService.createSnapshot("main", null, null);
+
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + p1.getStringValue() +"\"");
+ assertEquals(0, results.length());
+ results.close();
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + props.get(n2).getStringValue() +"\"");
+ assertEquals(0, results.length());
+ results.close();
+
+ props = fService.getNodeProperties(-1, "main:/a/b/c/bar");
+ assertEquals(0, props.size());
+ fService.removeNode("main:/a/b/c/foo");
+ fService.setNodeProperty("main:/a/b/c/foo", QName.createQName("silly.uri", "Prop1"), new PropertyValue(
+ null, 42));
+ assertEquals(1, fService.getNodeProperties(-1, "main:/a/b/c/foo").size());
+ fService.createSnapshot("main", null, null);
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + p1.getStringValue() +"\"");
+ assertEquals(0, results.length());
+ results.close();
+ results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + p2.getStringValue() +"\"");
+ assertEquals(0, results.length());
+ results.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ fail();
+ }
+ }
+
/**
* Test getStoreVersionRootPaths().
*/
@@ -5029,103 +5128,6 @@ public class AVMServiceTest extends AVMServiceTestBase
}
}
- /**
- * Test properties.
- */
- public void testProperties()
- {
- try
- {
- setupBasicTree();
-
- StoreRef storeRef = AVMNodeConverter.ToStoreRef("main");
- SearchService searchService = fIndexerAndSearcher.getSearcher(storeRef, true);
- ResultSet results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}SillyProperty")+":\"Silly\"");
- assertEquals(0, results.length());
- results.close();
-
- QName name = QName.createQName("silly.uri", "SillyProperty");
- PropertyValue value = new PropertyValue(name, "Silly Property Value");
- fService.setNodeProperty("main:/a/b/c/foo", name, value);
- fService.createSnapshot("main", null, null);
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}SillyProperty")+":\"Silly\"");
- assertEquals(1, results.length());
- results.close();
- PropertyValue returned = fService.getNodeProperty(-1, "main:/a/b/c/foo", name);
- assertEquals(value.toString(), returned.toString());
- Map props = fService.getNodeProperties(-1, "main:/a/b/c/foo");
- assertEquals(1, props.size());
- assertEquals(value.toString(), props.get(name).toString());
-
-
- props = new HashMap();
- QName n1 = QName.createQName("silly.uri", "Prop1");
- PropertyValue p1 = new PropertyValue(null, new Date(System.currentTimeMillis()));
- props.put(n1, p1);
- QName n2 = QName.createQName("silly.uri", "Prop2");
- PropertyValue p2 = new PropertyValue(null, "A String Property.");
- props.put(n2, p2);
- QName n3 = QName.createQName("silly.uri", "Prop3");
- PropertyValue p3 = new PropertyValue(null, 42);
- props.put(n3, p3);
- fService.setNodeProperties("main:/a/b/c/bar", props);
- fService.createSnapshot("main", null, null);
- props = fService.getNodeProperties(-1, "main:/a/b/c/bar");
- assertEquals(3, props.size());
- assertEquals(p1.toString(), props.get(n1).toString());
- assertEquals(p2.toString(), props.get(n2).toString());
- assertEquals(p3.toString(), props.get(n3).toString());
-
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + props.get(n1).getStringValue() +"\"");
- assertEquals(1, results.length());
- results.close();
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + props.get(n2).getStringValue() +"\"");
- assertEquals(1, results.length());
- results.close();
-
- fService.deleteNodeProperty("main:/a/b/c/bar", n1);
- fService.createSnapshot("main", null, null);
-
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + props.get(n1).getStringValue() +"\"");
- assertEquals(0, results.length());
- results.close();
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + props.get(n2).getStringValue() +"\"");
- assertEquals(1, results.length());
- results.close();
-
- props = fService.getNodeProperties(-1, "main:/a/b/c/bar");
- assertEquals(2, props.size());
- assertEquals(p2.toString(), props.get(n2).toString());
- assertEquals(p3.toString(), props.get(n3).toString());
- fService.deleteNodeProperties("main:/a/b/c/bar");
- fService.createSnapshot("main", null, null);
-
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + props.get(n1).getStringValue() +"\"");
- assertEquals(0, results.length());
- results.close();
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + props.get(n2).getStringValue() +"\"");
- assertEquals(0, results.length());
- results.close();
-
- props = fService.getNodeProperties(-1, "main:/a/b/c/bar");
- assertEquals(0, props.size());
- fService.removeNode("main:/a/b/c/foo");
- fService.setNodeProperty("main:/a/b/c/foo", QName.createQName("silly.uri", "Prop1"), new PropertyValue(
- null, 42));
- assertEquals(1, fService.getNodeProperties(-1, "main:/a/b/c/foo").size());
- fService.createSnapshot("main", null, null);
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop1")+":\"" + props.get(n1).getStringValue() +"\"");
- assertEquals(0, results.length());
- results.close();
- results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}Prop2")+":\"" + props.get(n2).getStringValue() +"\"");
- assertEquals(0, results.length());
- results.close();
- }
- catch (Exception e)
- {
- e.printStackTrace(System.err);
- }
- }
/**
* Test properties on stores.
@@ -5197,7 +5199,7 @@ public class AVMServiceTest extends AVMServiceTestBase
fService.removeNode("main:/a/b/c/bar");
fService.addAspect("main:/a/b/c/bar", ContentModel.ASPECT_TITLED);
- List names = fService.getAspects(-1, "main:/a/b/c/foo");
+ Set names = fService.getAspects(-1, "main:/a/b/c/foo");
assertEquals(2, names.size());
assertTrue(fService.hasAspect(-1, "main:/a/b/c/foo", ContentModel.ASPECT_TITLED));
assertFalse(fService.hasAspect(-1, "main:/a/b/c/foo", ContentModel.ASPECT_AUTHOR));
diff --git a/source/java/org/alfresco/repo/avm/AVMStore.java b/source/java/org/alfresco/repo/avm/AVMStore.java
index eb743438e0..6609c41fb6 100644
--- a/source/java/org/alfresco/repo/avm/AVMStore.java
+++ b/source/java/org/alfresco/repo/avm/AVMStore.java
@@ -28,6 +28,7 @@ import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.DbAccessControlList;
@@ -422,7 +423,7 @@ public interface AVMStore
* @param path The path to the node.
* @return A List of the QNames of the aspects.
*/
- public List getAspects(int version, String path);
+ public Set getAspects(int version, String path);
/**
* Remove an aspect and all its properties from a node.
diff --git a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
index c8bac30337..f35bc74538 100644
--- a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
@@ -32,12 +32,12 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
-import org.alfresco.repo.avm.AVMAspectName;
import org.alfresco.repo.avm.util.RawServices;
import org.alfresco.repo.avm.util.SimplePath;
import org.alfresco.repo.domain.DbAccessControlList;
@@ -1289,16 +1289,8 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
- if (AVMDAOs.Instance().fAVMAspectNameDAO.exists(node, aspectName))
- {
- throw new AVMExistsException("Aspect exists.");
- }
- AVMAspectName newName =
- new AVMAspectNameImpl();
- newName.setNode(node);
- newName.setName(aspectName);
+ node.getAspects().add(aspectName);
node.setGuid(GUID.generate());
- AVMDAOs.Instance().fAVMAspectNameDAO.save(newName);
}
/**
@@ -1307,7 +1299,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
* @param path The path to the node.
* @return A List of the QNames of the aspects.
*/
- public List getAspects(int version, String path)
+ public Set getAspects(int version, String path)
{
Lookup lPath = lookup(version, path, false, true);
if (lPath == null)
@@ -1315,14 +1307,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
- List names =
- AVMDAOs.Instance().fAVMAspectNameDAO.get(node);
- ArrayList result = new ArrayList();
- for (AVMAspectName name : names)
- {
- result.add(name.getName());
- }
- return result;
+ return node.getAspects();
}
/**
@@ -1338,7 +1323,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
- AVMDAOs.Instance().fAVMAspectNameDAO.delete(node, aspectName);
+ node.getAspects().remove(aspectName);
AspectDefinition def = RawServices.Instance().getDictionaryService().getAspect(aspectName);
Map properties =
def.getProperties();
@@ -1364,7 +1349,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
- return AVMDAOs.Instance().fAVMAspectNameDAO.exists(node, aspectName);
+ return node.getAspects().contains(aspectName);
}
/**
@@ -1447,14 +1432,8 @@ public class AVMStoreImpl implements AVMStore, Serializable
dir.putChild(name, toLink);
toLink.changeAncestor(child);
toLink.setVersionID(child.getVersionID() + 1);
- if (AVMDAOs.Instance().fAVMAspectNameDAO.exists(toLink, WCMModel.ASPECT_REVERTED))
- {
- AVMDAOs.Instance().fAVMAspectNameDAO.delete(toLink, WCMModel.ASPECT_REVERTED);
- }
- AVMAspectName aspect = new AVMAspectNameImpl();
- aspect.setNode(toLink);
- aspect.setName(WCMModel.ASPECT_REVERTED);
- AVMDAOs.Instance().fAVMAspectNameDAO.save(aspect);
+ // TODO This really shouldn't be here. Leaking layers.
+ toLink.getAspects().add(WCMModel.ASPECT_REVERTED);
PropertyValue value = new PropertyValue(null, toRevertTo.getId());
toLink.setProperty(WCMModel.PROP_REVERTED_ID, value);
}
diff --git a/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java b/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java
index f1e8281f4e..e97498d33d 100644
--- a/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java
@@ -109,7 +109,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
getBasicAttributes(),
getContentData(lPath),
indirect.getProperties(),
- AVMDAOs.Instance().fAVMAspectNameDAO.get(indirect),
+ indirect.getAspects(),
indirect.getAcl(),
getVersionID());
newMe.setAncestor(this);
diff --git a/source/java/org/alfresco/repo/avm/OrphanReaper.java b/source/java/org/alfresco/repo/avm/OrphanReaper.java
index c457e15c2d..89d84050e0 100644
--- a/source/java/org/alfresco/repo/avm/OrphanReaper.java
+++ b/source/java/org/alfresco/repo/avm/OrphanReaper.java
@@ -308,7 +308,7 @@ public class OrphanReaper
// Get rid of all properties belonging to this node.
AVMDAOs.Instance().fAVMNodePropertyDAO.deleteAll(node);
// Get rid of all aspects belonging to this node.
- AVMDAOs.Instance().fAVMAspectNameDAO.delete(node);
+// AVMDAOs.Instance().fAVMAspectNameDAO.delete(node);
// Get rid of ACL.
DbAccessControlList acl = node.getAcl();
node.setAcl(null);
diff --git a/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java b/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
index d683e83772..bed9506c2c 100644
--- a/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
@@ -23,8 +23,10 @@
package org.alfresco.repo.avm;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.alfresco.repo.avm.util.RawServices;
import org.alfresco.repo.domain.DbAccessControlList;
@@ -117,7 +119,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
BasicAttributes attrs,
ContentData content,
Map props,
- List aspects,
+ Set aspects,
DbAccessControlList acl,
int versionID)
{
@@ -128,14 +130,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
AVMDAOs.Instance().fAVMNodeDAO.save(this);
AVMDAOs.Instance().fAVMNodeDAO.flush();
setProperties(props);
- for (AVMAspectName name : aspects)
- {
- AVMAspectName newName =
- new AVMAspectNameImpl();
- newName.setName(name.getName());
- newName.setNode(this);
- AVMDAOs.Instance().fAVMAspectNameDAO.save(newName);
- }
+ setAspects(new HashSet(aspects));
if (acl != null)
{
setAcl(acl.getCopy());
diff --git a/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml b/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml
index 21c75ba6b6..b65b8aaf7b 100644
--- a/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml
+++ b/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml
@@ -46,6 +46,11 @@
+
+
+
+
+
iterator()
+ {
+ Query query =
+ getSession().createQuery("from AVMAspectNameImpl aa");
+ return (Iterator)query.iterate();
+ }
}
diff --git a/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java b/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java
index 6c6908833f..d2bb76dd3b 100644
--- a/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java
+++ b/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java
@@ -31,6 +31,7 @@ import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.deployment.DeploymentReceiverService;
@@ -487,7 +488,7 @@ public class DeploymentServiceImpl implements DeploymentService
{
Map props = fAVMService.getNodeProperties(version, src.getPath());
remote.setNodeProperties(dst.getPath(), props);
- List aspects = fAVMService.getAspects(version, src.getPath());
+ Set aspects = fAVMService.getAspects(version, src.getPath());
for (QName aspect : aspects)
{
if (remote.hasAspect(-1, dst.getPath(), aspect))
diff --git a/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java b/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java
index 09e80a0511..1224bd29b9 100644
--- a/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java
+++ b/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java
@@ -8,6 +8,7 @@ import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.PropertyValue;
@@ -492,7 +493,7 @@ public class AVMRemoteImpl implements AVMRemote
/* (non-Javadoc)
* @see org.alfresco.service.cmr.remote.AVMRemote#getAspects(int, java.lang.String)
*/
- public List getAspects(int version, String path)
+ public Set getAspects(int version, String path)
{
return fTransport.getAspects(fTicketHolder.getTicket(), version, path);
}
diff --git a/source/java/org/alfresco/service/cmr/avm/AVMService.java b/source/java/org/alfresco/service/cmr/avm/AVMService.java
index 77cb3e656f..8cf0f512b9 100644
--- a/source/java/org/alfresco/service/cmr/avm/AVMService.java
+++ b/source/java/org/alfresco/service/cmr/avm/AVMService.java
@@ -28,6 +28,7 @@ import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.PropertyValue;
@@ -1131,10 +1132,10 @@ public interface AVMService
*
* @param version The version to look under.
* @param path The path to the node.
- * @return A List of the QNames of the aspects.
+ * @return A Set of the QNames of the aspects.
* @throws AVMNotFoundException
*/
- public List getAspects(int version, String path);
+ public Set getAspects(int version, String path);
/**
* Remove an aspect and its properties from a node.
diff --git a/source/java/org/alfresco/service/cmr/remote/AVMRemote.java b/source/java/org/alfresco/service/cmr/remote/AVMRemote.java
index 8eb9c1ba03..ffd86ac09d 100644
--- a/source/java/org/alfresco/service/cmr/remote/AVMRemote.java
+++ b/source/java/org/alfresco/service/cmr/remote/AVMRemote.java
@@ -28,6 +28,7 @@ import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.PropertyValue;
@@ -457,7 +458,7 @@ public interface AVMRemote
* @return A List of the QNames of the aspects.
* @throws AVMNotFoundException
*/
- public List getAspects(int version, String path);
+ public Set getAspects(int version, String path);
/**
* Remove an aspect and its properties from a node.
diff --git a/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java b/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java
index 2d95559861..96e23a774b 100644
--- a/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java
+++ b/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java
@@ -6,6 +6,7 @@ package org.alfresco.service.cmr.remote;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.PropertyValue;
@@ -471,7 +472,7 @@ public interface AVMRemoteTransport
* @return A List of the QNames of the aspects.
* @throws AVMNotFoundException
*/
- public List getAspects(String ticket, int version, String path);
+ public Set getAspects(String ticket, int version, String path);
/**
* Remove an aspect and its properties from a node.