org.entityfs
Interface EntityListable

All Superinterfaces:
Iterable<EntityView>, Lockable, ReadLockable
All Known Subinterfaces:
Directory, DirectoryView, EntityRepository
All Known Implementing Classes:
AggregatingEntityRepository, ManualEntityListable

public interface EntityListable
extends Iterable<EntityView>, ReadLockable

This interface defines the listEntities() method that list all entities in an entity repository (commonly a Directory).

This interface extends Iterable&lt;EntityView&gt;. See DirectoryView for more information on that.

Objects implementing this interface can be used with some of the utility methods of Entities and Directories.

Since:
1.0
Author:
Karl Gustafsson

Method Summary
 boolean isEmpty()
          Is the listable empty? If a directory view is empty, the viewed directory may still contain entities that are hidden by the view's filter.
 Set<EntityView> listEntities()
          Return all entities that are visible in this directory.
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.entityfs.lock.ReadLockable
getReadLock, isReadLockedByCurrentThread, lockForReading
 

Method Detail

listEntities

Set<EntityView> listEntities()
                             throws IllegalStateException,
                                    ReadLockRequiredException,
                                    AccessDeniedException
Return all entities that are visible in this directory. The result is not sorted in any way.

If this is called on a directory view, all returned ViewCapable entities inherit the view's filters.

Returns:
A Set of entity views. If this is called on a directory entity object, a set of entity objects (not views) are returned. The set may be empty, but never null.
Throws:
IllegalStateException - If the view is disconnected
ReadLockRequiredException - If the client does not have a read lock for the directory.
AccessDeniedException - If the client does not have execute access to the directory.
Locks_required:
A read lock on the directory.
Permissions_required:
Execute access.

isEmpty

boolean isEmpty()
                throws IllegalStateException,
                       ReadLockRequiredException,
                       AccessDeniedException
Is the listable empty? If a directory view is empty, the viewed directory may still contain entities that are hidden by the view's filter.

Returns:
true if the directory view is empty.
Throws:
IllegalStateException - If the view is disconnected.
ReadLockRequiredException - If the client does not have a read lock for the directory.
AccessDeniedException - If the client does not have execute access to the directory.
Locks_required:
A read lock on this directory.
Permissions_required:
Execute access.