mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Another pair of convenience methods for AttributeService:
removeEntries, which removes map entries by query. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5806 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -420,6 +420,44 @@ public class AttributeServiceImpl implements AttributeService
|
||||
removeAttribute(keys, index);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.attributes.AttributeService#removeEntries(java.util.List, org.alfresco.service.cmr.attributes.AttrQuery)
|
||||
*/
|
||||
public void removeEntries(List<String> keys, AttrQuery query)
|
||||
{
|
||||
if (keys == null || query == null)
|
||||
{
|
||||
throw new AVMBadArgumentException("Illegal null argument.");
|
||||
}
|
||||
if (keys.size() == 0)
|
||||
{
|
||||
throw new AVMBadArgumentException("Illegal zero length key path.");
|
||||
}
|
||||
Attribute map = getAttributeFromPath(keys);
|
||||
if (map == null)
|
||||
{
|
||||
throw new AVMNotFoundException("Could not find attribute: " + keys);
|
||||
}
|
||||
if (map.getType() != Attribute.Type.MAP)
|
||||
{
|
||||
throw new AVMWrongTypeException("Not a map: " + keys);
|
||||
}
|
||||
fAttributeDAO.delete((MapAttribute)map, query);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.attributes.AttributeService#removeEntries(java.lang.String, org.alfresco.service.cmr.attributes.AttrQuery)
|
||||
*/
|
||||
public void removeEntries(String path, AttrQuery query)
|
||||
{
|
||||
if (path == null || query == null)
|
||||
{
|
||||
throw new AVMBadArgumentException("Illegal null argument.");
|
||||
}
|
||||
List<String> keys = parsePath(path);
|
||||
removeEntries(keys, query);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.attributes.AttributeService#setAttribute(java.util.List, int, org.alfresco.repo.attributes.Attribute)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user