/** * Grabs <em>all</em> entity instances held in the {@link EntityBeanFactory} of the given type * then adds them to the graph. * * @param <E> * @param entityType * @return The generated entity set that was added to the graph. */ protected final <E extends IEntity> Set<E> addAll(Class<E> entityType) { final Set<E> set = entityBeanFactory.getAllEntityCopies(entityType); for (final E e : set) { addEntity(e); } return set; }
/** * Generates N unique entity copies of the given type then adds them to the graph. * * @param <E> * @param entityType * @param makeUnique Attempt to make the entities business key unique before adding? * @param n The number of copies to generate * @return The generated entity set that was added to the graph. */ protected final <E extends IEntity> Set<E> addN(Class<E> entityType, boolean makeUnique, int n) { final Set<E> set = entityBeanFactory.getNEntityCopies(entityType, n); for (final E e : set) { if (makeUnique) makeUnique(e); addEntity(e); } return set; }
/** * Generates a fresh entity that is <em>not</em> added to the graph. * * @param <E> * @param entityType * @param makeUnique * @return The generated entity. */ protected final <E extends IEntity> E generateEntity(Class<E> entityType, boolean makeUnique) { E e = entityBeanFactory.getEntityCopy(entityType); if (makeUnique) makeUnique(e); return e; }