Newer
Older
package it.inaf.oats.ia2.tapschemamanager.api.contract;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import java.sql.SQLException;
import java.util.List;
/**
* Objects of this class contain zero or more {@link ChildEntity} objects.
*
* @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
*/
public interface EntitiesContainer<T extends ChildEntity> {
/**
* Returns a specific child of the container, selecting it by name and
* filtering it by a set of possible status: if the child doesn't have one
* of the status specified, this method returns null.<br>
* <strong>If no status is specified it is assumed that all status are
* valid.</strong>
*/
T getChild(String childName, Status... status);
/**
* Add a {@link ChildEntity} specifying its name. If the child entity has
* never been read from the database it is loaded when this method is
* called. If the entity was marked as removed, it will marked as added
* again.
*/
T addChild(String childName) throws SQLException;
/**
* Remove a {@link ChildEntity} specifying its name.<br>
* The child isn't really removed but only marked as removed (the removal
* will happen when the {@link TapSchema#save()} method will be called).
*/
void removeChild(String childName);
/**
* Retrieve a list of names of child entities that can be added.<br> The
* list contains only names of entities that have never been added: entities
* which instance don't exist yet or entities having
* {@link Status} {@code LOADED}.
*/
List<String> getAddableChildrenNames();
/**
* Retrieve a list of children filtering them by a set of possible
* status.<br>
* <strong>If no status is specified it is assumed that all status are
* valid.</strong>
*/
List<T> getChildren(Status... statuses);
/**
* Retrieve all children having {@link Status} {@code ADDED_PERSISTED} or
* {@code ADDED_NOT_PERSISTED}.
*/
List<T> getAddedChildren();
/**
* Retrieve all children having {@link Status} {@code ADDED_PERSISTED},
* {@code ADDED_NOT_PERSISTED}, {@code TO_REMOVE} or
* {@code REMOVED_NOT_PERSISTED}.
*/
List<T> getAddedOrRemovedChildren();
}