コード例 #1
0
  public DLFileEntry addFile(
      String processUUID, String title, String description, File file, String[] tags)
      throws PortalException, SystemException {
    DLFileEntry fileEntry = null;
    try {
      fileEntry =
          fileService.addFileEntry(
              currentUser.getUserId(),
              processBaseGroup.getGroupId(),
              getFolder(processUUID).getFolderId(),
              file.getName(),
              title,
              description,
              null,
              null,
              file,
              new ServiceContext());
    } catch (DuplicateFileException ex) {
      //                fileEnrty = fileService.updateFileEntry(currentUser.getUserId(),
      //                        folder.getFolderId(),
      //                        "PASSPORT.pdf",
      //                        "Паспорт",
      //                        "Это паспорт",
      //                        null,
      //                        new File("C:\\Users\\mgubaidullin\\Desktop\\docs\\PASSPORT.pdf"),
      //                        new ServiceContext());
    }

    //        fileService.updateTagsAsset(currentUser.getUserId(),
    //                fileEnrty,
    //                new java.lang.String[]{"PROCESSBASE"},
    //                tags);
    return fileEntry;
  }
コード例 #2
0
 public DLFileEntry addFile(
     String processUUID,
     String title,
     String description,
     String fileName,
     byte[] body,
     String[] tags)
     throws PortalException, SystemException {
   DLFileEntry fileEntry = null;
   try {
     fileEntry =
         fileService.addFileEntry(
             currentUser.getUserId(),
             processBaseGroup.getGroupId(),
             getFolder(processUUID).getFolderId(),
             fileName,
             title,
             description,
             null,
             null,
             body,
             new ServiceContext());
   } catch (DuplicateFileException ex) {
   }
   return fileEntry;
 }
コード例 #3
0
 public DLFileEntry updateFileEntry(DLFileEntry file) {
   try {
     return fileService.updateDLFileEntry(file);
   } catch (SystemException ex) {
     ex.printStackTrace();
     return file;
   }
 }
コード例 #4
0
 public DLFileEntry getFileEntry(long fileId) {
   try {
     return fileService.getDLFileEntry(fileId);
   } catch (PortalException ex) {
     ex.printStackTrace();
     return null;
   } catch (SystemException ex) {
     ex.printStackTrace();
     return null;
   }
 }
コード例 #5
0
 public DLFileEntry getFileEntry(String processUUID, String title) {
   try {
     return fileService.getFileEntryByTitle(
         processBaseGroup.getGroupId(), getFolder(processUUID).getFolderId(), title);
   } catch (PortalException ex) {
     ex.printStackTrace();
     return null;
   } catch (SystemException ex) {
     ex.printStackTrace();
     return null;
   }
 }
コード例 #6
0
 public byte[] getFileBody(String processUUID, long fileId) {
   byte[] result = null;
   try {
     DLFileEntry file = getFileEntry(fileId);
     result = new byte[Long.valueOf(file.getSize()).intValue()];
     InputStream is =
         fileService.getFileAsStream(
             currentUser.getCompanyId(),
             currentUser.getUserId(),
             processBaseGroup.getGroupId(),
             getFolder(processUUID).getFolderId(),
             file.getName());
     is.read(result);
   } catch (PortalException ex) {
     ex.printStackTrace();
   } catch (SystemException ex) {
     ex.printStackTrace();
   } catch (IOException ex) {
     ex.printStackTrace();
   }
   return result;
 }
コード例 #7
0
 public void deleteFile(long fileId) throws SystemException, PortalException {
   fileService.deleteDLFileEntry(fileId);
 }
コード例 #8
0
 public List<DLFileEntry> getProcessFiles(String processUUID) throws SystemException {
   return fileService.getFileEntries(
       processBaseGroup.getGroupId(), getFolder(processUUID).getFolderId());
 }