protected void unassignFromUserObjectInDb ( final Type _unassignType , final JAASSystem _jaasSystem , final AbstractUserObject _object ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; Statement stmt = null ; final StringBuilder cmd = new StringBuilder ( ) ; try { cmd . append ( "delete from " ) . append ( _unassignType . getMainTable ( ) . getSqlTable ( ) ) . append ( " " ) . append ( "where USERJAASSYSTEM=" ) . append ( _jaasSystem . getId ( ) ) . append ( " " ) . append ( "and USERABSTRACTFROM=" ) . append ( getId ( ) ) . append ( " " ) . append ( "and USERABSTRACTTO=" ) . append ( _object . getId ( ) ) ; stmt = con . createStatement ( ) ; stmt . executeUpdate ( cmd . toString ( ) ) ; } catch ( final SQLException e ) { AbstractUserObject . LOG . error ( "could not execute '" + cmd . toString ( ) + "' to unassign user object '" + toString ( ) + "' from object '" + _object + "' for JAAS system '" + _jaasSystem + "' " , e ) ; throw new EFapsException ( getClass ( ) , "unassignFromUserObjectInDb.SQLException" , e , cmd . toString ( ) , getName ( ) ) ; } finally { try { if ( stmt != null ) { stmt . close ( ) ; } con . commit ( ) ; } catch ( final SQLException e ) { AbstractUserObject . LOG . error ( "Could not close a statement." , e ) ; } } } finally { try { if ( con != null && ! con . isClosed ( ) ) { con . close ( ) ; } } catch ( final SQLException e ) { throw new CacheReloadException ( "Cannot read a type for an attribute." , e ) ; } } }
Unassign this user object from the given user object for given JAAS system .