当前位置: 首页>>代码示例>>Java>>正文


Java InvokeOn.OBJECT_AND_COLLECTION属性代码示例

本文整理汇总了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;
}
 
开发者ID:isisaddons,项目名称:isis-app-todoapp,代码行数:24,代码来源:ToDoItem.java

示例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;
}
 
开发者ID:isisaddons,项目名称:isis-app-todoapp,代码行数:20,代码来源:ToDoItem.java

示例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;
}
 
开发者ID:isisaddons,项目名称:isis-app-todoapp,代码行数:11,代码来源:ToDoItem.java

示例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;
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:11,代码来源:ApplicationPermission.java

示例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(); 
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-excel,代码行数:9,代码来源:ExcelModuleDemoToDoItem.java

示例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();
}
 
开发者ID:estatio,项目名称:estatio,代码行数:7,代码来源:InvoiceItem.java

示例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);
    }
}
 
开发者ID:estatio,项目名称:estatio,代码行数:12,代码来源:Invoice.java

示例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();
}
 
开发者ID:estatio,项目名称:estatio,代码行数:40,代码来源:KeyItemImportExportLineItem.java

示例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);
}
 
开发者ID:estatio,项目名称:estatio,代码行数:12,代码来源:InvoiceServiceMenu.java

示例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);
}
 
开发者ID:estatio,项目名称:estatio,代码行数:11,代码来源:InvoiceServiceMenu.java

示例12: approve

@Action(semantics = SemanticsOf.IDEMPOTENT, invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
public LeaseTerm approve() {
    if (!getStatus().isApproved()) {
        setStatus(LeaseTermStatus.APPROVED);
    }
    return this;
}
 
开发者ID:estatio,项目名称:estatio,代码行数:7,代码来源:LeaseTerm.java

示例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;
}
 
开发者ID:estatio,项目名称:estatio,代码行数:9,代码来源:Lease.java

示例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);
}
 
开发者ID:estatio,项目名称:estatio,代码行数:9,代码来源:Lease_calculate.java

示例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);
}
 
开发者ID:estatio,项目名称:estatio,代码行数:10,代码来源:Lease_calculateLegacy.java


注:本文中的org.apache.isis.applib.annotation.InvokeOn.OBJECT_AND_COLLECTION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。