mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8405: Added causal exception to the runtime generated 8408: AR-2136, AR-2137, AR-2138 8410: WCM-1110, WCM-1111 8417: Stopped chiba:match() function from being inserted into bindings for xforms model elements of type xs:integer. 8419: Fixes for correct use of .empty in name spaces of QNames 8420: Finally fixes WCM-1108 and WCM-1109 8489: Merged V2.1 to V2.2 8482: Fix For AR-2163 8507: Merged V2.1 to V2.2 8504: Fix for AR-2165 - respect repo read only setting during authentication git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8508 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -53,6 +53,7 @@ import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||
import org.alfresco.service.cmr.repository.InvalidStoreRefException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.alfresco.util.Pair;
|
||||
|
||||
/**
|
||||
@@ -232,6 +233,9 @@ public class AVMAccessControlListDAO implements AccessControlListDAO
|
||||
|
||||
public void updateChangedAcls(NodeRef startingPoint, List<AclChange> changes)
|
||||
{
|
||||
// If their are no actual changes there is nothing to do (the changes are all in TX and have already COWed so they can just change)
|
||||
|
||||
boolean hasChanges = false;
|
||||
Long after = null;
|
||||
for (AclChange change : changes)
|
||||
{
|
||||
@@ -243,7 +247,22 @@ public class AVMAccessControlListDAO implements AccessControlListDAO
|
||||
{
|
||||
after = change.getAfter();
|
||||
}
|
||||
|
||||
if(!EqualsHelper.nullSafeEquals(change.getTypeBefore(), change.getTypeAfter()))
|
||||
{
|
||||
hasChanges = true;
|
||||
}
|
||||
if(!EqualsHelper.nullSafeEquals(change.getBefore(), change.getAfter()))
|
||||
{
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!hasChanges)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Long inherited = null;
|
||||
if (after != null)
|
||||
{
|
||||
@@ -253,6 +272,8 @@ public class AVMAccessControlListDAO implements AccessControlListDAO
|
||||
updateChangedAclsImpl(startingPoint, changes, SetMode.ALL, inherited, after, indirections);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updateChangedAclsImpl(NodeRef startingPoint, List<AclChange> changes, SetMode mode, Long inherited, Long setAcl, Map<Long, Set<Long>> indirections)
|
||||
{
|
||||
hibernateSessionHelper.mark();
|
||||
|
@@ -101,6 +101,8 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
|
||||
static String QUERY_GET_LAYERED_DIRECTORIES = "permission.GetLayeredDirectories";
|
||||
|
||||
static String QUERY_GET_LAYERED_FILES = "permission.GetLayeredFiles";
|
||||
|
||||
static String QUERY_GET_NEW_IN_STORE = "permission.GetNewInStore";
|
||||
|
||||
/** Access to QName entities */
|
||||
private QNameDAO qnameDAO;
|
||||
@@ -1825,14 +1827,22 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
|
||||
try
|
||||
{
|
||||
Session session = getSession();
|
||||
session.connection().setTransactionIsolation(1);
|
||||
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCount");
|
||||
Long answer = (Long) query.uniqueResult();
|
||||
return answer;
|
||||
int isolationLevel = session.connection().getTransactionIsolation();
|
||||
try
|
||||
{
|
||||
session.connection().setTransactionIsolation(1);
|
||||
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCount");
|
||||
Long answer = (Long) query.uniqueResult();
|
||||
return answer;
|
||||
}
|
||||
finally
|
||||
{
|
||||
session.connection().setTransactionIsolation(isolationLevel);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to set TX isolation level");
|
||||
throw new AlfrescoRuntimeException("Failed to set TX isolation level", e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1842,33 +1852,77 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
|
||||
try
|
||||
{
|
||||
Session session = getSession();
|
||||
session.connection().setTransactionIsolation(1);
|
||||
Query query = getSession().getNamedQuery("permission.GetMaxAclId");
|
||||
Long answer = (Long) query.uniqueResult();
|
||||
return answer;
|
||||
int isolationLevel = session.connection().getTransactionIsolation();
|
||||
try
|
||||
{
|
||||
session.connection().setTransactionIsolation(1);
|
||||
Query query = getSession().getNamedQuery("permission.GetMaxAclId");
|
||||
Long answer = (Long) query.uniqueResult();
|
||||
return answer;
|
||||
}
|
||||
finally
|
||||
{
|
||||
session.connection().setTransactionIsolation(isolationLevel);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to set TX isolation level");
|
||||
throw new AlfrescoRuntimeException("Failed to set TX isolation level", e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean supportsProgressTracking()
|
||||
{
|
||||
try
|
||||
{
|
||||
Session session = getSession();
|
||||
return session.connection().getMetaData().supportsTransactionIsolationLevel(1);
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Long getAVMNodeCountWithNewACLS(Long above)
|
||||
{
|
||||
try
|
||||
{
|
||||
Session session = getSession();
|
||||
session.connection().setTransactionIsolation(1);
|
||||
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCountWherePermissionsHaveChanged");
|
||||
query.setParameter("above", above);
|
||||
Long answer = (Long) query.uniqueResult();
|
||||
return answer;
|
||||
int isolationLevel = session.connection().getTransactionIsolation();
|
||||
try
|
||||
{
|
||||
session.connection().setTransactionIsolation(1);
|
||||
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCountWherePermissionsHaveChanged");
|
||||
query.setParameter("above", above);
|
||||
Long answer = (Long) query.uniqueResult();
|
||||
return answer;
|
||||
}
|
||||
finally
|
||||
{
|
||||
session.connection().setTransactionIsolation(isolationLevel);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to set TX isolation level");
|
||||
throw new AlfrescoRuntimeException("Failed to set TX isolation level", e);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getNewInStore()
|
||||
{
|
||||
HibernateCallback callback = new HibernateCallback()
|
||||
{
|
||||
public Object doInHibernate(Session session)
|
||||
{
|
||||
Query query = session.getNamedQuery(QUERY_GET_NEW_IN_STORE);
|
||||
return query.uniqueResult();
|
||||
}
|
||||
};
|
||||
Long count = (Long) getHibernateTemplate().execute(callback);
|
||||
return count;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Indirection> getLayeredDirectories()
|
||||
@@ -1883,16 +1937,16 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
|
||||
};
|
||||
List<Object[]> results = (List<Object[]>) getHibernateTemplate().execute(callback);
|
||||
ArrayList<Indirection> indirections = new ArrayList<Indirection>(results.size());
|
||||
for(Object[] row : results)
|
||||
for (Object[] row : results)
|
||||
{
|
||||
Long from = (Long)row[0];
|
||||
Long from = (Long) row[0];
|
||||
String to = (String) row[1];
|
||||
Integer version = (Integer) row[2];
|
||||
indirections.add(new Indirection(from, to, version));
|
||||
}
|
||||
return indirections;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Indirection> getLayeredFiles()
|
||||
{
|
||||
@@ -1906,16 +1960,16 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
|
||||
};
|
||||
List<Object[]> results = (List<Object[]>) getHibernateTemplate().execute(callback);
|
||||
ArrayList<Indirection> indirections = new ArrayList<Indirection>(results.size());
|
||||
for(Object[] row : results)
|
||||
for (Object[] row : results)
|
||||
{
|
||||
Long from = (Long)row[0];
|
||||
Long from = (Long) row[0];
|
||||
String to = (String) row[1];
|
||||
Integer version = (Integer) row[2];
|
||||
indirections.add(new Indirection(from, to, version));
|
||||
}
|
||||
return indirections;
|
||||
}
|
||||
|
||||
|
||||
public List<Indirection> getAvmIndirections()
|
||||
{
|
||||
List<Indirection> dirList = getLayeredDirectories();
|
||||
@@ -1936,7 +1990,7 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
|
||||
Long from;
|
||||
|
||||
String to;
|
||||
|
||||
|
||||
Integer toVersion;
|
||||
|
||||
Indirection(Long from, String to, Integer toVersion)
|
||||
@@ -1960,8 +2014,6 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
|
||||
{
|
||||
return toVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6781559184013949845L;
|
||||
|
||||
protected static final String EMPTY_URI_SUBSTITUTE = ".empty";
|
||||
public static final String EMPTY_URI_SUBSTITUTE = ".empty";
|
||||
|
||||
private Long id;
|
||||
private Long version;
|
||||
|
@@ -424,6 +424,14 @@
|
||||
]]>
|
||||
</query>
|
||||
|
||||
<query name="permission.GetNewInStore">
|
||||
<![CDATA[
|
||||
select count(*)
|
||||
from org.alfresco.repo.avm.AVMNodeImpl node
|
||||
where storeNew is not null
|
||||
]]>
|
||||
</query>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
|
@@ -84,6 +84,10 @@ public class QNameEntityImpl implements QNameEntity, Serializable
|
||||
if (qname == null )
|
||||
{
|
||||
String namespaceUri = namespace.getUri();
|
||||
if (namespaceUri.equals(NamespaceEntityImpl.EMPTY_URI_SUBSTITUTE))
|
||||
{
|
||||
namespaceUri = "";
|
||||
}
|
||||
qname = QName.createQName(namespaceUri, localName);
|
||||
}
|
||||
return qname;
|
||||
|
Reference in New Issue
Block a user