mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
8083: Merged V2.1 to V2.2 8066: RM-31 and related issues (ACT-729) 8068: Fix for AR-1997 8084: Fixed script error on notify page of invite website user wizard 8086: Merged V2.1 to V2.2 8075: Clear()ing a hibernate session, is not always enough to guarantee that transactions not use unbounded amounts of memory 8076: Turn off test that needs to be fixed real soon now. 8092: Implementation for: http://issues.alfresco.com/browse/AR-1744 8093: Fixed upgrade scripts for V2.1.2 to V2.2 upgrades 8096: Fix for AWC-1578 and AWC-1814 8097: Added new indexes missing from scripts and made index names consistent. 8098: Fix for AWC-1548 8100: Removed use of QName from alf_permission table 8102: Fix for AWC-1690 8103: test was == on id that used to be long but is now a Long git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8476 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
163 lines
4.5 KiB
Java
163 lines
4.5 KiB
Java
/*
|
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
* As a special exception to the terms and conditions of version 2.0 of
|
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
|
* FLOSS exception. You should have recieved a copy of the text describing
|
|
* the FLOSS exception, and it is also available here:
|
|
* http://www.alfresco.com/legal/licensing"
|
|
*/
|
|
package org.alfresco.repo.domain.hibernate;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import org.alfresco.repo.domain.DbPermission;
|
|
import org.alfresco.repo.domain.DbPermissionKey;
|
|
import org.alfresco.repo.domain.QNameEntity;
|
|
import org.alfresco.service.namespace.QName;
|
|
import org.alfresco.util.EqualsHelper;
|
|
import org.hibernate.Session;
|
|
|
|
/**
|
|
* The persisted class for permissions.
|
|
*
|
|
* @author andyh
|
|
*/
|
|
public class DbPermissionImpl implements DbPermission, Serializable
|
|
{
|
|
private static final long serialVersionUID = -6352566900815035461L;
|
|
|
|
private Long id;
|
|
private Long version;
|
|
private QNameEntity typeQName;
|
|
private String name;
|
|
|
|
public DbPermissionImpl()
|
|
{
|
|
super();
|
|
}
|
|
|
|
@Override
|
|
public String toString()
|
|
{
|
|
StringBuilder sb = new StringBuilder(128);
|
|
sb.append("DbPermissionImpl")
|
|
.append("[ id=").append(id)
|
|
.append(", version=").append(version)
|
|
.append(", typeQName=").append(typeQName.getQName())
|
|
.append(", name=").append(getName())
|
|
.append("]");
|
|
return sb.toString();
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o)
|
|
{
|
|
if (this == o)
|
|
{
|
|
return true;
|
|
}
|
|
if (!(o instanceof DbPermission))
|
|
{
|
|
return false;
|
|
}
|
|
DbPermission other = (DbPermission) o;
|
|
return (EqualsHelper.nullSafeEquals(typeQName, other.getTypeQName())) && (EqualsHelper.nullSafeEquals(name, other.getName()));
|
|
}
|
|
|
|
@Override
|
|
public int hashCode()
|
|
{
|
|
return typeQName.hashCode() + (37 * name.hashCode());
|
|
}
|
|
|
|
public Long getId()
|
|
{
|
|
return id;
|
|
}
|
|
|
|
/**
|
|
* For Hibernate use
|
|
*/
|
|
@SuppressWarnings("unused")
|
|
private void setId(Long id)
|
|
{
|
|
this.id = id;
|
|
}
|
|
|
|
public Long getVersion()
|
|
{
|
|
return version;
|
|
}
|
|
|
|
/**
|
|
* For Hibernate use
|
|
*/
|
|
@SuppressWarnings("unused")
|
|
private void setVersion(Long version)
|
|
{
|
|
this.version = version;
|
|
}
|
|
|
|
public QNameEntity getTypeQName()
|
|
{
|
|
return typeQName;
|
|
}
|
|
|
|
public void setTypeQName(QNameEntity typeQName)
|
|
{
|
|
this.typeQName = typeQName;
|
|
}
|
|
|
|
public String getName()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name)
|
|
{
|
|
this.name = name;
|
|
}
|
|
|
|
public DbPermissionKey getKey()
|
|
{
|
|
return new DbPermissionKey(typeQName.getQName(), name);
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
* @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();
|
|
throw new UnsupportedOperationException("TODO");
|
|
}
|
|
}
|