Search in sources :

Example 6 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class StateTransitionRepositoryGeneric method create.

@Programmatic
public <DO, ST extends StateTransitionAbstract<DO, ST, STT, S>, STT extends StateTransitionType<DO, ST, STT, S>, S extends State<S>> ST create(final DO domainObject, final STT transitionType, final S fromState, final IPartyRoleType taskAssignToIfAny, final Person personToAssignToIfAny, final String taskDescription, final Class<ST> stateTransitionClass) {
    final Task taskIfAny = createTaskIfRequired(taskAssignToIfAny, personToAssignToIfAny, taskDescription, stateTransitionClass, domainObject);
    final ST stateTransition = createTransition(domainObject, transitionType, fromState, taskIfAny, stateTransitionClass);
    return stateTransition;
}
Also used : Task(org.estatio.module.capex.dom.task.Task) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 7 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class StateTransitionRepositoryGeneric method deleteFor.

@Programmatic
public <DO, ST extends StateTransitionAbstract<DO, ST, STT, S>, STT extends StateTransitionType<DO, ST, STT, S>, S extends State<S>> void deleteFor(final DO domainObject, final Class<ST> stateTransitionClass) {
    final List<ST> stateTransitions = findByDomainObject(domainObject, stateTransitionClass);
    for (ST transition : stateTransitions) {
        Task taskToRemove = null;
        if (transition.getTask() != null) {
            taskToRemove = transition.getTask();
        }
        repositoryService.removeAndFlush(transition);
        if (taskToRemove != null) {
            repositoryService.removeAndFlush(taskToRemove);
        }
    }
    transactionService.flushTransaction();
}
Also used : Task(org.estatio.module.capex.dom.task.Task) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 8 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class PaymentBatch method addLineIfRequired.

@Programmatic
public void addLineIfRequired(final IncomingInvoice incomingInvoice) {
    if (!getApprovalState().isModifiable()) {
        // so this is just belt-n-braces
        return;
    }
    Optional<PaymentLine> lineIfAny = lineIfAnyFor(incomingInvoice);
    if (lineIfAny.isPresent()) {
        return;
    }
    final int sequenceToUse = findFreeSequence();
    BigDecimal transferAmount = coalesce(incomingInvoice.getGrossAmount(), BigDecimal.ZERO);
    final String remittanceInformation = incomingInvoice.getInvoiceNumber();
    final PaymentLine line = new PaymentLine(this, sequenceToUse, incomingInvoice, transferAmount, remittanceInformation);
    serviceRegistry2.injectServicesInto(lineIfAny);
    getLines().add(line);
}
Also used : BigDecimal(java.math.BigDecimal) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 9 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class TaskRepository method findIncompleteForMyRolesAndUnassigned.

/**
 * Those tasks which are assigned to no-one, but for which I have the (party) roles to perform.
 */
@Programmatic
public List<Task> findIncompleteForMyRolesAndUnassigned() {
    final Person meAsPerson = meAsPerson();
    if (meAsPerson == null) {
        return Lists.newArrayList();
    }
    final List<PartyRoleType> myRoleTypes = partyRoleTypesFor(meAsPerson);
    return findIncompleteByUnassignedForRoles(myRoleTypes);
}
Also used : PartyRoleType(org.estatio.module.party.dom.role.PartyRoleType) Person(org.estatio.module.party.dom.Person) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 10 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class TaskRepository method findIncompleteForMeAndCreatedOnAfter.

/**
 * Incomplete, assigned explicitly to me, AND ALSO any tasks not assigned to anyone but for which
 * I have the (party) roles to perform them (so should be part of "my tasks") after {@param createdOn}
 * @param createdOn
 * @return
 */
@Programmatic
public List<Task> findIncompleteForMeAndCreatedOnAfter(final LocalDateTime createdOn) {
    final Person meAsPerson = meAsPerson();
    if (meAsPerson == null) {
        return Lists.newArrayList();
    }
    final List<Task> tasks = findIncompleteForAndCreatedOnAfter(meAsPerson, createdOn);
    final List<Task> myRolesTasksUnassigned = findIncompleteForMyRolesAndUnassignedAndCreatedOnAfter(createdOn);
    tasks.addAll(myRolesTasksUnassigned);
    tasks.sort(Ordering.natural().nullsLast().onResultOf(Task::getCreatedOn));
    return tasks;
}
Also used : Person(org.estatio.module.party.dom.Person) 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