本文整理汇总了Java中org.apache.isis.applib.annotation.InvokeOn.OBJECT_AND_COLLECTION属性的典型用法代码示例。如果您正苦于以下问题:Java InvokeOn.OBJECT_AND_COLLECTION属性的具体用法?Java InvokeOn.OBJECT_AND_COLLECTION怎么用?Java InvokeOn.OBJECT_AND_COLLECTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.isis.applib.annotation.InvokeOn
的用法示例。
在下文中一共展示了InvokeOn.OBJECT_AND_COLLECTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: completed
@Action(
domainEvent =CompletedDomainEvent.class,
publishing = Publishing.ENABLED,
invokeOn = InvokeOn.OBJECT_AND_COLLECTION
)
public ToDoItem completed() {
setComplete(true);
//
// remainder of method just demonstrates the use of the ActionInvocationContext service
//
@SuppressWarnings("unused")
final List<Object> allObjects = actionInvocationContext.getDomainObjects();
LOG.debug("completed: "
+ actionInvocationContext.getIndex() +
" [" + actionInvocationContext.getSize() + "]"
+ (actionInvocationContext.isFirst() ? " (first)" : "")
+ (actionInvocationContext.isLast() ? " (last)" : ""));
// if invoked as a regular action, return this object;
// otherwise return null (so go back to the list)
return actionInvocationContext.getInvokedOn() == InvokedOn.COLLECTION? null: this;
}
示例2: delete
@Action(
domainEvent = DeletedDomainEvent.class,
invokeOn = InvokeOn.OBJECT_AND_COLLECTION
)
public Object delete() {
// obtain title first, because cannot reference object after deleted
final String title = titleService.titleOf(this);
final List<ToDoItem> returnList = actionInvocationContext.getInvokedOn().isCollection() ? toDoItems.notYetComplete() : null;
// there's actually a bug in this method; shouldn't be returning the current object in the list if just deleted.
// however, ISIS-1269 transparently handles this and won't attempt to render a deleted object.
repositoryService.remove(this);
messageService.informUser(
TranslatableString.tr("Deleted {title}", "title", title), this.getClass(), "delete");
return returnList;
}
示例3: notYetCompleted
@Action(
domainEvent = NotYetCompletedDomainEvent.class,
invokeOn = InvokeOn.OBJECT_AND_COLLECTION
)
public ToDoItem notYetCompleted() {
setComplete(false);
// if invoked as a regular action, return this object;
// otherwise (if invoked as bulk), return null (so go back to the list)
return actionInvocationContext.getInvokedOn() == InvokedOn.OBJECT ? this: null;
}
示例4: delete
@Action(
semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE,
domainEvent = DeleteDomainEvent.class,
invokeOn = InvokeOn.OBJECT_AND_COLLECTION
)
@MemberOrder(sequence = "1")
public ApplicationRole delete() {
final ApplicationRole owningRole = getRole();
container.removeIfNotAlready(this);
return actionInvocationContext.getInvokedOn() == InvokedOn.OBJECT ? owningRole : null;
}
示例5: apply
@Action(
semantics = SemanticsOf.IDEMPOTENT,
invokeOn = InvokeOn.OBJECT_AND_COLLECTION
)
public ExcelModuleDemoToDoItem apply() {
ExcelModuleDemoToDoItem item = getToDoItem();
if(item == null) {
// description must be unique, so check
item = toDoItems.findByDescription(getDescription());
if(item != null) {
getContainer().warnUser("Item already exists with description '" + getDescription() + "'");
} else {
// create new item
// (since this is just a demo, haven't bothered to validate new values)
item = toDoItems.newToDo(getDescription(), getCategory(), getSubcategory(), getDueBy(), getCost());
item.setNotes(getNotes());
item.setOwnedBy(getOwnedBy());
item.setComplete(isComplete());
}
} else {
// copy over new values
// (since this is just a demo, haven't bothered to validate new values)
item.setDescription(getDescription());
item.setCategory(getCategory());
item.setSubcategory(getSubcategory());
item.setDueBy(getDueBy());
item.setCost(getCost());
item.setNotes(getNotes());
item.setOwnedBy(getOwnedBy());
item.setComplete(isComplete());
}
return actionInvocationContext.getInvokedOn().isCollection()? null: item;
}
开发者ID:isisaddons-legacy,项目名称:isis-module-excel,代码行数:33,代码来源:ExcelModuleDemoToDoItemBulkUpdateLineItem.java
示例6: delete
@Action(
invokeOn = InvokeOn.OBJECT_AND_COLLECTION
)
public List<ExcelModuleDemoToDoItem> delete() {
container.removeIfNotAlready(this);
container.informUser("Deleted " + container.titleOf(this));
// invalid to return 'this' (cannot render a deleted object)
return toDoItems.notYetComplete();
}
示例7: remove
@Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION, semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public Invoice remove() {
if (!getInvoice().isImmutableDueToState()) {
repositoryService.remove(this);
}
return getInvoice();
}
示例8: exec
@Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION, semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout(contributed = Contributed.AS_ACTION)
public void exec() {
// Can be called as bulk so have a safeguard
if (disableExec() == null) {
for (InvoiceItem item : invoice.getItems()) {
item.remove();
}
paperclipRepository.deleteIfAttachedTo(invoice, PaperclipRepository.Policy.PAPERCLIPS_AND_DOCUMENTS_IF_ORPHANED);
repositoryService.remove(invoice);
}
}
示例9: apply
@Action(
semantics = SemanticsOf.IDEMPOTENT,
invokeOn = InvokeOn.OBJECT_AND_COLLECTION,
publishing = Publishing.DISABLED
)
public KeyItem apply() {
switch (getStatus()) {
case ADDED:
KeyItem keyItem = new KeyItem();
keyItem.setKeyTable(getKeyTable());
keyItem.setUnit(getUnit());
keyItem.setValue(getKeyValue().setScale(keyTable.getPrecision(), BigDecimal.ROUND_HALF_UP));
keyItem.setSourceValue(getSourceValue().setScale(2, BigDecimal.ROUND_HALF_UP));
container.persistIfNotAlready(keyItem);
break;
case UPDATED:
getKeyItem().changeValue(this.getKeyValue().setScale(keyTable.getPrecision(), BigDecimal.ROUND_HALF_UP));
getKeyItem().setSourceValue(this.getSourceValue().setScale(2, BigDecimal.ROUND_HALF_UP));
break;
case DELETED:
String message = "KeyItem for unit " + getKeyItem().getUnit().getReference() + " deleted";
getKeyItem().deleteBudgetKeyItem();
container.informUser(message);
return null;
case NOT_FOUND:
container.informUser("KeyItem not found");
return null;
default:
break;
}
return getKeyItem();
}
示例10: calculateLegacy
@Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
@ActionLayout(named = "Calculate")
public Object calculateLegacy(
final Lease lease,
final InvoiceRunType runType,
final InvoiceCalculationSelection calculationSelection,
final LocalDate invoiceDueDate,
final LocalDate startDueDate,
final LocalDate nextDueDate) {
final List<LeaseItemType> leaseItemTypes = calculationSelection.selectedTypes();
return doCalculate(lease, runType, invoiceDueDate, startDueDate, nextDueDate, leaseItemTypes);
}
示例11: calculate
@Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
@ActionLayout(named = "Calculate")
public Object calculate(
final Lease lease,
final InvoiceRunType runType,
final List<LeaseItemType> leaseItemTypes,
final LocalDate invoiceDueDate,
final LocalDate startDueDate,
final LocalDate nextDueDate) {
return doCalculate(lease, runType, invoiceDueDate, startDueDate, nextDueDate, leaseItemTypes);
}
示例12: approve
@Action(semantics = SemanticsOf.IDEMPOTENT, invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
public LeaseTerm approve() {
if (!getStatus().isApproved()) {
setStatus(LeaseTermStatus.APPROVED);
}
return this;
}
示例13: approveAllTermsOfThisLease
@Action(restrictTo = RestrictTo.PROTOTYPING, invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
public Lease approveAllTermsOfThisLease() {
for (LeaseItem item : getItems()) {
for (LeaseTerm term : item.getTerms()) {
term.approve();
}
}
return this;
}
示例14: exec
@Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
public Object exec(
final InvoiceRunType runType,
final List<LeaseItemType> leaseItemTypes,
final LocalDate invoiceDueDate,
final LocalDate startDueDate,
final LocalDate nextDueDate) {
return invoiceServiceMenu.calculate(lease, runType, leaseItemTypes, invoiceDueDate, startDueDate, nextDueDate);
}
示例15: exec
@Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
@ActionLayout(named = "Calculate")
public Object exec(
final InvoiceRunType runType,
final InvoiceCalculationSelection calculationSelection,
final LocalDate invoiceDueDate,
final LocalDate startDueDate,
final LocalDate nextDueDate) {
return invoiceServiceMenu.calculateLegacy(lease, runType, calculationSelection, invoiceDueDate, startDueDate, nextDueDate);
}