use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class IncomingInvoice method getProjectSummary.
@Programmatic
public String getProjectSummary() {
List<Project> distinctProjects = new ArrayList<>();
for (InvoiceItem item : getItems()) {
IncomingInvoiceItem iitem = (IncomingInvoiceItem) item;
if (iitem.getProject() != null && !distinctProjects.contains(iitem.getProject())) {
distinctProjects.add(iitem.getProject());
}
}
StringBuffer summary = new StringBuffer();
for (Project project : distinctProjects) {
if (summary.length() > 0) {
summary.append(" | ");
}
summary.append(project.getName());
}
return summary.toString();
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class IncomingInvoiceItemRepository method findDistinctReportDates.
@Programmatic
public List<LocalDate> findDistinctReportDates() {
final PersistenceManager pm = isisJdoSupport.getJdoPersistenceManager();
final Query query = pm.newQuery(IncomingInvoiceItem.class);
query.setResultClass(LocalDate.class);
query.setResult("distinct reportedDate");
query.setOrdering("reportedDate descending");
return executeListAndClose(query);
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class IncomingDocumentRepository method upsertAndArchive.
@Programmatic
public Document upsertAndArchive(final DocumentType type, final String atPath, final String name, final Blob blob) {
synchronized (this) {
Document document = null;
final List<Document> incomingDocumentsWithSameName = findAllIncomingDocumentsByName(name);
if (incomingDocumentsWithSameName.size() > 0) {
document = incomingDocumentsWithSameName.get(0);
}
if (document != null) {
if (Arrays.equals(document.getBlobBytes(), blob.getBytes())) {
return document;
}
// else...
String prefix = "arch-".concat(clockService.nowAsLocalDateTime().toString("yyyy-MM-dd-HH-mm-ss")).concat("-");
String archivedName = prefix.concat(document.getName());
Document archivedDocument = documentService.createForBlob(document.getType(), document.getAtPath(), archivedName, document.getBlob());
// update blobbytes of document
document.setBlobBytes(blob.getBytes());
// attach document to archived document
paperclipRepository.attach(document, "", archivedDocument);
} else {
document = documentService.createForBlob(type, atPath, name, blob);
}
return document;
}
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class IncomingDocumentCategorisationStateSubscriber method toInstantiateWhen.
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void toInstantiateWhen(IncomingDocumentRepository.UploadDomainEvent ev) {
switch(ev.getEventPhase()) {
case EXECUTED:
final Document document = (Document) ev.getReturnValue();
stateTransitionService.trigger(document, IncomingDocumentCategorisationStateTransitionType.INSTANTIATE, null, null);
break;
}
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class BankAccountVerificationChecker method isBankAccountVerifiedFor.
@Programmatic
public boolean isBankAccountVerifiedFor(final IncomingInvoice incomingInvoice) {
final BankAccount bankAccount = incomingInvoice.getBankAccount();
BankAccountVerificationState state = stateTransitionService.currentStateOf(bankAccount, BankAccountVerificationStateTransition.class);
return state == BankAccountVerificationState.VERIFIED;
}
Aggregations