mpoeschl    01/07/15 11:08:46

  Modified:    build    build.properties
  Added:       src/java/org/apache/turbine/services/security/impl/db/entity
                        UserPeer.java TurbineUser.java SecurityObject.java
                        TurbinePermission.java TurbineRolePeer.java
                        TurbineRole.java TurbineGroup.java
                        TurbineGroupPeer.java TurbineUserPeer.java
                        TurbinePermissionPeer.java
  Removed:     src/java/org/apache/turbine/om/security SecurityObject.java
                        TurbineGroup.java TurbineGroupPeer.java
                        TurbinePermission.java TurbinePermissionPeer.java
                        TurbineRolePeer.java TurbineUser.java
                        TurbineUserPeer.java
               src/java/org/apache/turbine/om/security/peer GroupPeer.java
                        PermissionPeer.java RolePeer.java
                        RolePermissionPeer.java TurbineUserPeer.java
                        UserGroupRolePeer.java UserPeer.java
  Log:
  move (security) om/peer classes
  
  Revision  Changes    Path
  1.12      +1 -1      jakarta-turbine/build/build.properties
  
  Index: build.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/build/build.properties,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- build.properties  2001/07/15 14:39:22     1.11
  +++ build.properties  2001/07/15 18:08:41     1.12
  @@ -51,5 +51,5 @@
   DataSQLControlTemplate = sql/load/Control.vm
   securityControlTemplate = sql/security/Control.vm
   
  -securityPackage=org.apache.turbine.om.security
  +securityPackage=org.apache.turbine.services.security.impl.db.entity
   schedulerPackage=org.apache.turbine.services.schedule
  
  
  
  1.2       +81 -0     
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/UserPeer.java
  
  
  
  
  1.2       +478 -0    
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbineUser.java
  
  
  
  
  1.2       +189 -0    
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/SecurityObject.java
  
  
  
  
  1.2       +162 -0    
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbinePermission.java
  
  
  
  
  1.1                  
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbineRolePeer.java
  
  Index: TurbineRolePeer.java
  ===================================================================
  package org.apache.turbine.services.security.impl.db.entity;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.Vector;
  import org.apache.turbine.services.security.impl.db.entity.map.TurbineRoleMapBuilder;
  import org.apache.turbine.services.security.impl.db.entity.UserPeer;
  import org.apache.turbine.services.db.om.Persistent;
  import org.apache.turbine.services.db.om.peer.BasePeer;
  import org.apache.turbine.services.db.pool.DBConnection;
  import org.apache.turbine.services.db.util.Criteria;
  import org.apache.turbine.services.security.TurbineSecurity;
  import org.apache.turbine.services.security.entity.Group;
  import org.apache.turbine.services.security.entity.Role;
  import org.apache.turbine.services.security.entity.User;
  import org.apache.turbine.services.security.impl.db.DBSecurityService;
  import org.apache.turbine.services.security.util.DataBackendException;
  import org.apache.turbine.services.security.util.RoleSet;
  
  /**
   * This class handles all the database access for the ROLE table.
   * This table contains all the roles that a given member can play.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Frank Y. Kim</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>John D. McNally</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Brett McLaughlin</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Poeschl</a>
   * @version $Id: TurbineRolePeer.java,v 1.1 2001/07/15 18:08:42 mpoeschl Exp $
   */
  public class TurbineRolePeer
      extends org.apache.turbine.services.security.impl.db.entity.BaseTurbineRolePeer
  {
      /** The column name for the name field. */
      public static final String NAME = ROLE_NAME;
  
      /**
       * Builds a criteria object based upon an Role object
       */
      public static Criteria buildCriteria(Role role)
      {
          return BaseTurbineRolePeer.buildCriteria((TurbineRole)role);
      }
  
      /**
       * Checks if a Role is defined in the system. The name
       * is used as query criteria.
       *
       * @param permission The Role to be checked.
       * @return <code>true</code> if given Role exists in the system.
       * @throws DataBackendException when more than one Role with
       *         the same name exists.
       * @throws Exception, a generic exception.
       */
      public static boolean checkExists(Role role)
          throws DataBackendException, Exception
      {
          Criteria criteria = new Criteria();
          criteria.addSelectColumn(ROLE_ID);
          criteria.add(NAME, role.getName());
          Vector results = BasePeer.doSelect(criteria);
          if(results.size() > 1)
          {
              throw new DataBackendException("Multiple roles named '" +
                  role.getName() + "' exist!");
          }
          return (results.size() == 1);
      }
  
      /**
       * Returns the full name of a column.
       *
       * @return A String with the full name of the column.
       */
      public static String getColumnName(String name)
      {
          StringBuffer sb = new StringBuffer();
          sb.append(TurbineRoleMapBuilder.getTable());
          sb.append(".");
          sb.append(name);
          return sb.toString();
      }
  
      /**
       * Get the name of this table.
       *
       * @return A String with the name of the table.
       */
      public static String getTableName()
      {
          return TABLE_NAME;
      }
  
      /**
       * Retrieves/assembles a RoleSet based on the Criteria passed in
       */
      public static RoleSet retrieveSet(Criteria criteria) throws Exception
      {
          Vector results = doSelect(criteria);
          RoleSet rs = new RoleSet();
          for (int i=0; i<results.size(); i++)
          {
              rs.add( (Role)results.elementAt(i) );
          }
          return rs;
      }
  
      /**
       * Retrieves a set of Roles that an User was assigned in a Group
       *
       * @param user An user.
       * @param group A group
       * @return A Set of Roles of this User in the Group
       * @exception Exception, a generic exception.
       */
      public static RoleSet retrieveSet(User user, Group group)
          throws Exception
      {
          Criteria criteria = new Criteria();
  
          /*
           * Peer specific methods should absolutely NOT be part
           * of any of the generic interfaces in the security system.
           * this is not good.
           *
           * UserPeer up = TurbineSecurity.getUserPeerInstance();
           */
          UserPeer up = ((DBSecurityService)TurbineSecurity.getService())
              .getUserPeerInstance();
  
          criteria.add(TurbineUserPeer.USERNAME, user.getUserName());
          criteria.add(TurbineUserGroupRolePeer.GROUP_ID,
                       ((Persistent)group).getPrimaryKey());
  
          criteria.addJoin(TurbineUserPeer.USER_ID, TurbineUserGroupRolePeer.USER_ID);
          criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID, TurbineRolePeer.ROLE_ID);
          return retrieveSet(criteria);
      }
  
  }
  
  
  
  1.2       +253 -0    
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbineRole.java
  
  
  
  
  1.2       +248 -0    
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbineGroup.java
  
  
  
  
  1.1                  
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbineGroupPeer.java
  
  Index: TurbineGroupPeer.java
  ===================================================================
  package org.apache.turbine.services.security.impl.db.entity;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // JDK classes
  import java.util.Vector;
  import 
