1.4.2.1.2. 后端

后端负责对附件信息的存储。应用于附件的关联关系存储在附件表中。

在action的方法中需调用附件组件的接口方法:AttachmentManager 的 create(ApplicationCategoryEnum category, Long reference, Long subReference) 为了保证多次上传和删除附件,需要在调用create之前先调用deleteByReference(Long reference)或者 deleteByReference(Long reference, Long subReference)

 /**
     * 该方法必须和 comp=type:'fileupload' 配合使用
     * @param category         所属应用分类
     * @param reference        主题Id,如协同的Id
     * @param subReference      二级主题Id,如协同的回复Id,如果当前是给协同上传附件,则该subReference 与 reference相同
     * @return 附件类型任意组合 如:"012"、"12"、"01"、"02"; 其中 0-文件附件 1-图片 2-关联文 ,排列无序
     * @see com.seeyon.ctp.common.filemanager.Constants.ATTACHMENT_TYPE_FILE
     * @see com.seeyon.v3x.common.filemanager.Constants.isUploadLocaleFile(String)
     * @throws Exception
     */
    public String create(ApplicationCategoryEnum category, Long reference, Long subReference) throws Exception;
-------------------------------
例如:
  public String create(ApplicationCategoryEnum category, Long reference, 
      Long subReference) throws Exception; 
      deleteByReference(colSummary.getId());
      String attaFlag = this.attachmentManager.create(ApplicationCategoryEnum.collaboration, 
                        colSummary.getId(), colSummary.getId()); 
      if(com.seeyon.v3x.common.filemanager.Constants.isUploadLocaleFile(attaFlag)){ 
               colSummary.setHasAttachments(true); 
       }