use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.
the class DocumentTemplate_cloneWhenText method $$.
@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@ActionLayout(named = "Clone", contributed = Contributed.AS_ACTION)
public DocumentTemplate $$(@Parameter(maxLength = NameType.Meta.MAX_LEN) @ParameterLayout(named = "Name") final String name, final ApplicationTenancy applicationTenancy, @Parameter(optionality = Optionality.OPTIONAL) @ParameterLayout(named = "Date") final LocalDate date, @ParameterLayout(named = "Text", multiLine = DocumentModule.Constants.TEXT_MULTILINE) final String templateText, @ParameterLayout(named = "Content rendering strategy") final RenderingStrategy contentRenderingStrategy, @Parameter(maxLength = DocumentTemplate.NameTextType.Meta.MAX_LEN) final String nameText, @ParameterLayout(named = "Name rendering strategy") final RenderingStrategy nameRenderingStrategy, @ParameterLayout(named = "Preview only?") final boolean previewOnly) {
final DocumentType type = documentTemplate.getType();
final String mimeType = documentTemplate.getMimeType();
final String fileSuffix = documentTemplate.getFileSuffix();
final DocumentTemplate template = documentTemplateRepository.createText(type, date, applicationTenancy.getPath(), fileSuffix, previewOnly, name, mimeType, templateText, contentRenderingStrategy, nameText, nameRenderingStrategy);
final DocumentTemplate._applicable template_applicable = factoryService.mixin(DocumentTemplate._applicable.class, template);
for (Applicability applicability : documentTemplate.getAppliesTo()) {
template_applicable.applicable(applicability.getDomainClassName(), applicability.getRendererModelFactoryClassName(), applicability.getAttachmentAdvisorClassName());
}
return template;
}
use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.
the class DocumentAttachmentAdvisorForDemo method append.
private void append(final String docTypeRef, final List<DocumentType> documentTypes) {
final DocumentType documentType = documentTypeRepository.findByReference(docTypeRef);
documentTypes.add(documentType);
}
use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.
the class DocumentMenu method upload.
@Action(domainEvent = IncomingDocumentRepository.UploadDomainEvent.class, commandDtoProcessor = DeriveBlobFromReturnedDocumentArg0.class)
@MemberOrder(sequence = "3")
public Document upload(final Blob blob) {
final String name = blob.getName();
final DocumentType type = DocumentTypeData.INCOMING.findUsing(documentTypeRepository);
final ApplicationUser me = meService.me();
String atPath = me != null ? me.getAtPath() : null;
if (atPath == null) {
atPath = "/";
}
return incomingDocumentRepository.upsertAndArchive(type, atPath, name, blob);
}
use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.
the class BankAccount_attachPdfAsIbanProof method act.
@Action(semantics = SemanticsOf.IDEMPOTENT, commandDtoProcessor = DeriveBlobFromDummyPdfArg0.class)
public BankAccount act(@Parameter(fileAccept = "application/pdf") final Blob document) {
final DocumentType ibanProofDocType = DocumentTypeData.IBAN_PROOF.findUsing(documentTypeRepository);
final List<Paperclip> ibanProofPaperclips = paperclipRepository.findByAttachedToAndRoleName(bankAccount, ROLE_NAME_FOR_IBAN_PROOF);
// delete all existing paperclips for this role whose type is also not IBAN_PROOF
// (ie any incoming invoices that were automatically attached as candidate iban proofs)
final Predicate<Paperclip> hasIbanProofDocType = paperclip -> Objects.equals(ibanProofDocType, paperclip.getDocument().getType());
final Predicate<Paperclip> doesNotHaveIbanProofDocType = hasIbanProofDocType.negate();
ibanProofPaperclips.stream().filter(doesNotHaveIbanProofDocType).forEach(paperclip -> paperclipRepository.delete(paperclip));
final String name = document.getName();
documentService.createAndAttachDocumentForBlob(ibanProofDocType, bankAccount.getAtPath(), name, document, ROLE_NAME_FOR_IBAN_PROOF, bankAccount);
return bankAccount;
}
use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.
the class Invoice_DocumentManagement_IntegTest method findDocumentTemplateFor.
DocumentTemplate findDocumentTemplateFor(final DocumentTypeData documentTypeData, final Invoice invoice) {
final DocumentType documentType = documentTypeData.findUsing(documentTypeRepository);
assertThat(documentType).isNotNull();
DocumentTemplate documentTemplate = documentTemplateRepository.findFirstByTypeAndApplicableToAtPath(documentType, invoice.getApplicationTenancyPath());
assertThat(documentType).isNotNull();
return documentTemplate;
}
Aggregations