View Javadoc

1   /* (c) Copyright 2003 Caleigo AB, All rights reserved. 
2    * 
3    * This library is free software; you can redistribute it and/or
4    * modify it under the terms of the GNU Lesser General Public
5    * License as published by the Free Software Foundation; either
6    * version 2.1 of the License, or (at your option) any later version.
7    * 
8    * This library is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   * Lesser General Public License for more details.
12   * 
13   * You should have received a copy of the GNU Lesser General Public
14   * License along with this library; if not, write to the Free Software
15   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   *  
17   */
18  
19  package org.caleigo.core;
20  
21  import java.util.*;
22  
23  /*** IEntityPool defines the interface to an entity collection class that can 
24   * store zero or more IEntity objects. The entities stored in an IEntityPool
25   * are not type specified and does not have to be defined by a single
26   * IEntityDescriptor. IEntityPool is not ordered and should not accept 
27   * duplicates effectively makeing it at a "Set".
28   *
29   * @author  Dennis Zikovic
30   * @version 1.00
31   * 
32   *//* 
33   *
34   * WHEN        WHO               WHY & WHAT
35   * ------------------------------------------------------------------------------
36   * 2001-10-10  Dennis Zikovic    Creation
37   */
38  public interface IEntityPool extends java.io.Serializable
39  {
40      // Action methods ----------------------------------------------------------
41      
42      /*** Return true if any (one or more) of the collections's contained 
43       * entities has the DIRTY flag set to true that is have unsaved changes.
44       */
45      public boolean isDirty();
46      
47      /*** Stores all contained entities that have the DIRTY flag set to true.
48       * The entities are stored in a single transaction meaning that if one
49       * store fails then all fails.
50       */
51      public void storeAll();
52      
53      /*** Deletes all contained entities. The entities are deleted in a single 
54       * transaction meaning that if one delete fails then all fails.
55       * USE THIS METHOD WITH CAUTION!
56       */
57      public void deleteAll();
58      
59      /*** Performs a refresh on all contained entities. The refresh is batched
60       * to save performance.
61       */
62      public void refreshAll();
63      
64      // Access methods ----------------------------------------------------------
65      public boolean addEntity(IEntity entity);
66      public boolean removeEntity(IEntity entity);
67      public Iterator iterator();
68      public void clear();
69      
70      public int size();
71      public boolean isEmpty();
72      
73      // Help methods ------------------------------------------------------------
74      public boolean contains(IEntity entity);
75      public boolean doesAccept(IEntity entity);    
76      
77      public Set asSet();
78  }