diff --git a/source/java/org/alfresco/repo/attributes/AttributeServiceTest.java b/source/java/org/alfresco/repo/attributes/AttributeServiceTest.java index e5d4e3fb85..1db703836a 100644 --- a/source/java/org/alfresco/repo/attributes/AttributeServiceTest.java +++ b/source/java/org/alfresco/repo/attributes/AttributeServiceTest.java @@ -227,4 +227,53 @@ public class AttributeServiceTest extends TestCase fail(); } } + + public void testDelete() + { + try + { + // Put some attributes in place. + MapAttribute map = new MapAttributeValue(); + map.put("a", new StringAttributeValue("a")); + map.put("b", new StringAttributeValue("b")); + map.put("c", new StringAttributeValue("c")); + map.put("d", new StringAttributeValue("d")); + map.put("e", new StringAttributeValue("e")); + map.put("f", new StringAttributeValue("f")); + map.put("g", new StringAttributeValue("g")); + map.put("h", new StringAttributeValue("h")); + map.put("i", new StringAttributeValue("i")); + map.put("j", new StringAttributeValue("j")); + map.put("k", new StringAttributeValue("k")); + map.put("l", new StringAttributeValue("l")); + map.put("m", new StringAttributeValue("m")); + map.put("n", new StringAttributeValue("n")); + map.put("o", new StringAttributeValue("o")); + map.put("p", new StringAttributeValue("p")); + map.put("q", new StringAttributeValue("q")); + map.put("r", new StringAttributeValue("r")); + map.put("s", new StringAttributeValue("s")); + map.put("t", new StringAttributeValue("t")); + map.put("u", new StringAttributeValue("u")); + map.put("v", new StringAttributeValue("v")); + map.put("w", new StringAttributeValue("w")); + map.put("x", new StringAttributeValue("x")); + map.put("y", new StringAttributeValue("y")); + map.put("z", new StringAttributeValue("z")); + fService.setAttribute("", "map", map); + fService.setAttribute("map", "submap", map); + fService.setAttribute("map/submap", "subsubmap", map); + assertEquals(27, fService.getKeys("map").size()); + assertEquals(27, fService.getKeys("map/submap").size()); + fService.removeAttribute("map/submap/subsubmap", "b"); + assertEquals(25, fService.getKeys("map/submap/subsubmap").size()); + fService.removeAttribute("map/submap", "subsubmap"); + assertEquals(26, fService.getKeys("map/submap").size()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } diff --git a/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java b/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java index 9ed286e206..22f6297ae3 100644 --- a/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java +++ b/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java @@ -28,6 +28,7 @@ import java.util.Collection; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.action.ActionService; +import org.alfresco.service.cmr.attributes.AttributeService; import org.alfresco.service.cmr.audit.AuditService; import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avmsync.AVMSyncService; @@ -352,4 +353,12 @@ public class ServiceDescriptorRegistry { return (CrossRepositoryCopyService)getService(CROSS_REPO_COPY_SERVICE); } + + /* (non-Javadoc) + * @see org.alfresco.service.ServiceRegistry#getAttributeService() + */ + public AttributeService getAttributeService() + { + return (AttributeService)getService(ATTRIBUTE_SERVICE); + } } diff --git a/source/java/org/alfresco/service/ServiceRegistry.java b/source/java/org/alfresco/service/ServiceRegistry.java index 3909941605..da499a8649 100644 --- a/source/java/org/alfresco/service/ServiceRegistry.java +++ b/source/java/org/alfresco/service/ServiceRegistry.java @@ -27,6 +27,7 @@ package org.alfresco.service; import java.util.Collection; import org.alfresco.service.cmr.action.ActionService; +import org.alfresco.service.cmr.attributes.AttributeService; import org.alfresco.service.cmr.audit.AuditService; import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avmsync.AVMSyncService; @@ -104,6 +105,7 @@ public interface ServiceRegistry static final QName AVM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMService"); static final QName AVM_SYNC_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMSyncService"); static final QName CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService"); + static final QName ATTRIBUTE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AttributeService"); /** * Get the list of services provided by the Repository @@ -315,4 +317,11 @@ public interface ServiceRegistry */ @NotAuditable CrossRepositoryCopyService getCrossRepositoryCopyService(); + + /** + * Get the attribute service (or null if one is not provided) + * @return + */ + @NotAuditable + AttributeService getAttributeService(); }