org.apache.turbine.services.security.impl.db.entity.map.TurbineGroupMapBuilder;
  import org.apache.turbine.services.db.om.peer.BasePeer;
  import org.apache.turbine.services.db.pool.DBConnection;
  import org.apache.turbine.services.db.util.Criteria;
  import org.apache.turbine.services.security.entity.Group;
  import org.apache.turbine.services.security.entity.SecurityEntity;
  import org.apache.turbine.services.security.util.GroupSet;
  import org.apache.turbine.services.security.util.DataBackendException;
  
  /**
   * This class handles all the database access for the Group table.
   * This table contains all the Groups that a given member can play.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Frank Y. Kim</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>John D. McNally</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Brett McLaughlin</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Poeschl</a>
   * @version $Id: TurbineGroupPeer.java,v 1.1 2001/07/15 18:08:42 mpoeschl Exp $
   */
  public class TurbineGroupPeer
      extends org.apache.turbine.services.security.impl.db.entity.BaseTurbineGroupPeer
  {
      /** The column name for the name field. */
      public static final String NAME = GROUP_NAME;
  
      /**
       * Returns the full name of a column.
       *
       * @return A String with the full name of the column.
       */
      public static String getColumnName(String name)
      {
          StringBuffer sb = new StringBuffer();
          sb.append(TurbineGroupMapBuilder.getTable());
          sb.append(".");
          sb.append(name);
          return sb.toString();
      }
  
      /**
       * Checks if a Group is defined in the system. The name
       * is used as query criteria.
       *
       * @param permission The Group to be checked.
       * @return <code>true</code> if given Group exists in the system.
       * @throws DataBackendException when more than one Group with
       *         the same name exists.
       * @throws Exception, a generic exception.
       */
      public static boolean checkExists(Group group)
          throws DataBackendException, Exception
      {
          Criteria criteria = new Criteria();
          criteria.addSelectColumn(GROUP_ID);
          criteria.add(NAME, ((SecurityEntity)group).getName());
          Vector results = BasePeer.doSelect(criteria);
          if(results.size() > 1)
          {
              throw new DataBackendException("Multiple groups named '" +
                  ((TurbineGroup)group).getName() + "' exist!");
          }
          return (results.size()==1);
      }
  
      /**
       * Get the name of this table.
       *
       * @return A String with the name of the table.
       */
      public static String getTableName()
      {
          return TABLE_NAME;
      }
  
      /**
       * Builds a criteria object based upon an Group object
       */
      public static Criteria buildCriteria(Group group) {
          return BaseTurbineGroupPeer.buildCriteria((TurbineGroup)group);
      }
  
      /**
       * Retrieves/assembles a GroupSet of all of the Groups.
       *
       * @param criteria The criteria to use.
       * @return A GroupSet.
       * @exception Exception, a generic exception.
       */
      public static GroupSet retrieveSet() throws Exception
      {
          return retrieveSet(new Criteria());
      }
  
      /**
       * Retrieves/assembles a GroupSet based on the Criteria passed in
       */
      public static GroupSet retrieveSet(Criteria criteria) throws Exception
      {
          Vector results = doSelect(criteria);
          GroupSet rs = new GroupSet();
          for (int i = 0; i < results.size(); i++)
          {
              rs.add((Group)results.elementAt(i));
          }
          return rs;
      }
  
  }
  
  
  
  1.2       +209 -0    
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbineUserPeer.java
  
  
  
  
  1.1                  
