Ejemplo n.º 1
0
 /**
  * Checks if a document exists in the local documents cache and if so, opens the document from the
  * cache, otherwise loads the document from the DigitalArchive service.
  *
  * @param Id The id of the document to open
  * @param fileName The name of the file. The file name should be consistent with {@linkplain
  *     #getFileName(java.lang.String, int, java.lang.String) getFileName}
  * @see #openDocument(java.lang.String)
  */
 public static void openDocument(String Id, String fileName) {
   if (fileName == null || !FileUtility.isCached(fileName)) {
     openDocument(Id);
   } else {
     FileUtility.openFile(fileName);
   }
 }
Ejemplo n.º 2
0
 /**
  * Opens document from the digital archive. This method will not check the local documents cache
  * before retrieving the document.
  *
  * @param Id The ID of the document to open.
  * @see #openDocument(java.lang.String, java.lang.String)
  */
 public static void openDocument(String Id) {
   if (Id != null) {
     DocumentBinaryTO documentBinary = WSManager.getInstance().getDigitalArchive().getDocument(Id);
     if (documentBinary != null) {
       FileUtility.openFile(documentBinary.getFileName());
     } else {
       throw new SOLAException(ClientMessage.SOURCE_NO_DOCUMENT);
     }
   }
 }
Ejemplo n.º 3
0
 /**
  * Creates digital archive document from the file in the local folder.
  *
  * @param file File object in the local folder.
  */
 public static DocumentBean createDocumentFromLocalFile(File file) {
   if (file != null && file.getName().contains(".")) {
     DocumentBinaryTO documentBinary = new DocumentBinaryTO();
     documentBinary.setDescription(file.getName());
     documentBinary.setFileName(file.getAbsolutePath());
     //            documentBinary.setBody(FileUtility.getFileBinary(file.getAbsolutePath()));
     documentBinary.setExtension(FileUtility.getFileExtension(file.getName()));
     DocumentTO document =
         WSManager.getInstance().getDigitalArchive().createDocument(documentBinary);
     DocumentBean documentBean =
         TypeConverters.TransferObjectToBean(document, DocumentBean.class, null);
     return documentBean;
   }
   return null;
 }
Ejemplo n.º 4
0
 /**
  * Returns a versioned file name for the document.
  *
  * @see #getFileName(java.lang.String, int, java.lang.String)
  */
 public String getFileName() {
   return FileUtility.generateFileName(getNr(), getRowVersion(), getExtension());
 }