use of org.apache.isis.applib.annotation.DomainObject 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.annotation.DomainObject 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.annotation.DomainObject in project estatio by estatio.
the class DocumentTemplate method createDocumentUsingRendererModel.
// endregion
// region > createDocument (programmatic)
@Programmatic
public Document createDocumentUsingRendererModel(final Object domainObject) {
final Object rendererModel = newRendererModel(domainObject);
final String documentName = determineDocumentName(rendererModel);
return createDocument(documentName);
}
use of org.apache.isis.applib.annotation.DomainObject 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;
}
use of org.apache.isis.applib.annotation.DomainObject in project estatio by estatio.
the class Document method render.
// endregion
// region > render (programmatic)
// so can invoke via BackgroundService
@Action(hidden = Where.EVERYWHERE)
public void render(final DocumentTemplate documentTemplate, final Object domainObject) {
final Object rendererModel = documentTemplate.newRendererModel(domainObject);
documentTemplate.renderContent(this, rendererModel);
}
Aggregations