public Role getRole( String roleName )
throws RbacObjectNotFoundException, RbacManagerException
{
- return (Role) jdo.getObjectById( JdoRole.class, roleName, ROLE_DETAIL );
+ return jdo.getObjectById( JdoRole.class, roleName, ROLE_DETAIL );
}
/**
public Permission getPermission( String permissionName )
throws RbacObjectNotFoundException, RbacManagerException
{
- return (Permission) jdo.getObjectById( JdoPermission.class, permissionName, null );
+ return jdo.getObjectById( JdoPermission.class, permissionName, null );
}
@SuppressWarnings( "unchecked" )
public Operation getOperation( String operationName )
throws RbacObjectNotFoundException, RbacManagerException
{
- return (Operation) jdo.getObjectById( JdoOperation.class, operationName, null );
+ return jdo.getObjectById( JdoOperation.class, operationName, null );
}
@SuppressWarnings( "unchecked" )
public Resource getResource( String resourceIdentifier )
throws RbacObjectNotFoundException, RbacManagerException
{
- return (Resource) jdo.getObjectById( JdoResource.class, resourceIdentifier, null );
+ return jdo.getObjectById( JdoResource.class, resourceIdentifier, null );
}
@SuppressWarnings( "unchecked" )
public UserAssignment getUserAssignment( String principal )
throws RbacObjectNotFoundException, RbacManagerException
{
- return (UserAssignment) jdo.getObjectById( JdoUserAssignment.class, principal, ROLE_DETAIL );
+ return jdo.getObjectById( JdoUserAssignment.class, principal, ROLE_DETAIL );
}
/**
cache.pinAll( clazz, false ); // Pin all objects of type clazz from now on
}
- public Object saveObject( Object object )
+ public <T>T saveObject( T object )
{
- return saveObject( object, null );
+ return (T) saveObject( object, null );
}
- public Object saveObject( Object object, String[] fetchGroups )
+ public <T>T saveObject( T object, String[] fetchGroups )
{
PersistenceManager pm = getPersistenceManager();
Transaction tx = pm.currentTransaction();
pm.makePersistent( object );
- object = pm.detachCopy( object );
+ object = (T) pm.detachCopy( object );
tx.commit();
}
}
- public Object getObjectById( Class<?> clazz, String id, String fetchGroup )
+ public <T>T getObjectById( Class<T> clazz, String id, String fetchGroup )
throws RbacObjectNotFoundException, RbacManagerException
{
if ( StringUtils.isEmpty( id ) )
tx.commit();
- return object;
+ return (T) object;
}
catch ( JDOObjectNotFoundException e )
{
}
}
- public Object removeObject( Object o )
+ public <T>T removeObject( T o )
throws RbacManagerException
{
if ( o == null )
{
tx.begin();
- o = pm.getObjectById( pm.getObjectId( o ) );
+ o = (T) pm.getObjectById( pm.getObjectId( o ) );
pm.deletePersistent( o );