Source:
private void deleteInsertPermission(Permissionable permissionable, String type, Permissionable newReference) throws DotDataException { final String permissionId = permissionable.getPermissionId(); try{ Logger.debug(this.getClass(), "PERMDEBUG: " + Thread.currentThread().getName() + " - " + permissionId + " - started"); DotConnect dc1 = new DotConnect(); dc1.setSQL("SELECT inode FROM inode WHERE inode = ?"); dc1.addParam(permissionId); List<Map<String, Object>> l = dc1.loadObjectResults(); dc1.setSQL("SELECT id FROM identifier WHERE id = ?"); dc1.addParam(permissionId); List<Map<String, Object>> l2 = dc1.loadObjectResults(); if((l != null && l.size()>0) || (l2!=null && l2.size()>0)){ dc1.executeUpdate(DELETE_PERMISSIONABLE_REFERENCE_SQL, permissionId); dc1.executeUpdate(INSERT_PERMISSION_REFERENCE_SQL, permissionId, newReference.getPermissionId(), type); } } catch(Exception exception){ if(permissionable != null && newReference != null){ Logger.warn(this.getClass(), "Failed to insert Permission Ref. Usually not a problem. Permissionable:" + permissionId + " Parent : " + newReference.getPermissionId() + " Type: " + type); } else{ Logger.warn(this.getClass(), "Failed to insert Permission Ref. Usually not a problem. Setting Parent Permissions to null value: Permissionable:" + permissionable + " Parent:" + newReference + " Type: " + type); } Logger.debug(this.getClass(), "Failed to insert Permission Ref. : " + exception.toString(), exception); throw new DotDataException(exception.getMessage(), exception); } finally { Logger.debug(this.getClass(), "PERMDEBUG: " + Thread.currentThread().getName() + " - " + permissionId + " - ended"); } }

Target:
private void deleteInsertPermission(Permissionable permissionable, String type, Permissionable newReference) throws DotDataException { final String permissionId = permissionable.getPermissionId(); try{ Logger.debug(this.getClass(), "PERMDEBUG: " + Thread.currentThread().getName() + " - " + permissionId + " - started"); DotConnect dc1 = new DotConnect(); dc1.setSQL("SELECT inode FROM inode WHERE inode = ?"); dc1.addParam(permissionId); List<Map<String, Object>> inodeList = dc1.loadObjectResults(); dc1.setSQL("SELECT id FROM identifier WHERE id = ?"); dc1.addParam(permissionId); List<Map<String, Object>> identifierList = dc1.loadObjectResults(); if((inodeList != null && inodeList.size()>0) || (identifierList!=null && identifierList.size()>0)){ dc1.executeUpdate(DELETE_PERMISSIONABLE_REFERENCE_SQL, permissionId); dc1.executeUpdate(INSERT_PERMISSION_REFERENCE_SQL, permissionId, newReference.getPermissionId(), type); } } catch(Exception exception){ if(permissionable != null && newReference != null){ Logger.warn(this.getClass(), "Failed to insert Permission Ref. Usually not a problem. Permissionable:" + permissionId + " Parent : " + newReference.getPermissionId() + " Type: " + type); } else{ Logger.warn(this.getClass(), "Failed to insert Permission Ref. Usually not a problem. Setting Parent Permissions to null value: Permissionable:" + permissionable + " Parent:" + newReference + " Type: " + type); } Logger.debug(this.getClass(), "Failed to insert Permission Ref. : " + exception.toString(), exception); throw new DotDataException(exception.getMessage(), exception); } finally { Logger.debug(this.getClass(), "PERMDEBUG: " + Thread.currentThread().getName() + " - " + permissionId + " - ended"); } }