3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.persistence
.dao
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
15 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
19 * @author a.kohlbecker
23 public interface IBeanInitializer
{
26 * Wildcard for initializing all *ToOne relations of a <code>bean</code>.
28 public static final String LOAD_2ONE_WILDCARD
= "$";
31 * Wildcard for initializing all *ToOne and all *ToMany relations of a <code>bean</code>.
33 public static final String LOAD_2ONE_2MANY_WILDCARD
= "*";
36 * Initializes all *ToOne relations of the <code>bean</code>.
40 public void load(Object bean
);
43 * Initializes all *ToOne and all *ToMany relations of the <code>bean</code>.
47 public void loadFully(Object bean
);
50 * Allows more fine grained initialization not only of the root bean
51 * identified by its <code>uuid</code> but also of specific paths of
52 * the object graph. The sub graph to initialize may be defined in the
53 * <code>propertyPaths</code> parameter as list of paths all starting at the
56 * You can use wildcards <code>*</code> {@link LOAD_2ONE_2MANY_WILDCARD}
57 * and <code>$</code> {@link LOAD_2ONE_WILDCARD} for initializing
58 * all *ToOne and all *ToMany relations of a bean.
59 * NOTE: A wildcard subsequently terminates its property path.
61 * <b>Example:</b> Assuming <code>cdmEntity</code> is a {@link Taxon}
62 * instance the following <code>propertyPaths</code> can be used for
63 * initializing bean properties of this instance. It is possible to
64 * initialized nested properties of properties with unlimited depth.
66 * <li><code>name</code>: initializes {@link Taxon#getName()}</li>
67 * <li><code>name.rank</code>: initializes {@link Taxon#getName()}.{@link TaxonNameBase#getRank() getRank()}</li>
68 * <li><code>name.$</code>: initializes all *ToOne relations of the {@link Taxon#getName()}</li>
72 * @param propertyPaths
73 * a List of property names
75 public void initialize(Object bean
, List
<String
> propertyPaths
);
78 * Initializes the entities given in the bean list according to the given
79 * <code>propertyPaths</code>.
82 * @param propertyPaths
85 public <C
extends Collection
<?
>> C
initializeAll(C list
, List
<String
> propertyPaths
);
88 * Initialize the the proxy, unwrap the target object and return it.
91 * the proxy to initialize may wrap a single bean or a collection
92 * @return the unwrapped target object
94 public Object
initializeInstance(Object proxy
);
98 public void loadBy(UUID uuid);
99 public void loadFullyByUuid(UUID uuid);*/