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);
}
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;
}
Aggregations