ItEr20S04ArquitecturaServidorItEr19S04: Removed methods "forceLoad*" from entities.
This commit is contained in:
parent
c27e3ad336
commit
8943545441
4 changed files with 19 additions and 14 deletions
|
|
@ -141,10 +141,6 @@ public class HoursGroup extends BaseEntity implements Cloneable {
|
|||
}
|
||||
}
|
||||
|
||||
public void forceLoadCriterions() {
|
||||
criterions.size();
|
||||
}
|
||||
|
||||
public void setParentOrderLine(OrderLine parentOrderLine) {
|
||||
this.parentOrderLine = parentOrderLine;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,13 +170,6 @@ public abstract class Resource extends BaseEntity {
|
|||
return new Query();
|
||||
}
|
||||
|
||||
public void forceLoadSatisfactions() {
|
||||
for (CriterionSatisfaction criterionSatisfaction : criterionSatisfactions) {
|
||||
criterionSatisfaction.getCriterion().getName();
|
||||
criterionSatisfaction.getCriterion().getType().getName();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract int getDailyCapacity();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ public class CriterionServiceTest {
|
|||
try {
|
||||
Resource result = resourceService
|
||||
.findResource(worker1.getId());
|
||||
result.forceLoadSatisfactions();
|
||||
forceLoadSatisfactions(result);
|
||||
return result;
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
@ -280,6 +280,14 @@ public class CriterionServiceTest {
|
|||
assertTrue(reloadedCriterion.isEquivalent(criterion));
|
||||
}
|
||||
|
||||
private void forceLoadSatisfactions(Resource resource) {
|
||||
for (CriterionSatisfaction criterionSatisfaction : resource
|
||||
.getAllSatisfactions()) {
|
||||
criterionSatisfaction.getCriterion().getName();
|
||||
criterionSatisfaction.getCriterion().getType().getName();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@NotTransactional
|
||||
public void shouldntThrowExceptionDueToTransparentProxyGotcha() throws ValidationException {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class WorkerModel implements IWorkerModel {
|
|||
Validate.notNull(worker, "worker must be not null");
|
||||
try {
|
||||
this.worker = (Worker) resourceService.findResource(worker.getId());
|
||||
this.worker.forceLoadSatisfactions();
|
||||
forceLoadSatisfactions(this.worker);
|
||||
localizationsAssigner = new MultipleCriterionActiveAssigner(
|
||||
criterionService, this.worker,
|
||||
PredefinedCriterionTypes.LOCATION_GROUP);
|
||||
|
|
@ -109,6 +109,14 @@ public class WorkerModel implements IWorkerModel {
|
|||
}
|
||||
}
|
||||
|
||||
private static void forceLoadSatisfactions(Resource resource) {
|
||||
for (CriterionSatisfaction criterionSatisfaction : resource
|
||||
.getAllSatisfactions()) {
|
||||
criterionSatisfaction.getCriterion().getName();
|
||||
criterionSatisfaction.getCriterion().getType().getName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public AddingSatisfactionResult addSatisfaction(ICriterionType<?> type,
|
||||
|
|
@ -243,7 +251,7 @@ public class WorkerModel implements IWorkerModel {
|
|||
this.criterionService = criterionService;
|
||||
this.resource = resource;
|
||||
this.type = type;
|
||||
this.resource.forceLoadSatisfactions();
|
||||
forceLoadSatisfactions(this.resource);
|
||||
this.history = calculateInitialHistory();
|
||||
this.initialCriterionsNotAssigned = calculateInitialCriterionsNotAssigned();
|
||||
for (Criterion criterion : initialCriterionsNotAssigned) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue