Added method to delete multiple child contexts for unique property contexts

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16441 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-22 15:17:45 +00:00
parent 1935a73684
commit a48ac3deca
7 changed files with 113 additions and 32 deletions

View File

@@ -1147,10 +1147,40 @@ public abstract class AbstractPropertyValueDAOImpl implements PropertyValueDAO
}
}
public int deletePropertyUniqueContext(Serializable... values)
{
if (values.length < 1 || values.length > 3)
{
throw new IllegalArgumentException("Deletion of unique property sets must have 1, 2 or 3 values");
}
Long[] valueIds = new Long[values.length];
for (int i = 0; i < values.length; i++)
{
Pair<Long, Serializable> valuePair = getPropertyValue(values[i]);
if (valuePair == null)
{
// No such value, so no need to delete
return 0;
}
valueIds[i] = valuePair.getFirst();
}
int deleted = deletePropertyUniqueContexts(valueIds);
// Done
if (logger.isDebugEnabled())
{
logger.debug(
"Deleted " + deleted + " unique property contexts: \n" +
" Values: " + values + "\n" +
" IDs: " + valueIds);
}
return deleted;
}
protected abstract PropertyUniqueContextEntity createPropertyUniqueContext(Long valueId1, Long valueId2, Long valueId3);
protected abstract PropertyUniqueContextEntity getPropertyUniqueContextById(Long id);
protected abstract PropertyUniqueContextEntity getPropertyUniqueContextByValues(Long valueId1, Long valueId2, Long valueId3);
protected abstract PropertyUniqueContextEntity updatePropertyUniqueContext(PropertyUniqueContextEntity entity);
protected abstract int deletePropertyUniqueContexts(Long ... valueIds);
//================================
// Utility methods