use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class PaymentBatchApprovalStateSubscriber method on.
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(PaymentBatch.ObjectPersistedEvent ev) {
// nb: note that the batch at this stage has no lines attached to it,
// so there is a limit as to what we can safely do.
// however, it *is* ok to just create the state chart for the domain object.
final PaymentBatch paymentBatch = ev.getSource();
PaymentBatchApprovalState approvalState = paymentBatch.getApprovalState();
if (approvalState == PaymentBatchApprovalStateTransitionType.INSTANTIATE.getToState()) {
// ie was set in the persisting callback
stateTransitionService.trigger(paymentBatch, PaymentBatchApprovalStateTransitionType.INSTANTIATE, null, null);
}
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class LeaseInvoicingSettingsService method updateEpochDate.
/**
* @see LeaseInvoicingSettingKey#epochDate
*/
@Programmatic
public void updateEpochDate(final LocalDate newEpochDate) {
// getApplicationSettings().installDefaultsIfRequired();
final ApplicationSettingForEstatio setting = (ApplicationSettingForEstatio) applicationSettingsService.find(LeaseInvoicingSettingKey.epochDate);
if (setting != null) {
if (newEpochDate != null) {
setting.updateAsLocalDate(newEpochDate);
} else {
setting.delete();
}
} else {
if (newEpochDate != null) {
applicationSettingsService.newLocalDate(ApplicationSettingCreator.Helper.getKey(LeaseInvoicingSettingKey.epochDate), "Cutover date to Estatio", newEpochDate);
}
// else no-op
}
cachedEpochDate = null;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class InvoiceAttributesVM method getChargeDescriptions.
@Programmatic
public String getChargeDescriptions() {
final StringBuilder buf = new StringBuilder();
SortedSet<InvoiceItem> invoiceItems = invoice.getItems();
Set<String> descriptions = FluentIterable.from(invoiceItems).transform(x -> {
Charge charge = x.getCharge();
return charge != null ? charge.getDescription() : null;
}).filter(Objects::nonNull).toSortedSet(Ordering.natural());
final List<String> items = Lists.newArrayList(descriptions);
final int numItems = items.size();
for (int i = 0; i < numItems; i++) {
buf.append(items.get(i));
if (i == numItems - 2) {
buf.append(" e ");
} else if (i != numItems - 1) {
buf.append(", ");
}
}
return buf.toString();
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class InvoiceAttributesVM method getLeasePropertyName.
@Programmatic
public String getLeasePropertyName() {
Lease lease = invoice.getLease();
if (lease == null) {
return null;
}
Property property = lease.getProperty();
if (property == null) {
return null;
}
return property.getName();
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class PartySubscriptions method on.
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(final Party.FixEvent ev) {
switch(ev.getEventPhase()) {
case EXECUTING:
Party sourceParty = (Party) ev.getSource();
final List<AgreementRole> roles = agreementRoleRepository.findByParty(sourceParty);
for (AgreementRole role : roles) {
sourceParty.addRole(role.getType());
}
break;
default:
break;
}
}
Aggregations