jakarta-turbine/src/java/org/apache/turbine/services/security/impl/db/entity/TurbinePermissionPeer.java
  
  Index: TurbinePermissionPeer.java
  ===================================================================
  package org.apache.turbine.services.security.impl.db.entity;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.Vector;
  import java.util.Enumeration;
  import 
org.apache.turbine.services.security.impl.db.entity.map.TurbinePermissionMapBuilder;
  import org.apache.turbine.services.db.om.BaseObject;
  import org.apache.turbine.services.db.om.peer.BasePeer;
  import org.apache.turbine.services.db.pool.DBConnection;
  import org.apache.turbine.services.db.util.Criteria;
  import org.apache.turbine.services.security.entity.Permission;
  import org.apache.turbine.services.security.entity.Role;
  import org.apache.turbine.services.security.entity.SecurityEntity;
  import org.apache.turbine.services.security.util.DataBackendException;
  import org.apache.turbine.services.security.util.PermissionSet;
  
  /**
   * This class handles all the database access for the PERMISSION
   * table.  This table contains all the permissions that are used in
   * the system.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Frank Y. Kim</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>John D. McNally</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Brett McLaughlin</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Poeschl</a>
   * @version $Id: TurbinePermissionPeer.java,v 1.1 2001/07/15 18:08:42 mpoeschl Exp $
   */
  public class TurbinePermissionPeer
      extends 
