Ejemplo n.º 1
0
 public long getVersionCount(DocumentName documentName) {
   try {
     PDocument pdocument = getpDocument(documentName);
     return pdocument.getVersionSupport().getVersionInfo().listVersions().size();
   } catch (MDSAccessException e) {
     return 0;
   }
 }
Ejemplo n.º 2
0
 public Date getLastModified(DocumentName documentName) {
   try {
     PDocument pdocument = getpDocument(documentName);
     PDocumentVersionSupport versionSupport = pdocument.getVersionSupport();
     VersionInfo versionInfo = versionSupport.getVersionInfo();
     Version version = versionInfo.getVersion();
     return new Date(version.getCreationTime());
   } catch (MDSAccessException e) {
     return new Date();
   }
 }
Ejemplo n.º 3
0
 public HashMap<Long, Date> getVersions(DocumentName documentName) {
   HashMap<Long, Date> hashMap = new HashMap<Long, Date>();
   try {
     PDocument pdocument = getpDocument(documentName);
     for (Version v : pdocument.getVersionSupport().getVersionInfo().listVersions()) {
       hashMap.put(v.getVersionNumber(), new Date(v.getCreationTime()));
     }
   } catch (MDSAccessException e) {
     throw new IllegalArgumentException("Could not list Versions !" + e.getMessage());
   }
   return hashMap;
 }
Ejemplo n.º 4
0
 public String readFile(DocumentName documentName) {
   try {
     PDocument pdocument = getPDocument(documentName, (long) 0);
     InputSource source = pdocument.read();
     Reader reader = source.getCharacterStream();
     if (reader != null) {
       return read(reader);
     } else {
       InputStream inputStream = source.getByteStream();
       return stream(inputStream);
     }
   } catch (MDSIOException e) {
     throw new IllegalArgumentException("Could not connect to MDS, check login data", e);
   } catch (IOException e) {
     throw new IllegalArgumentException("Could not read ", e);
   }
 }