mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
7575: Permission changes for AVM. 7577: Incorporated most of the feedback provided by Kevin C earlier today 7578: Removed directory not removed by patch 7579: EmailServer bug fixes AR-1902: Double posts when emailing to a document AR-1904: Attachments via email should be allowed on forum posts AR-1903: (Partial Fix) Text attachments should be treated the same way as other attachments 7583: Fixed WCM-961 & WCM-962: Added confirm dialog for 'Delete All Deployment Reports' and 'Release Server' actions git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8434 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,49 +41,47 @@ import org.hibernate.Session;
|
||||
*
|
||||
* @author andyh
|
||||
*/
|
||||
public class DbPermissionImpl extends LifecycleAdapter
|
||||
implements DbPermission, Serializable
|
||||
{
|
||||
public class DbPermissionImpl implements DbPermission, Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6352566900815035461L;
|
||||
|
||||
|
||||
private static Log logger = LogFactory.getLog(DbPermissionImpl.class);
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long version;
|
||||
|
||||
private QName typeQname;
|
||||
|
||||
private String name;
|
||||
|
||||
public DbPermissionImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
sb.append("PermissionImpl")
|
||||
.append("[ id=").append(id)
|
||||
.append(", typeQname=").append(typeQname)
|
||||
.append(", name=").append(getName())
|
||||
.append("]");
|
||||
sb.append("DbPermissionImpl").append("[ id=").append(id).append(", version=").append(version).append(", typeQname=").append(typeQname).append(", name=").append(getName())
|
||||
.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if(this == o)
|
||||
if (this == o)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(!(o instanceof DbPermission))
|
||||
if (!(o instanceof DbPermission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DbPermission other = (DbPermission)o;
|
||||
return (EqualsHelper.nullSafeEquals(typeQname, other.getTypeQname()))
|
||||
&& (EqualsHelper.nullSafeEquals(name, other.getName()));
|
||||
DbPermission other = (DbPermission) o;
|
||||
return (EqualsHelper.nullSafeEquals(typeQname, other.getTypeQname())) && (EqualsHelper.nullSafeEquals(name, other.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,35 +89,6 @@ public class DbPermissionImpl extends LifecycleAdapter
|
||||
{
|
||||
return typeQname.hashCode() + (37 * name.hashCode());
|
||||
}
|
||||
|
||||
public int deleteEntries()
|
||||
{
|
||||
/*
|
||||
* This can use a delete direct to the database as well, but then care must be taken
|
||||
* to evict the instances from the session.
|
||||
*/
|
||||
|
||||
// bypass L2 cache and get all entries for this list
|
||||
Query query = getSession()
|
||||
.getNamedQuery(PermissionsDaoComponentImpl.QUERY_GET_AC_ENTRIES_FOR_PERMISSION)
|
||||
.setSerializable("permissionId", this.id);
|
||||
int count = HibernateHelper.deleteDbAccessControlEntries(getSession(), query);
|
||||
// done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Deleted " + count + " access entries for permission " + this.id);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that all this access control list's entries have been deleted.
|
||||
*/
|
||||
public boolean onDelete(Session session) throws CallbackException
|
||||
{
|
||||
deleteEntries();
|
||||
return super.onDelete(session);
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
@@ -168,7 +137,7 @@ public class DbPermissionImpl extends LifecycleAdapter
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public DbPermissionKey getKey()
|
||||
{
|
||||
return new DbPermissionKey(typeQname, name);
|
||||
@@ -177,17 +146,21 @@ public class DbPermissionImpl extends LifecycleAdapter
|
||||
/**
|
||||
* Helper method to find a permission based on its natural key
|
||||
*
|
||||
* @param session the Hibernate session to use
|
||||
* @param qname the type qualified name
|
||||
* @param name the name of the permission
|
||||
* @param session
|
||||
* the Hibernate session to use
|
||||
* @param qname
|
||||
* the type qualified name
|
||||
* @param name
|
||||
* the name of the permission
|
||||
* @return Returns an existing instance or null if not found
|
||||
*/
|
||||
public static DbPermission find(Session session, QName qname, String name)
|
||||
{
|
||||
Query query = session
|
||||
.getNamedQuery(PermissionsDaoComponentImpl.QUERY_GET_PERMISSION)
|
||||
.setString("permissionTypeQName", qname.toString())
|
||||
.setString("permissionName", name);
|
||||
return (DbPermission) query.uniqueResult();
|
||||
// Query query = session
|
||||
// .getNamedQuery(PermissionsDaoComponentImpl.QUERY_GET_PERMISSION)
|
||||
// .setString("permissionTypeQName", qname.toString())
|
||||
// .setString("permissionName", name);
|
||||
// return (DbPermission) query.uniqueResult();
|
||||
throw new UnsupportedOperationException("TODO");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user