org.apache.turbine.services.security.impl.db.entity.BaseTurbinePermissionPeer
  {
      /** The column name for the name field. */
      public static final String NAME = PERMISSION_NAME;
  
      /**
       * Builds a criteria object based upon an Permission object
       */
      public static Criteria buildCriteria( Permission permission )
      {
          return 
BaseTurbinePermissionPeer.buildCriteria((TurbinePermission)permission);
      }
  
      /**
       * Checks if a Permission is defined in the system. The name
       * is used as query criteria.
       *
       * @param permission The Permission to be checked.
       * @return <code>true</code> if given Permission exists in the system.
       * @throws DataBackendException when more than one Permission with
       *         the same name exists.
       * @throws Exception, a generic exception.
       */
      public static boolean checkExists( Permission permission )
          throws DataBackendException, Exception
      {
          Criteria criteria = new Criteria();
          criteria.addSelectColumn(PERMISSION_ID);
          criteria.add(NAME, ((SecurityEntity)permission).getName());
          Vector results = BasePeer.doSelect(criteria);
          if(results.size() > 1)
          {
              throw new DataBackendException("Multiple permissions named '" +
                  ((SecurityEntity)permission).getName() + "' exist!");
          }
          return (results.size()==1);
      }
  
      /**
       * Returns the full name of a column.
       *
       * @return A String with the full name of the column.
       */
      public static String getColumnName (String name)
      {
          StringBuffer sb = new StringBuffer();
          sb.append(TurbinePermissionMapBuilder.getTable());
          sb.append(".");
          sb.append(name);
          return sb.toString();
      }
  
      /**
       * Get the name of this table.
       *
       * @return A String with the name of the table.
       */
      public static String getTableName()
      {
          return TABLE_NAME;
      }
  
      /**
       * Retrieves/assembles a PermissionSet
       *
       * @param criteria The criteria to use.
       * @return A PermissionSet.
       * @exception Exception, a generic exception.
       */
      public static PermissionSet retrieveSet(Criteria criteria)
          throws Exception
      {
          Vector results = doSelect(criteria);
          PermissionSet ps = new PermissionSet();
          for (int i=0; i<results.size(); i++)
          {
              ps.add( (Permission)results.elementAt(i) );
          }
          return ps;
      }
  
      /**
       * Retrieves a set of Permissions associated with a particular Role.
       *
       * @param role The role to query permissions of.
       * @return A set of permissions associated with the Role.
       * @exception Exception, a generic exception.
       */
      public static PermissionSet retrieveSet( Role role )
          throws Exception
      {
          Criteria criteria = new Criteria();
          criteria.add(TurbineRolePermissionPeer.ROLE_ID,
                       ((TurbineRole)role).getPrimaryKey());
          criteria.addJoin(TurbineRolePermissionPeer.PERMISSION_ID,
                           TurbinePermissionPeer.PERMISSION_ID);
          return retrieveSet(criteria);
      }
  
      /**
       * Pass in two Vector's of Permission Objects.  It will return a
       * new Vector with the difference of the two Vectors: C = (A - B).
       *
       * @param some Vector B in C = (A - B).
       * @param all Vector A in C = (A - B).
       * @return Vector C in C = (A - B).
       */
      public static final Vector getDifference(Vector some, Vector all)
      {
          Vector clone = (Vector)all.clone();
          for (Enumeration e = some.elements() ; e.hasMoreElements() ;)
          {
              Permission tmp = (Permission) e.nextElement();
              for (Enumeration f = clone.elements() ; f.hasMoreElements() ;)
              {
                  Permission tmp2 = (Permission) f.nextElement();
                  if (((BaseObject)tmp).getPrimaryKey() ==
                      ((BaseObject)tmp2).getPrimaryKey())
                  {
                      clone.removeElement(tmp2);
                      break;
                  }
              }
          }
          return clone;
      }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to