use of org.apache.isis.applib.services.registry.ServiceRegistry2 in project estatio by estatio.
the class DocumentTemplate method newAttachmentAdvisor.
@Programmatic
public AttachmentAdvisor newAttachmentAdvisor(final Object domainObject) {
final Class<?> domainObjectClass = domainObject.getClass();
final com.google.common.base.Optional<Applicability> applicabilityIfAny = FluentIterable.from(getAppliesTo()).filter(applicability -> applies(applicability, domainObjectClass)).first();
if (!applicabilityIfAny.isPresent()) {
return null;
}
final AttachmentAdvisor attachmentAdvisor = (AttachmentAdvisor) classService.instantiate(applicabilityIfAny.get().getAttachmentAdvisorClassName());
serviceRegistry2.injectServicesInto(attachmentAdvisor);
return attachmentAdvisor;
}
use of org.apache.isis.applib.services.registry.ServiceRegistry2 in project estatio by estatio.
the class DocumentTemplate method newRendererModelFactory.
@Programmatic
public RendererModelFactory newRendererModelFactory(final Object domainObject) {
final Class<?> domainObjectClass = domainObject.getClass();
final com.google.common.base.Optional<Applicability> applicabilityIfAny = FluentIterable.from(getAppliesTo()).filter(applicability -> applies(applicability, domainObjectClass)).first();
if (!applicabilityIfAny.isPresent()) {
return null;
}
final RendererModelFactory rendererModelFactory = (RendererModelFactory) classService.instantiate(applicabilityIfAny.get().getRendererModelFactoryClassName());
serviceRegistry2.injectServicesInto(rendererModelFactory);
return rendererModelFactory;
}
use of org.apache.isis.applib.services.registry.ServiceRegistry2 in project estatio by estatio.
the class Project_CreateMissingItems method chargesLinkedNotOnItems.
private List<Charge> chargesLinkedNotOnItems() {
List<Charge> result = new ArrayList<>();
Project_OrderItemsNotOnProjectItem orderItemsMixin = new Project_OrderItemsNotOnProjectItem(project);
serviceRegistry2.injectServicesInto(orderItemsMixin);
for (Charge chargeCandidate : orderItemsMixin.orderItemsNotOnProjectItem().stream().filter(x -> x.getCharge() != null).map(x -> x.getCharge()).collect(Collectors.toList())) {
if (!result.contains(chargeCandidate)) {
result.add(chargeCandidate);
}
}
Project_InvoiceItemsNotOnProjectItem invoiceItemsMixin = new Project_InvoiceItemsNotOnProjectItem(project);
serviceRegistry2.injectServicesInto(invoiceItemsMixin);
for (Charge chargeCandidate : invoiceItemsMixin.invoiceItemsNotOnProjectItem().stream().filter(x -> x.getCharge() != null).map(x -> x.getCharge()).collect(Collectors.toList())) {
if (!result.contains(chargeCandidate)) {
result.add(chargeCandidate);
}
}
return result;
}
Aggregations