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