コード例 #1
0
ファイル: TaskDataImpl.java プロジェクト: ge0ffrey/jbpm
  /**
   * Removes the Attachment specified by the attachmentId.
   *
   * @param attachmentId id of attachment to remove
   * @return removed Attachment or null if one was not found with the id
   */
  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;
  }
コード例 #2
0
 @Override
 public Attachment persistAttachment(Attachment attachment) {
   check();
   this.em.persist(attachment);
   if (this.pessimisticLocking) {
     return this.em.find(
         AttachmentImpl.class, attachment.getId(), LockModeType.PESSIMISTIC_FORCE_INCREMENT);
   }
   return attachment;
 }