private void canDeleteUpdateAttachments() { List<CoiDisclosureAttachment> attachments = getCoiDisclosure().getCoiDisclosureAttachments(); for (int i = 0; i < attachments.size(); i++) { CoiDisclosureTask task = new CoiDisclosureDeleteUpdateAttachmentTask( TaskName.DELETE_UPDATE_ATTACHMENT, getCoiDisclosure(), attachments.get(i)); canDeleteUpdateAttachment.put( i, getTaskAuthorizationService().isAuthorized(getUserIdentifier(), task)); } }
private void canDeleteUpdateNotes() { List<CoiDisclosureNotepad> notes = getCoiDisclosure().getCoiDisclosureNotepads(); for (int i = 0; i < notes.size(); i++) { CoiDisclosureTask task = new CoiDisclosureDeleteUpdateNoteTask( TaskName.DELETE_UPDATE_NOTE, getCoiDisclosure(), notes.get(i)); canDeleteUpdateNote.put( i, getTaskAuthorizationService().isAuthorized(getUserIdentifier(), task)); } }
protected <T extends CoiDisclosureAttachment> boolean deleteExistingAttachment( final int index, final List<T> attachments) { if (!CollectionUtils.validIndexForList(index, attachments)) { return false; } CoiDisclosureAttachment attachment = attachments.get(index); attachments.remove(attachment); return true; }