org.jmonks.dms.versioncontrol.api
Interface Repository

All Known Implementing Classes:
DefaultRepository

public interface Repository

This class provides the interface to the repository.

Author:
Suresh Pragada

Method Summary
 boolean cleanupRepository()
          This method helps to cleanup the deleted entries from the repository.
 DirectoryEntry createDirectoryEntry(java.lang.String directoryName)
          Let users create a directory entry in repository.
 FileEntry createFileEntry(java.lang.String fileName, java.lang.String authorName, java.lang.String description, java.util.Date versionDate, java.io.InputStream inputStream)
          Let users create a file entry in repository.
 java.util.List getAllEntries()
          Gets all repository entries available right under the repository.
 java.util.Map getCompleteDirectoryEntryList()
          It returns all the directory entries in the repository as a map which holds the entryID as key and entryName as the value.
 java.lang.String getEntryNameToShowInUI(RepositoryEntry entry)
          It returns the string representation of the input entry to be shown in UI.
 RepositoryEntry getRepositoryEntry(long entryID)
          Gets the requested Repository Entry in the repository.
 boolean moveEntry(RepositoryEntry sourceEntry, RepositoryEntry targetEntry)
          Moves the contents of sourceEntry to the targetEntry.
 

Method Detail

getRepositoryEntry

public RepositoryEntry getRepositoryEntry(long entryID)
Gets the requested Repository Entry in the repository. This entry can exist at any level in repository.

Parameters:
entryID - ID which identifies the entry.
Returns:
Returns the list of RepositoryEntry objects. If not exists, it returns the list of size 0.

getAllEntries

public java.util.List getAllEntries()
Gets all repository entries available right under the repository.

Returns:
Returns the list of RepositoryEntry objects. If not exists, it returns the list of size 0.

createDirectoryEntry

public DirectoryEntry createDirectoryEntry(java.lang.String directoryName)
Let users create a directory entry in repository.

Parameters:
directoryName - Name with which the directory entry needs to be created.
Returns:
Returns newly created Directory Entry.

createFileEntry

public FileEntry createFileEntry(java.lang.String fileName,
                                 java.lang.String authorName,
                                 java.lang.String description,
                                 java.util.Date versionDate,
                                 java.io.InputStream inputStream)
Let users create a file entry in repository.

Parameters:
fileName - Entry name with which the file entry needs to be created.
authorName - Author name to be stored with meta info of the first version of the file.
description - Description to be stored with meta info of the first version of the file.
versionDate - Version Date to be stored with meta info of the first version of the file.
inputStream - InputStream of the information to be checked-in as the first version of the file.
Returns:
Returns newly created File Entry.

cleanupRepository

public boolean cleanupRepository()
This method helps to cleanup the deleted entries from the repository. This should look for the configuration property "dms.delete.interval" in application.properties file and remove the entries from repository which are deleted and exceeded that time period.

Returns:
boolean Returns true, if the cleanup happend smoothly, otherwise, false.

moveEntry

public boolean moveEntry(RepositoryEntry sourceEntry,
                         RepositoryEntry targetEntry)
                  throws java.lang.IllegalArgumentException
Moves the contents of sourceEntry to the targetEntry. The targetEntry should be directory entry. It it is not a directory entry, IllegalArgumentException will be thrown.

Parameters:
sourceEntry - RepositoryEntry that needs to be moved.
targetEntry - RepositoryEntry where the source needs to be moved.
Returns:
Return true, if it could move the sourceEntry to targetEntry, false otherwise.
Throws:
java.lang.IllegalArgumentException - if the targetEntry is not a directory Entry.

getCompleteDirectoryEntryList

public java.util.Map getCompleteDirectoryEntryList()
It returns all the directory entries in the repository as a map which holds the entryID as key and entryName as the value. The entryName should be the value to be shown in the UI. The entries will not be sorted and not guraanteed of the ordering. The return Map would be something like
      Key     Value
      ---     -----
      1234    REPOSITORY/abc/xyz.txt
 

Returns:
Returns the map consist of entryID as the key and entryName as the value.

getEntryNameToShowInUI

public java.lang.String getEntryNameToShowInUI(RepositoryEntry entry)
It returns the string representation of the input entry to be shown in UI.

Parameters:
entry - The entry would like to be shown in UI.
Returns:
Returns the string representation of passed entry.