use of org.iobserve.planning.data.AllocationGroup in project iobserve-analysis by research-iobserve.
the class ModelTransformer method rebuildEnvironment.
private void rebuildEnvironment() throws ModelHandlingErrorException {
for (final AllocationGroup allocationGroup : this.originalAllocationGroups.getAllocationGroups()) {
final AllocationContext representingContext = allocationGroup.getRepresentingContext();
this.createResourcesAndReplicationDegrees(allocationGroup);
this.allocationModel.getAllocationContexts_Allocation().add(representingContext);
}
for (final AllocationGroup allocationGroup : this.originalAllocationGroups.getAllocationGroups()) {
final String allocationDegreeName = String.format("%s_AllocationDegree", allocationGroup.getName());
DesignDecisionModelFactory.createAllocationDegree(this.decisionModel, allocationDegreeName, allocationGroup.getRepresentingContext(), this.resourceEnvironmentModel.getResourceContainer_ResourceEnvironment());
}
ModelHelper.addAllAllocationsToReplicationDegrees(this.allocationModel, this.decisionModel);
this.saveModels();
}
use of org.iobserve.planning.data.AllocationGroup in project iobserve-analysis by research-iobserve.
the class ModelProcessing method rebuildEnvironment.
private void rebuildEnvironment() throws ModelHandlingErrorException {
for (final AllocationGroup allocationGroup : this.originalAllocationGroups.getAllocationGroups()) {
final AllocationContext representingContext = allocationGroup.getRepresentingContext();
// Set assembly context from allocation group to the context from the processed model
final AssemblyContext representedAsmCtx = this.systemModel.getAssemblyContexts__ComposedStructure().stream().filter(ctx -> representingContext.getAssemblyContext_AllocationContext().getId().equals(ctx.getId())).findFirst().orElse(null);
if (representedAsmCtx == null) {
throw new RuntimeException("There was something wrong with the system model. Please check your models.");
}
representingContext.setAssemblyContext_AllocationContext(representedAsmCtx);
this.createResourcesAndReplicationDegrees(this.decisionModel, allocationGroup);
this.allocationModel.getAllocationContexts_Allocation().add(representingContext);
}
for (final AllocationGroup allocationGroup : this.originalAllocationGroups.getAllocationGroups()) {
final String allocationDegreeName = String.format("%s_AllocationDegree", allocationGroup.getName());
DesignDecisionModelFactory.createAllocationDegree(this.decisionModel, allocationDegreeName, allocationGroup.getRepresentingContext(), this.resourceEnvironmentModel.getResourceContainer_ResourceEnvironment());
}
ModelHelper.addAllAllocationsToReplicationDegrees(this.allocationModel, this.decisionModel);
this.saveModels();
}
Aggregations