Accessing Instances in Python
Here are some examples of use of the API in Python:
res1 = coll.create_resource() # res1 is added to the collector instances 1 == len(coll.get_all_resource()) # is True res1.set_id( "MyFirstResourceId" ) # res1 primary key is complete so can be accessed with find_resource_by_business_key res1 == coll.find_resource_by_business_key( "MyFirstResourceId" ) # is True
Instances can also be accessed through the list of all known instances.
class CapacityPlanning(DbDomCollector):
def get_all_resource(self) -> FrozenSet[Resource]:
pass
def get_all_resource_capacity(self) -> FrozenSet[ResourceCapacity]:
pass
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:
class CapacityPlanning(DbDomCollector):
def find_solution_summary(self) -> SolutionSummary | None:
pass
def set_solution_summary(self, solution_summary: SolutionSummary) -> SolutionSummary | None:
pass