public Attachment removeAttachment ( final long attachmentId ) { Attachment removedAttachment = null ; if ( attachments != null ) { for ( int index = attachments . size ( ) - 1 ; index >= 0 ; -- index ) { Attachment currentAttachment = attachments . get ( index ) ; if ( currentAttachment . getId ( ) == attachmentId ) { removedAttachment = attachments . remove ( index ) ; break ; } } } return removedAttachment ; }
Removes the Attachment specified by the attachmentId .