mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-09 17:45:10 +00:00
Added deleteProperty to service interface.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3375 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
2e3e8f4ad2
commit
f15c1b4cc6
@ -160,4 +160,10 @@ public interface AVMNode
|
||||
* @return A Map of QNames to PropertyValues.
|
||||
*/
|
||||
public Map<QName, PropertyValue> getProperties();
|
||||
|
||||
/**
|
||||
* Delete a property from this node.
|
||||
* @param name The name of the property.
|
||||
*/
|
||||
public void deleteProperty(QName name);
|
||||
}
|
@ -347,4 +347,13 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a property from this node.
|
||||
* @param name The name of the property.
|
||||
*/
|
||||
public void deleteProperty(QName name)
|
||||
{
|
||||
AVMContext.fgInstance.fAVMNodePropertyDAO.delete(this, name);
|
||||
}
|
||||
}
|
||||
|
@ -59,4 +59,11 @@ public interface AVMNodePropertyDAO
|
||||
* @param node The AVMNode whose properties should be deleted.
|
||||
*/
|
||||
public void deleteAll(AVMNode node);
|
||||
|
||||
/**
|
||||
* Delete the given property from the given node.
|
||||
* @param node The node to delete the property to delete.
|
||||
* @param name The name of the property to delete.
|
||||
*/
|
||||
public void delete(AVMNode node, QName name);
|
||||
}
|
||||
|
@ -921,6 +921,19 @@ class AVMRepository
|
||||
return store.getProperties(version, pathParts[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a single property from a node.
|
||||
* @param path The path to the node.
|
||||
* @param name The name of the property.
|
||||
*/
|
||||
public void deleteProperty(String path, QName name)
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], true);
|
||||
store.deleteProperty(pathParts[1], name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AVMStoreDescriptor for an AVMStore.
|
||||
* @param name The name of the AVMStore.
|
||||
|
@ -342,4 +342,11 @@ public interface AVMService
|
||||
* @return A Map of QNames to PropertyValues.
|
||||
*/
|
||||
public Map<QName, PropertyValue> getProperties(int version, String path);
|
||||
|
||||
/**
|
||||
* Delete a property.
|
||||
* @param path The path to the node.
|
||||
* @param name The QName of the property to delete.
|
||||
*/
|
||||
public void deleteProperty(String path, QName name);
|
||||
}
|
||||
|
@ -1128,4 +1128,26 @@ public class AVMServiceImpl implements AVMService
|
||||
fTransaction.perform(doit, false);
|
||||
return doit.properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a property.
|
||||
* @param path The path to the node.
|
||||
* @param name The QName of the property to delete.
|
||||
*/
|
||||
public void deleteProperty(final String path, final QName name)
|
||||
{
|
||||
if (path == null || name == null)
|
||||
{
|
||||
throw new AVMBadArgumentException("Illegal null argument.");
|
||||
}
|
||||
class TxnCallback implements RetryingTransactionCallback
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fAVMRepository.deleteProperty(path, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
fTransaction.perform(doit, true);
|
||||
}
|
||||
}
|
||||
|
@ -2052,9 +2052,16 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
fService.setProperties("main:/a/b/c/bar", props);
|
||||
fService.createSnapshot("main");
|
||||
props = fService.getProperties(-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());
|
||||
fService.deleteProperty("main:/a/b/c/bar", n1);
|
||||
fService.createSnapshot("main");
|
||||
props = fService.getProperties(-1, "main:/a/b/c/bar");
|
||||
assertEquals(2, props.size());
|
||||
assertEquals(p2.toString(), props.get(n2).toString());
|
||||
assertEquals(p3.toString(), props.get(n3).toString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -292,6 +292,13 @@ public interface AVMStore
|
||||
*/
|
||||
public PropertyValue getProperty(int version, String path, QName name);
|
||||
|
||||
/**
|
||||
* Delete a single property from a node.
|
||||
* @param path The path to the node.
|
||||
* @param name The name of the property.
|
||||
*/
|
||||
public void deleteProperty(String path, QName name);
|
||||
|
||||
/**
|
||||
* Get all the properties associated with a node.
|
||||
* @param version The version to look under.
|
||||
|
@ -878,4 +878,16 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
AVMNode node = lPath.getCurrentNode();
|
||||
return node.getProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a single property from a node.
|
||||
* @param path The path to the node.
|
||||
* @param name The name of the property.
|
||||
*/
|
||||
public void deleteProperty(String path, QName name)
|
||||
{
|
||||
Lookup lPath = lookup(-1, path, true);
|
||||
AVMNode node = lPath.getCurrentNode();
|
||||
node.deleteProperty(name);
|
||||
}
|
||||
}
|
||||
|
@ -80,4 +80,19 @@ public class AVMNodePropertyDAOHibernate extends HibernateDaoSupport
|
||||
delete.setEntity("node", node);
|
||||
delete.executeUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given property from the given node.
|
||||
* @param node The node to delete the property to delete.
|
||||
* @param name The name of the property to delete.
|
||||
*/
|
||||
public void delete(AVMNode node, QName name)
|
||||
{
|
||||
Query delete =
|
||||
getSession().createQuery("delete from AVMNodePropertyImpl anp where anp.node = :node " +
|
||||
"and name = :name");
|
||||
delete.setEntity("node", node);
|
||||
delete.setParameter("name", name);
|
||||
delete.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user