Class PrimaryDataFileImplementation
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataFile
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.implementation.PrimaryDataFileImplementation
-
- All Implemented Interfaces:
java.lang.Comparable<PrimaryDataEntity>
@Entity public class PrimaryDataFileImplementation extends PrimaryDataFile
Implementation ofPrimaryDataFile
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrimaryDataFileImplementation()
Default constructor forPrimaryDataFileImplementation
is necessary for PojoInstantiator of HIBERNATE.PrimaryDataFileImplementation(PrimaryDataDirectory path, java.lang.String name)
Constructor for PrimaryDataFileImplementation.
-
Method Summary
Modifier and Type Method Description protected boolean
existData()
Abstract function to check if the currentPrimaryDataEntityVersion
of thisPrimaryDataFile
has stored data.java.lang.String
getID()
Getter for the ID of thisPrimaryDataEntity
.PrimaryDataDirectoryImplementation
getParentDirectory()
Getter for the parentPrimaryDataDirectory
of thisPrimaryDataEntity
.protected java.nio.file.Path
getPathToLocalFile(PrimaryDataEntityVersion version)
Load thePath
to the local stored file from the file system.protected java.util.Map<java.security.Principal,java.util.List<EdalPermission>>
getPermissionsImpl()
Abstract function for implementation ofPrimaryDataEntity.getPermissions()
.protected java.util.SortedSet<PrimaryDataEntityVersionImplementation>
getVersionList()
Getter for the fieldversionList
.protected java.util.SortedSet<PrimaryDataEntityVersion>
getVersionsImpl()
Abstract function for implementation ofPrimaryDataEntity.getVersions()
.protected void
moveImpl(PrimaryDataDirectory destinationDirectory)
Abstract function for implementation ofPrimaryDataEntity.move(PrimaryDataDirectory)
.protected void
readImpl(java.io.OutputStream outputStream)
Abstract function for implementation thePrimaryDataFile.read(OutputStream)
function.protected void
setVersionList(java.util.SortedSet<PrimaryDataEntityVersionImplementation> versionList)
Setter for the fieldversionList
.protected void
storeImpl(java.io.InputStream inputStream, PrimaryDataEntityVersion currentVersion)
Abstract function for implementation thePrimaryDataFile.store(InputStream)
function.protected void
storeVersion(PrimaryDataEntityVersion publicVersion)
Abstract function for storing a newPrimaryDataEntityVersion
for anPrimaryDataEntity
object.-
Methods inherited from class de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataFile
read, setMetaData, store
-
Methods inherited from class de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
addPublicReference, commitVersion, compareTo, delete, equals, getCurrentVersion, getImplementationProvider, getMetaData, getName, getPath, getPermissions, getPublicReferences, getSubject, getVersionByDate, getVersionByRevisionNumber, getVersions, grantPermission, hashCode, isDirectory, move, reloadOldDataType, rename, revokePermission, setCurrentVersion, setDefaultPermissions, setID, setParentDirectory, switchCurrentVersion, toString
-
-
-
-
Constructor Detail
-
PrimaryDataFileImplementation
protected PrimaryDataFileImplementation()
Default constructor forPrimaryDataFileImplementation
is necessary for PojoInstantiator of HIBERNATE.
-
PrimaryDataFileImplementation
public PrimaryDataFileImplementation(PrimaryDataDirectory path, java.lang.String name) throws PrimaryDataFileException, PrimaryDataEntityVersionException, PrimaryDataDirectoryException, MetaDataException
Constructor for PrimaryDataFileImplementation.- Parameters:
path
- aPrimaryDataDirectory
object.name
- aString
object.- Throws:
PrimaryDataFileException
- if unable to set data type.PrimaryDataEntityVersionException
- if unable to store initial version.PrimaryDataDirectoryException
- if no parentPrimaryDataDirectory
is found.MetaDataException
- if theMetaData
object of the parentPrimaryDataDirectory
is not clone-able.
-
-
Method Detail
-
existData
protected boolean existData()
Abstract function to check if the currentPrimaryDataEntityVersion
of thisPrimaryDataFile
has stored data.- Specified by:
existData
in classPrimaryDataFile
- Returns:
true
if the currentPrimaryDataEntityVersion
has stored data;false
otherwise.
-
getID
public java.lang.String getID()
Getter for the ID of thisPrimaryDataEntity
.HIBERNATE : constant length cause it is an
UUID
- Overrides:
getID
in classPrimaryDataEntity
- Returns:
- the ID of this
PrimaryDataEntity
- See Also:
UUID
-
getParentDirectory
public PrimaryDataDirectoryImplementation getParentDirectory() throws PrimaryDataDirectoryException
Getter for the parentPrimaryDataDirectory
of thisPrimaryDataEntity
.NOTE: It is not allowed to access the parent
PrimaryDataDirectory
of the rootPrimaryDataDirectory
!HIBERNATE : FetchType.EAGER for getPath()
- Overrides:
getParentDirectory
in classPrimaryDataEntity
- Returns:
- the parent
PrimaryDataDirectory
of thisPrimaryDataEntity
. - Throws:
PrimaryDataDirectoryException
- if trying to access the parentPrimaryDataDirectory
of the rootPrimaryDataDirectory
.
-
getPathToLocalFile
protected java.nio.file.Path getPathToLocalFile(PrimaryDataEntityVersion version)
Load thePath
to the local stored file from the file system.- Parameters:
version
- the version information to find the correctPath
to the local storedFile
.- Returns:
- the loaded
File
.
-
getPermissionsImpl
protected java.util.Map<java.security.Principal,java.util.List<EdalPermission>> getPermissionsImpl() throws PrimaryDataEntityException
Abstract function for implementation ofPrimaryDataEntity.getPermissions()
.- Specified by:
getPermissionsImpl
in classPrimaryDataEntity
- Returns:
- an unmodifiable
List
containing allEdalPermission
- Throws:
PrimaryDataEntityException
- if unable to load all permissions.
-
getVersionList
protected java.util.SortedSet<PrimaryDataEntityVersionImplementation> getVersionList()
Getter for the fieldversionList
.- Returns:
- a
SortedSet
object.
-
getVersionsImpl
protected java.util.SortedSet<PrimaryDataEntityVersion> getVersionsImpl()
Abstract function for implementation ofPrimaryDataEntity.getVersions()
.- Specified by:
getVersionsImpl
in classPrimaryDataEntity
- Returns:
- an unmodifiable
SortedSet
containing allPrimaryDataEntity
.
-
moveImpl
protected void moveImpl(PrimaryDataDirectory destinationDirectory)
Abstract function for implementation ofPrimaryDataEntity.move(PrimaryDataDirectory)
.- Specified by:
moveImpl
in classPrimaryDataEntity
- Parameters:
destinationDirectory
- the newPrimaryDataDirectory
for thisPrimaryDataEntity
.
-
readImpl
protected void readImpl(java.io.OutputStream outputStream) throws PrimaryDataFileException
Abstract function for implementation thePrimaryDataFile.read(OutputStream)
function.- Specified by:
readImpl
in classPrimaryDataFile
- Parameters:
outputStream
- the loaded data.- Throws:
PrimaryDataFileException
- if no data is stored.
-
setVersionList
protected void setVersionList(java.util.SortedSet<PrimaryDataEntityVersionImplementation> versionList)
Setter for the fieldversionList
.- Parameters:
versionList
- aSortedSet
object.
-
storeImpl
protected void storeImpl(java.io.InputStream inputStream, PrimaryDataEntityVersion currentVersion) throws PrimaryDataFileException
Abstract function for implementation thePrimaryDataFile.store(InputStream)
function.- Specified by:
storeImpl
in classPrimaryDataFile
- Parameters:
inputStream
- the data to store in thisPrimaryDataEntityVersion
currentVersion
- the newPrimaryDataEntityVersion
to store- Throws:
PrimaryDataFileException
- if storing of data fails
-
storeVersion
protected void storeVersion(PrimaryDataEntityVersion publicVersion) throws PrimaryDataEntityVersionException
Abstract function for storing a newPrimaryDataEntityVersion
for anPrimaryDataEntity
object.- Specified by:
storeVersion
in classPrimaryDataEntity
- Parameters:
publicVersion
- the newPrimaryDataEntityVersion
to store.- Throws:
PrimaryDataEntityVersionException
- if unable to storePrimaryDataEntityVersion
.
-
-