Merged V3.0 to HEAD

11509: ETHREEOH-394: Incorrect message in activity feed when user accepts an invitation to a site
   11510: Fix to set position
   11511: Fix for ETHREEOH-533: Dialogs access via ExternalAccessServlet return to blank empty container.jsp page when Close button is clicked
   11512: Fix DM ACL deletion after merge forward for shared and defining ACLs.
   11513: Merged V2.2 to V3.0
      11501: Expose if set permissions are inherited or not and fix relatd behaviour for import/copy
   11514: Fix for ETHREEOH-476 (Impossible to create Site Invite Workflow) & ETHREEOH-254 (Default value at 'Start Advanced Workflow Wizard' page)
   11515: Fix for ETHREEOH-446 and ETHREEOH-447
   11517: Fix for ETHREEOH-225: Web Forms with repeating elements don't work
   11518: Merged V2.2 to V3.0
      11343: ACL upgrades may require a COW - it now warns when this happens.
      11369: Always lock against staging - ETWOTWO-763
   11519: Merged V2.2 to V3.0
      11467: Fixed ETWOTWO-774: CreateVersionTxnListener.afterCommit() throws NPE
      11468: More defensive coding on AVM txn listeners (avoid NPEs)
      11475: More defensive checks to avoid NPE
   11520: Merged V2.2 to V3.0
      11478: Keep creator and owner as orihinally set in AVM - Fix for ETWOTWO-604
   11521: RuntimeExec: Added optional directive SPLIT: to force argument tokenization
   11522: Limited tests to just check the command format not execute it for "dir . .."
   11523: Undid revision 11520 (Merged V2.2 11478)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12449 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-12-17 14:24:08 +00:00
parent 46483f1c54
commit 918e91fcfc
16 changed files with 340 additions and 93 deletions

View File

@@ -106,10 +106,14 @@ import org.alfresco.util.GUID;
import org.alfresco.util.Pair;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
@@ -1446,7 +1450,34 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
node.setAccessControlList(null);
if(dbAcl != null)
{
getHibernateTemplate().delete(dbAcl);
if(dbAcl.getAclType() == ACLType.DEFINING)
{
getHibernateTemplate().delete(dbAcl);
}
if(dbAcl.getAclType() == ACLType.SHARED)
{
// check unused
Long defining = dbAcl.getInheritsFrom();
if(getHibernateTemplate().get(DbAccessControlListImpl.class, defining) == null)
{
final Long id = dbAcl.getId();
HibernateCallback check = new HibernateCallback()
{
public Object doInHibernate(Session session)
{
Criteria criteria = getSession().createCriteria(NodeImpl.class, "n");
criteria.add(Restrictions.eq("n.accessControlList.id", id));
criteria.setProjection(Projections.rowCount());
return criteria.list();
}
};
List<Integer> list = (List<Integer>)getHibernateTemplate().execute(check);
if(list.get(0).intValue() == 0)
{
getHibernateTemplate().delete(dbAcl);
}
}
}
}
// Mark the node as deleted