Package org.milowski.db

Examples of org.milowski.db.DBConnection


   }
  
   public boolean removePermission(final Permission p)
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         connection.update(AuthDB.DELETE_ROLE_PERMISSION, new DBUpdateHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1, id);
               s.setInt(2, p.getId());
View Full Code Here


   }
  
   protected void init()
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_ROLES, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1, id);
            }
View Full Code Here

   }
  
   public void delete()
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         connection.deleteById(AuthDB.DELETE_GROUP_MEMBERS, id);
         connection.deleteById(AuthDB.DELETE_GROUP_ROLES, id);
         connection.deleteById(AuthDB.DELETE_GROUP, id);
         db.realmGroupCaches.get(realm).remove(id);
      } finally {
         db.release(connection);
      }
   }
View Full Code Here

      throws SQLException
   {
      if (roles.contains(role)) {
         return true;
      }
      DBConnection connection = db.getConnection();
      try {
         connection.update(AuthDB.CREATE_GROUP_ROLE, new DBUpdateHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setInt(2,role.getId());
View Full Code Here

   }
  
   public boolean removeRole(final Role role)
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         return connection.update(AuthDB.DELETE_GROUP_ROLE, new DBUpdateHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setInt(2,role.getId());
View Full Code Here

   }
  
   public void addMember(final RealmUser user)
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         connection.update(AuthDB.CREATE_GROUP_MEMBER, new DBUpdateHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setInt(2,user.getId());
View Full Code Here

   }
  
   public boolean removeMember(final RealmUser user)
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         return connection.update(AuthDB.DELETE_GROUP_MEMBER, new DBUpdateHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setInt(2,user.getId());
View Full Code Here

  
   public boolean hasMember(final RealmUser user)
      throws SQLException
   {
      final Slot<Boolean> member = new Slot<Boolean>(false);
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_MEMBER, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setInt(2,user.getId());
View Full Code Here

   public Iterator<RealmUser> getMembers()
      throws SQLException
   {
      final Slot<Iterator<RealmUser>> result = new Slot<Iterator<RealmUser>>();
      final DBCache<UUID,RealmUser> cache = db.realmUserCaches.get(realm);
      final DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_MEMBERS, new DBQueryHandler() {
            public boolean shouldClose() { return false; }
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1, id);
View Full Code Here

   }
  
   public void delete()
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         db.LOG.info("Delete id "+id);
         connection.deleteById(AuthDB.DELETE_REALM_USER_ALIAS, id);
         connection.deleteById(AuthDB.DELETE_REALM_USER_GROUPS, id);
         connection.deleteById(AuthDB.DELETE_REALM_USER, id);
         db.realmUserCaches.get(realm).remove(id);
      } finally {
         db.release(connection);
      }
   }
View Full Code Here

TOP

Related Classes of org.milowski.db.DBConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.