@Programmatic public void delete(final Paperclip paperclip) { repositoryService.remove(paperclip); }
@Programmatic public void delete(final Paperclip paperclip) { repositoryService.remove(paperclip); }
@Action( domainEvent = DeleteDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE ) @ActionLayout( cssClassFa = "trash", cssClass = "btn-warning" ) public SettingAbstractJdo delete() { repositoryService.remove(this); messageService.informUser("Setting deleted"); return null; }
@Programmatic public void deleteIfAttachedTo(final Object domainObject, final Policy policy) { final List<Paperclip> paperclips = findByAttachedTo(domainObject); for (Paperclip paperclip : paperclips) { delete(paperclip); if(policy == Policy.PAPERCLIPS_AND_DOCUMENTS_IF_ORPHANED) { final DocumentAbstract document = paperclip.getDocument(); if(orphaned(document, domainObject)) { repositoryService.remove(document); } } } }
@Programmatic public void deleteIfAttachedTo(final Object domainObject, final Policy policy) { final List<Paperclip> paperclips = findByAttachedTo(domainObject); for (Paperclip paperclip : paperclips) { delete(paperclip); if(policy == Policy.PAPERCLIPS_AND_DOCUMENTS_IF_ORPHANED) { final DocumentAbstract document = paperclip.getDocument(); if(orphaned(document, domainObject)) { repositoryService.remove(document); } } } }
@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; } //endregion