primary ports moved to model, repository ports introduced to model

This commit is contained in:
Michał Michaluk
2018-02-18 12:33:18 +01:00
parent 95d6b1ed14
commit df64659038
14 changed files with 130 additions and 53 deletions

View File

@@ -0,0 +1,32 @@
package pl.com.bottega.factory.demand.forecasting;
import lombok.AllArgsConstructor;
import pl.com.bottega.factory.demand.forecasting.ReviewRequired.ToReview;
@AllArgsConstructor
public class DemandService {
private final ProductDemandRepository repository;
public void init(String refNo) {
repository.initDemandsFor(refNo);
}
public void process(Document document) {
ProductDemand model = repository.get(document.getRefNo());
model.process(document);
repository.save(model);
}
public void adjust(AdjustDemand adjustDemand) {
ProductDemand model = repository.get(adjustDemand.getRefNo());
model.adjust(adjustDemand);
repository.save(model);
}
public void review(ToReview review, ReviewDecision decision) {
ProductDemand model = repository.get(review.getRefNo());
model.review(review, decision);
repository.save(model);
}
}

View File

@@ -0,0 +1,9 @@
package pl.com.bottega.factory.demand.forecasting;
interface ProductDemandRepository {
ProductDemand get(String refNo);
void save(ProductDemand model);
void initDemandsFor(String refNo);
}