Exemplo n.º 1
0
  private void syncNewFiles(List<SubAwardAttachments> attachments) {
    assert attachments != null : "the attachments was null";

    for (SubAwardAttachments attachment : attachments) {
      if (SubAwardAttachmentFormBean.doesNewFileExist(attachment)) {
        final AttachmentFile newFile = AttachmentFile.createFromFormFile(attachment.getNewFile());
        // setting the sequence number to the old file sequence number
        if (attachment.getFile() != null) {
          newFile.setSequenceNumber(attachment.getFile().getSequenceNumber());
        }
        attachment.setFile(newFile);
      }
    }
  }
  protected void syncNewFiles(List<CoiDisclosureAttachment> coiDisclosureAttachments) {
    assert coiDisclosureAttachments != null : "the attachments was null";

    for (final CoiDisclosureAttachment attachment : coiDisclosureAttachments) {
      if (CoiNotesAndAttachmentsHelper.doesNewFileExist(attachment)) {
        final AttachmentFile newFile = AttachmentFile.createFromFormFile(attachment.getNewFile());
        // setting the sequence number to the old file sequence number
        if (attachment.getFile() != null) {
          newFile.setSequenceNumber(attachment.getFile().getSequenceNumber());
        }
        attachment.setFile(newFile);
        // set to null, so the subsequent post will not creating new file again
        attachment.setNewFile(null);
      }
    }
  }