use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class DocumentTemplate method withFileSuffix.
// endregion
// region > withFileSuffix (programmatic)
@Programmatic
public String withFileSuffix(final String documentName) {
final String suffix = getFileSuffix();
final int lastPeriod = suffix.lastIndexOf(".");
final String suffixNoDot = suffix.substring(lastPeriod + 1);
final String suffixWithDot = "." + suffixNoDot;
if (documentName.endsWith(suffixWithDot)) {
return trim(documentName, NameType.Meta.MAX_LEN);
} else {
return StringUtils.stripEnd(trim(documentName, NameType.Meta.MAX_LEN - suffixWithDot.length()), ".") + suffixWithDot;
}
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class DocumentTemplate method newAttachmentAdvice.
@Programmatic
public List<AttachmentAdvisor.PaperclipSpec> newAttachmentAdvice(final Document document, final Object domainObject) {
final AttachmentAdvisor attachmentAdvisor = newAttachmentAdvisor(domainObject);
if (attachmentAdvisor == null) {
throw new IllegalStateException(String.format("For domain template %s, could not locate Applicability for domain object: %s", getName(), domainObject.getClass().getName()));
}
final List<AttachmentAdvisor.PaperclipSpec> paperclipSpecs = attachmentAdvisor.advise(this, domainObject, document);
return paperclipSpecs;
}
use of org.apache.isis.applib.annotation.Programmatic 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.Programmatic in project estatio by estatio.
the class RenderingStrategy method newRenderer.
// endregion
// region > newRenderer (programmatic)
@Programmatic
public Renderer newRenderer() {
final Renderer renderer = (Renderer) classService.instantiate(getRendererClassName());
serviceRegistry2.injectServicesInto(renderer);
return renderer;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class RenderingStrategyRepository method create.
@Programmatic
public RenderingStrategy create(final String reference, final String name, final DocumentNature inputNature, final DocumentNature outputNature, final Class<? extends Renderer> rendererClass) {
final RenderingStrategy renderingStrategy = new RenderingStrategy(reference, name, inputNature, outputNature, rendererClass);
repositoryService.persist(renderingStrategy);
return renderingStrategy;
}
Aggregations