Accessing Instances in Java
Here are some examples of use of the API in Java:
Resource res1 = coll.createResource(); // res1 is added to the collector instances 1 == coll.getResource().size(); // is true res1.setId( "MyFirstResourceId" ); // res1 primary key is complete so can be accessed with getFromResource res1 == coll.getFromResource( "MyFirstResourceId" ); // is true
Instances can also be accessed through the list of all known instances.
public interface CapacityPlanning extends DbDomCollector {
List<Resource> getResource();
List<ResourceCapacity> getResourceCapacity();
...
}
Entities that are declared as single.row are accessed as singletons: the following JDL declaration
entity SolutionSummary {
// DOM [single.row] : [true]
start Instant,
end Instant,
timespan Integer
}
Will cause the following API to be generated:
public interface CapacityPlanning extends DbDomCollector {
SolutionSummary getSolutionSummary();
void setSolutionSummary(SolutionSummary value);
...
}