use of org.incode.module.document.dom.impl.applicability.RendererModelFactory 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.incode.module.document.dom.impl.applicability.RendererModelFactory in project estatio by estatio.
the class DocumentTemplate method newRendererModel.
@Programmatic
public Object newRendererModel(final Object domainObject) {
final RendererModelFactory rendererModelFactory = newRendererModelFactory(domainObject);
if (rendererModelFactory == null) {
throw new IllegalStateException(String.format("For domain template %s, could not locate Applicability for domain object: %s", getName(), domainObject.getClass().getName()));
}
final Object rendererModel = rendererModelFactory.newRendererModel(this, domainObject);
serviceRegistry2.injectServicesInto(rendererModel);
return rendererModel;
}
Aggregations