mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged V3.0 to HEAD
11301: Merged V2.2 to V3.0 11296: Externalised the Hibernate sql-query 11297: Fixed ETWOTWO-603: NPE check getting ACLs 11298: ETWOTWO-594: Tidy up input stream closure 11299: Minor javadoc change git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12409 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -197,25 +197,38 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
||||
|
||||
private Document createDocument()
|
||||
{
|
||||
InputStream is = auditConfiguration.getInputStream();
|
||||
if (is == null)
|
||||
{
|
||||
throw new AuditModelException("Audit configuration could not be opened");
|
||||
}
|
||||
SAXReader reader = new SAXReader();
|
||||
InputStream is = null;
|
||||
try
|
||||
{
|
||||
Document document = reader.read(is);
|
||||
is.close();
|
||||
return document;
|
||||
is = auditConfiguration.getInputStream();
|
||||
if (is == null)
|
||||
{
|
||||
throw new AuditModelException("Audit configuration could not be opened");
|
||||
}
|
||||
SAXReader reader = new SAXReader();
|
||||
try
|
||||
{
|
||||
Document document = reader.read(is);
|
||||
return document;
|
||||
}
|
||||
catch (DocumentException e)
|
||||
{
|
||||
throw new AuditModelException("Failed to create audit model document ", e);
|
||||
}
|
||||
}
|
||||
catch (DocumentException e)
|
||||
finally
|
||||
{
|
||||
throw new AuditModelException("Failed to create audit model document ", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AuditModelException("Failed to close audit model document ", e);
|
||||
if (is != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AuditModelException("Failed to close audit model document ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -365,7 +365,16 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
|
||||
DbAccessControlList acl = null;
|
||||
try
|
||||
{
|
||||
acl = getACLDAO(nodeRef).getAccessControlList(nodeRef);
|
||||
AccessControlListDAO aclDAO = getACLDAO(nodeRef);
|
||||
if (aclDAO == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
acl = aclDAO.getAccessControlList(nodeRef);
|
||||
if (acl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (InvalidNodeRefException e)
|
||||
{
|
||||
@@ -402,7 +411,16 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
|
||||
DbAccessControlList acl = null;
|
||||
try
|
||||
{
|
||||
acl = getACLDAO(nodeRef).getAccessControlList(nodeRef);
|
||||
AccessControlListDAO aclDAO = getACLDAO(nodeRef);
|
||||
if (aclDAO == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
acl = aclDAO.getAccessControlList(nodeRef);
|
||||
if (acl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (InvalidNodeRefException e)
|
||||
{
|
||||
|
@@ -444,7 +444,6 @@
|
||||
]]>
|
||||
</query>
|
||||
|
||||
|
||||
<query name="permission.GetDmNodeCount">
|
||||
<![CDATA[
|
||||
select count(*)
|
||||
@@ -460,17 +459,39 @@
|
||||
]]>
|
||||
</query>
|
||||
|
||||
<sql-query name="person.getAllPeople">
|
||||
<sql-query name="person.getPerson">
|
||||
<return alias="n" class="org.alfresco.repo.domain.hibernate.NodeImpl"/>
|
||||
SELECT
|
||||
{n.*}
|
||||
FROM
|
||||
alf_node n
|
||||
JOIN alf_node_properties p ON n.id = p.node_id
|
||||
JOIN alf_child_assoc c on c.child_node_id = n.id
|
||||
JOIN alf_store s on s.id = n.store_id
|
||||
WHERE
|
||||
c.qname_localname = :userName1 AND
|
||||
p.qname_id = :qnameId AND
|
||||
n.node_deleted = :False"
|
||||
p.string_value = :userName2 AND
|
||||
n.node_deleted = :False AND
|
||||
s.protocol = :storeProtocol AND
|
||||
s.identifier = :storeIdentifier
|
||||
</sql-query>
|
||||
|
||||
|
||||
<sql-query name="person.getAllPeople">
|
||||
<return alias="n" class="org.alfresco.repo.domain.hibernate.NodeImpl"/>
|
||||
SELECT
|
||||
{n.*}
|
||||
FROM
|
||||
alf_node n
|
||||
JOIN alf_node_properties p ON n.id = p.node_id
|
||||
JOIN alf_store s on s.id = n.store_id
|
||||
WHERE
|
||||
p.qname_id = :qnameId AND
|
||||
n.node_deleted = :False AND
|
||||
s.protocol = :storeProtocol AND
|
||||
s.identifier = :storeIdentifier
|
||||
</sql-query>
|
||||
|
||||
<!--
|
||||
|
||||
<query name="permission.GetAccessControlEntriesForAuthority">
|
||||
|
@@ -494,6 +494,9 @@ public class ADMLuceneTest extends TestCase
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not required to run all the time; it's here for profiling.
|
||||
*/
|
||||
public void restManyReaders() throws Exception
|
||||
{
|
||||
QName propQName = QName.createQName(TEST_NAMESPACE, "text-indexed-stored-tokenised-atomic");
|
||||
|
@@ -52,9 +52,8 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
|
||||
{
|
||||
private static final String PERSON_GET_PERSON = "person.getPerson";
|
||||
|
||||
private static final String PERSON_GET_ALL_PEOPLE = "person.getAllPeople";
|
||||
private static final String QUERY_PERSON_GET_PERSON = "person.getPerson";
|
||||
private static final String QUERY_PERSON_GET_ALL_PEOPLE = "person.getAllPeople";
|
||||
|
||||
private QNameDAO qnameDAO;
|
||||
|
||||
@@ -89,8 +88,7 @@ public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
|
||||
{
|
||||
public Object doInHibernate(Session session)
|
||||
{
|
||||
SQLQuery query = getSession().createSQLQuery("SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON n.id = p.node_id JOIN alf_child_assoc c on c.child_node_id = n.id JOIN alf_store s on s.id = n.store_id WHERE c.qname_localname = :userName1 AND p.qname_id = :qnameId AND p.string_value = :userName2 and n.node_deleted = :False and s.protocol = :storeProtocol and s.identifier = :storeIdentifier");
|
||||
query.addEntity("n", NodeImpl.class);
|
||||
SQLQuery query = (SQLQuery) session.getNamedQuery(QUERY_PERSON_GET_PERSON);
|
||||
query.setParameter("qnameId", qNameId);
|
||||
query.setParameter("userName1", searchUserName);
|
||||
query.setParameter("userName2", searchUserName);
|
||||
@@ -150,8 +148,7 @@ public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
|
||||
{
|
||||
public Object doInHibernate(Session session)
|
||||
{
|
||||
SQLQuery query = getSession().createSQLQuery("SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON n.id = p.node_id JOIN alf_store s on s.id = n.store_id WHERE p.qname_id = :qnameId and n.node_deleted = :False and s.protocol = :storeProtocol and s.identifier = :storeIdentifier");
|
||||
query.addEntity("n", NodeImpl.class);
|
||||
SQLQuery query = (SQLQuery) session.getNamedQuery(QUERY_PERSON_GET_ALL_PEOPLE);
|
||||
query.setParameter("qnameId", qNameId);
|
||||
query.setParameter("False", Boolean.FALSE);
|
||||
query.setParameter("storeProtocol", personStoreRef.getProtocol());
|
||||
|
Reference in New Issue
Block a user