Search in sources :

Example 41 with Programmatic

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();
}
Also used : Project(org.estatio.module.capex.dom.project.Project) InvoiceItem(org.estatio.module.invoice.dom.InvoiceItem) ArrayList(java.util.ArrayList) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 42 with Programmatic

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);
}
Also used : Query(javax.jdo.Query) PersistenceManager(javax.jdo.PersistenceManager) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 43 with Programmatic

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;
    }
}
Also used : Document(org.incode.module.document.dom.impl.docs.Document) QDocument(org.incode.module.document.dom.impl.docs.QDocument) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 44 with Programmatic

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;
    }
}
Also used : Document(org.incode.module.document.dom.impl.docs.Document) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 45 with Programmatic

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;
}
Also used : BankAccount(org.estatio.module.financial.dom.BankAccount) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

Programmatic (org.apache.isis.applib.annotation.Programmatic)162 Party (org.estatio.module.party.dom.Party)21 Lease (org.estatio.module.lease.dom.Lease)16 DomainObject (org.apache.isis.applib.annotation.DomainObject)11 BankAccount (org.estatio.module.financial.dom.BankAccount)11 Charge (org.estatio.module.charge.dom.Charge)10 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)10 LocalDate (org.joda.time.LocalDate)10 BigDecimal (java.math.BigDecimal)9 Bookmark (org.apache.isis.applib.services.bookmark.Bookmark)9 ApplicationException (org.apache.isis.applib.ApplicationException)8 Property (org.estatio.module.asset.dom.Property)8 CommunicationChannel (org.incode.module.communications.dom.impl.commchannel.CommunicationChannel)8 ArrayList (java.util.ArrayList)7 TranslatableString (org.apache.isis.applib.services.i18n.TranslatableString)7 InvoiceItem (org.estatio.module.invoice.dom.InvoiceItem)7 LeaseItem (org.estatio.module.lease.dom.LeaseItem)7 Inject (javax.inject.Inject)6 Unit (org.estatio.module.asset.dom.Unit)6 Document (org.incode.module.document.dom.impl.docs.Document)6