Search in sources :

Example 1 with BankAccountVerificationStateTransition

use of org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransition in project estatio by estatio.

the class EnforceTaskAssignmentPolicySubscriber_applyPolicy_Test method setUp.

@Before
public void setUp() throws Exception {
    subscriber = new EnforceTaskAssignmentPolicySubscriber();
    subscriber.stateTransitionService = mockStateTransitionService;
    subscriber.personRepository = mockPersonRepository;
    subscriber.metaModelService3 = mockMetaModelService3;
    domainObject = new BankAccount();
    stateTransitionClass = BankAccountVerificationStateTransition.class;
    pendingTransition = new BankAccountVerificationStateTransition();
    personTaskAssignedTo = new Person();
    personTaskAssignedTo.setReference("JBLOGGS");
    roleTaskAssignedTo = new PartyRoleType();
    roleTaskAssignedTo.setKey("Treasurer");
    pendingTask = new Task(roleTaskAssignedTo, personTaskAssignedTo, "some description", LocalDateTime.now(), // objectType of transition class
    "bankAccount.BankAccountVerificationStateTransition");
    pendingTransition.setTask(pendingTask);
    personForMe = new Person();
    personForMe.getRoles().add(new PartyRole(personForMe, roleTaskAssignedTo));
    assertThat(pendingTransition.getTask()).isNotNull();
    assertThat(personForMe.getRoles()).isNotEmpty();
    assertThat(Lists.newArrayList(personForMe.getRoles()).stream().map(PartyRole::getRoleType)).contains(roleTaskAssignedTo);
}
Also used : PartyRole(org.estatio.module.party.dom.role.PartyRole) Task(org.estatio.module.capex.dom.task.Task) PartyRoleType(org.estatio.module.party.dom.role.PartyRoleType) BankAccount(org.estatio.module.financial.dom.BankAccount) Person(org.estatio.module.party.dom.Person) BankAccountVerificationStateTransition(org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransition) Before(org.junit.Before)

Example 2 with BankAccountVerificationStateTransition

use of org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransition in project estatio by estatio.

the class TaskIncomingDocumentPdfService method doLookupPdfFor.

private Blob doLookupPdfFor(final Task task) {
    StateTransition<?, ?, ?, ?> stateTransition = stateTransitionService.findFor(task);
    if (stateTransition == null) {
        return null;
    }
    if (stateTransition instanceof IncomingDocumentCategorisationStateTransition) {
        IncomingDocumentCategorisationStateTransition idcst = (IncomingDocumentCategorisationStateTransition) stateTransition;
        final Document document = idcst.getDocument();
        if (document == null) {
            return null;
        }
        if (!Objects.equals(document.getMimeType(), "application/pdf")) {
            return null;
        }
        return document.getBlob();
    }
    if (stateTransition instanceof OrderApprovalStateTransition) {
        final OrderApprovalStateTransition oast = (OrderApprovalStateTransition) stateTransition;
        final Order order = oast.getOrdr();
        final Optional<Document> documentIfAny = lookupAttachedPdfService.lookupOrderPdfFrom(order);
        return documentIfAny.map(DocumentAbstract::getBlob).orElse(null);
    }
    if (stateTransition instanceof IncomingInvoiceApprovalStateTransition) {
        final IncomingInvoiceApprovalStateTransition iiast = (IncomingInvoiceApprovalStateTransition) stateTransition;
        final IncomingInvoice invoice = iiast.getInvoice();
        final Optional<Document> documentIfAny = lookupAttachedPdfService.lookupIncomingInvoicePdfFrom(invoice);
        return documentIfAny.map(DocumentAbstract::getBlob).orElse(null);
    }
    if (stateTransition instanceof BankAccountVerificationStateTransition) {
        final BankAccountVerificationStateTransition bavst = (BankAccountVerificationStateTransition) stateTransition;
        final BankAccount bankAccount = bavst.getBankAccount();
        final Optional<Document> documentIfAny = lookupAttachedPdfService.lookupIbanProofPdfFrom(bankAccount);
        return documentIfAny.map(DocumentAbstract::getBlob).orElse(null);
    }
    return null;
}
Also used : Order(org.estatio.module.capex.dom.order.Order) IncomingInvoiceApprovalStateTransition(org.estatio.module.capex.dom.invoice.approval.IncomingInvoiceApprovalStateTransition) IncomingDocumentCategorisationStateTransition(org.estatio.module.capex.dom.documents.categorisation.IncomingDocumentCategorisationStateTransition) IncomingInvoice(org.estatio.module.capex.dom.invoice.IncomingInvoice) BankAccount(org.estatio.module.financial.dom.BankAccount) Document(org.incode.module.document.dom.impl.docs.Document) OrderApprovalStateTransition(org.estatio.module.capex.dom.order.approval.OrderApprovalStateTransition) BankAccountVerificationStateTransition(org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransition)

Aggregations

BankAccountVerificationStateTransition (org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransition)2 BankAccount (org.estatio.module.financial.dom.BankAccount)2 IncomingDocumentCategorisationStateTransition (org.estatio.module.capex.dom.documents.categorisation.IncomingDocumentCategorisationStateTransition)1 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)1 IncomingInvoiceApprovalStateTransition (org.estatio.module.capex.dom.invoice.approval.IncomingInvoiceApprovalStateTransition)1 Order (org.estatio.module.capex.dom.order.Order)1 OrderApprovalStateTransition (org.estatio.module.capex.dom.order.approval.OrderApprovalStateTransition)1 Task (org.estatio.module.capex.dom.task.Task)1 Person (org.estatio.module.party.dom.Person)1 PartyRole (org.estatio.module.party.dom.role.PartyRole)1 PartyRoleType (org.estatio.module.party.dom.role.PartyRoleType)1 Document (org.incode.module.document.dom.impl.docs.Document)1 Before (org.junit.Before)1